Jump to content

chasethemetal

Members
  • Content Count

    169
  • Joined

  • Last visited

Posts posted by chasethemetal

  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. 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!

    • Like 2
  7. 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!

  8. 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.

  9. 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?

  10. 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!

  11. 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!!

  12. 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!

  13. 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.

  14. 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.

  15. $output = array( 'response' => $a); echo json_encode( $output ); Now that is turned into a javascript object you can access the information in the javascript in the success handler, like so data.response. You will have all of the information thats contained in $a. You can use something like $.each( ) to iterate through the different options, or you could access them like var anna = data.response[0]... Try looking up .ajax in jQuery. Much easier to work with then hard coding ajax calls in javascript. Hope this points ya in the right direction, but the key is changing the array to a JSON object.

  16. Hey all! I am trying to format an array a specific way, and I can't seem to figure out the way to loop the information out so it is formated a specific way. Here's what I'm doing

    while ( $data = mysql_fetch_array( $results ) ) {    $arr[] = array( $data['date'], $data['name'], $data['count'] );}

    This outputs an array like so:Array( [0] => Array ( [0] => 2012-02-24 [1] => NAME-ONE [2] => 3 ) [1] => Array ( [0] => 2012-02-23 [1] => NAME-ONE [2] => 5 ) [2] => Array ( [0] => 2012-02-23 [1] => NAME-TWO [2] => 2 ))What I am looking for a final result would be Array( [0] => Array ( [0] => Date [1] => NAME-ONE [2] => NAME-TWO ) [1] => Array ( [0] => 2012-02-24 [1] => 3 [2] => 0 ) [2] => Array ( [0] => 2012-02-23 [1] => 5 [2] => 2 ))Notice I need to place a zero if the value doesn't exist... Any pointers on how to make it here would be great! Thanks so much!

  17. Hey Guys, I am trying to figure out how to have the outer div's width and height equal 100%, while the inner div's width and height are 100% minus a 10px padding around the whole inner centered horizontally and vertically. I just can't seem to make it work. The outer div would have a black background while the inner div would have a grey background, making a 10px black border around the grey area no matter the size of the window it's in. Any help would be appreciated.

  18. Hey all! I have a question about safari and chromes Inspect Element developer feature. I might be going crazy but I think I might have clicked always enable resource tracking in the resource tracking pane, and now when I inspect elements everything's in a list mode, and the nice timeline version of inspect element has disappeared forever!!! I've been searching and searching the internet for a way to reset this, and the only thing thats come close is people say there's a little blued checkbox in the bottom that if you click disables the resource tracking, but my browser doesn't have that!! Did Safari and Chrome change there resource tracking pane??? Im baffled because I have the same versions on my desktop and everytime I click Resources it ask's me would I like to track this time, or always, and I always choose just this time, BUT on the computer in question my laptop it doesn't ask me that anymore and the Resource pane is stuck in a list view, the list view doesn't even include header information! Anyways this is a real pain in my ars3, if anyone knows of a solution that would be awesome, im trying not to uninstall and reinstall my browsers.

    • Like 2
  19. Thanks birbal. This still doesn't result in what I'm searching for. It will still list multiple same dates, take a close look at my desired div output structure above, and then take a closer look at how my table is structured. You'll see that the method you are suggesting doesn't echo the desired results. I am working on something right now that uses ajax to build the div structure on click. But I would love to find a way to have all the information outputed at once. Again if anyone know's what I'm trying to do please point me in the right direction.

  20. Thanks birbal. I've tried your method, this doesn't produce the results I'm looking for. It still echo's a DIV for every date record, so we will have repeated dates... Also I'm not sure what "$dbadta" in your code does, is that just to make a null value? This is what your method would echo

    <div id="date">2011-12-29</div><div id="date">2011-12-29</div><div id="date">2011-12-30</div><div id="date">2011-12-30</div>

    I'm searching a way to have one date, with it's related venues, and then related people inside that.

  21. What does my Select statement need to look like? Which looping method should I use to get the information output'd like this? For instance the basic way to loop the data out looks like this.

     $con = mysql_query("SELECT * FROM events GROUP BY date,venue ORDER BY date ASC", $db) while($data = mysql_fetch_array($con)){echo $data['date'];echo $data['venue'];echo $data['people'];};

    But this doesn't result in the data formated in which there is only ONE date for every related Venue, with each Venue then having the related people inside. I am trying to have my information sorted and grouped so that the echo'd output would result in how my div structure above is. I hope that explained my situation more clearly.

  22. Hey all I'm trying to output some info from a mysql table. I am having troubles figuring out how to do it in a specific manner. I'm thinking I might need nested calls or to use a for, or foreach loop. Anyways, I keep getting really confused, and can't come up with a solution. This is my mysql table structure, pardon my formatting of the table here, tried to make it all line up right as possible, but you should still see my basic structure!

    |  Date		|  Venue	  |  Person			|  2011-12-29 |  Palace	 |  Greg				|  2011-12-29 |  Palace	 |  John				|  2011-12-29 |  Palace	   |  Scott			  |  2011-12-29 |  Riggers	|  Bob				|  2011-12-29 |  Riggers	|  Sam				|  2011-12-30 |  Mankind   |  Greg				|  2011-12-30 |  Mankind   |  Scott				|  2011-12-30 |  Palace	   |  Chris				

    I'm trying to output this information into div's formatted in this specific way.

    <div id="date">2011-12-29 <div id="venue">Palace<div id="person">Greg</div><div id="person">John</div><div id="person">Scott</div></div> <div id="venue">Riggers<div id="person">Bob</div><div id="person">Sam</div></div> </div> <div id="date">2011-12-30 <div id="venue">Mankind<div id="person">Greg</div><div id="person">Scott</div></div> <div id="venue">Palace<div id="person">Chris</div></div> </div>

    Getting everything to echo out in this way has really been stumping me to no end. Any pointers would be appreciated! Thank you so much.

  23. Hey all I'm having some problems grouping some information. The structure is like so..... We have a Persons column, and a Houses column in mysql. Everyone row has the persons name which is unique and a house. I am trying to figure out a way to echo the persons name once with all associated houses below. I am trying to figure out a way to get this information formatted like below but OUTSIDE the loop. Persons 1<br />House 1<br />House 2<br /> and Person 2<br />House 1<br />House 2<br />House 3<br />

×
×
  • Create New...