Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Location
    New York

chasethemetal's Achievements


Member (2/7)



  1. Hey all, For the life of me, I can not figure out how to pass the X-Forwarded-For header to PHP via fastcgi. I am running Nginx, it has been configured with all modules. Does anyone have any suggestions for getting the visitors real IP address from behind a rackspace loadbalancer, in Nginx and passing to fastcgi? Thanks so much.
  2. Move those files behind the public directory. Not sure what your folder name is but, it looks like public_html/scripts/php/myscript1.php right now. So make a folder next to public_html called scripts/ now your include will be include '../scripts/php/myscript1.php'. No need for any .htaccess, plus the .htaccess file still exposes your directory structure. Solution, move all PHP behind the public wall making it impossible to access from the browser directly /home/user/public_html/ *all website, html, js, css, images*/home/user/scripts/ *php and such here*
  3. Hey All! I currently running Nginx as my web server, and I want to create a kind of catch all domain name handle, but cant seem to find any documentation on how to do this. Heres the use case... Lets say I changed the A Record for a site "superawesometest.com" to point at my server. But on my web server, running Nginx I don't have a site listening for that domain name. So instead of throwing an error, or sending the request to my Default Site, I want it to handle it by passing the requested domain name as a query parameter to a handler domain name. i.e. www.superhandler.com?requested_uri=superawesometest.com Any thoughts on how to do this? Thanks so much.
  4. Hey all! What option do you think will scale better? To have 1 big select statement joining columns. Or multiple small queries to retreive the same information. Let me illustrate what I mean exaclty. Table2 and Table3 could have millions of records while, Table1 would only have thousands. The big select with Joining SELECT table1.uri, table1.name, table2.random1, table2.random2, table3.something1, table3.something2FROM table1, table2, table3WHERE table1.id = 1 AND table2.id = 1 AND table3.id = 1 Multi small queries SELECT uri, name FROM table1 WHERE id = 1SELECT random1, random2 FROM table2 WHERE id = 1SELECT something1, something2 FROM table3 WHERE id = 1 Thanks!
  5. Hello! I have 2 pages, the parent document and mulitple iframes in that parent document. In the iFrames I am trying to target it's own class attribute... <iframe class="frame"></iframe><iframe class="frame"></iframe><iframe class="frame"></iframe> So inside each iframe I have a function and I am trying to clear its class! But I can't figure out how to target itself!!! So I do the function in the first <iframe> and it should look like this now <iframe></iframe><iframe class="frame"></iframe><iframe class="frame"></iframe> Any help would be appricieated thanks!
  6. Thanks guys! I'll try these things and get back to you with my results!
  7. Hey all! I am trying to serve some MP3's through a function but am running into a little problem. Here is my code header( "Content-Type: audio/mpeg;" );header( "Content-length: ".filesize( $media ) );header( "Content-Transfer-Encoding: binary" );header( "Cache-Control: no-cache, must-revalidate" );header( "Expires: Sat, 26 Jul 1997 05:00:00 GMT" );header( "Content-disposition: inline; filename=\"".basename( $media )."\"" );readfile( "{$media}" ); $media is the file path. Ok so this works, the music plays. BUT it waits till it has downloaded the entire song before it will start playing in the browser. Where as if I put the direct location of the song in my browser it will start playing the song immediatly AS it is downloading the rest of the file. So my question is how can I serve the mp3 so that it starts playing as soon as data starts being sent back to the browser? Thanks so much!
  8. I have two arrays. Array( [0] => Array ( [0] => 04/13/2012 ) [1] => Array ( [0] => 04/14/2012 )) AND Array( [0] => Array ( [0] => 0 [1] => 0 ) [1] => Array ( [0] => 1 [1] => 0 )) How can I merge the data so it will look like this... Array( [0] => Array ( [0] => 04/13/2012 [1] => 0 [2] => 0 ) [1] => Array ( [0] => 04/14/2012 [1] => 1 [2] => 0 )) Thankss any help is always appreciated!
  9. Thanks! Right now I'm running on a dedicated centos. In conclusion, It's not necisarly your database design at this type of scale, it has a lot to do with your infustructure. I am assuming that if I hit 200 million + records we will be at a point where we have our own dedicated database server(s). Alright I think I'm going to go with method 1, as I don't want to use PHP to sort information, I think that might be more taxing.
  10. Thanks! How many records are too many / too long? These are things I couldn't give you an answer too, what do you think, whats the best practice? Would it be ridiculus to have 200 million rows in a table? I won't ever be searching for specific emails, and if I needed to I have functions to pull the email feild out, explode it and search the foreach loop for the speciifc information... I guess my question is if I did it method 1, would it be ridiculus to have 200 million + rows?
  11. Hey all, I am about to implement a mailing list system I built and one thing I can't decide on is how I am going to store the emails. The reason it's not so simple is this system needs to be scalable, as in 50,000 + users, all of which might have 20,000 + emails and in ONE table. The two ways I figure to do this are... Having a user id column and an email column, every time a user ad's an email to there list we create a new row with there user id and the new email. The issue with this, is this table could potentially get way to huge with millions of records and take too long to pull from and update from. The second way which i'm leaning towards is to have again a user id column and an email column, this time the user id column is unique and I instead store all of the emails in the email column like "email1@gmail.com,email2@gmail.com". perhaps even in a json format too... And when I need to add one, I would just append a new one to the end. Now the problem with this one is the email field could also get huge with 20,000 + emails, and it might take a while to pull them all out and append a new one to the end... Which way do you think would be more scalable when it comes to storing emails? Also, what table type might be more efficient, InnoDB or MyISAM? Thanks so much!
  12. Hey all! I am looking for some code examples of your favorite way to load classes. Currently all of my classes extend one super class. In the super class I have a protected function called _load($classname), this function takes the name of the class and through a foreach loop, i assign objects and load the class, require_once($classname.php); $this->$classname = new $classname; How I activate this is in the __construct of the sub classes, I call _load(classname) and load the class I need giving me access to all that classes public functions in a nice way. subclass {$this->classname->publicFunction();} Can anyone think of a better way of doing this? This works great right now as a global way to load and access a class on demand, but I wonder. Is there a better way, perhaps a way to access the protected functions (not extending as ill need access to more then one class at a time)? Thanks!!
  13. Hey all! I just installed the PECL extension uploadprogress, and I have verified it's installation and everything. I was wondering if someone could point me to a supppper simple example of someone using this. All am looking for is a way to output the number as a percent, nothing styled or anything, just a raw use case using ajax so its in the same page as the upload form. Any examples if ya know what I'm looking for would be awesome! thanks all!
  14. Thanks! This is almost what I am looking for. However the end result array im looking for would look like $arr[] = array( $date, $count, $count ); I define the names in above, and below am trying to store their relative counts. The predefined array above the while loop is setting labels, And the information that follows, is the date, and counts for each name. Im using the google charts API to graph some things, and the data needs to be formated like this unfortunatly. Thanks, anymore help would be awesome! And again, we can not use the is_null, as I am not storing anything in the database if there is no record. So my database could have a record on 2012-01-30, and then next record being today, 2012-02-25, the end array would need to have all of the dates in between, with zeros. I have accomplished this by creating a daterange function and I have made use of this and is working great where the data needs only 2 columns, date and count. My issue is where I need it formated, as date and count, and count. three columns.
  15. is_null() can't be used, as I am not storing zero values in the db. The answer for the zero values, is to build an array above the while loop, maybe using the dates as the key, and filling name-one and name-two counts with zeros, then when the while loop fires it will replace the ones that actually have values. I can figure that out, my problems however is more of to HOW can I get the array formatted like my example below, from the example above. Thats the real brain twister here.
  • Create New...