Jump to content

mlin

Members
  • Posts

    91
  • Joined

  • Last visited

Everything posted by mlin

  1. when the user logs in to your site, you'll use the Insert statement to add a row to your online table. Every request thereafter should update that row's timestamp and page. You shouldn't have more than one row for each user. don't forget the garbage collection
  2. $_SERVER['PHP_SELF'] contains the currently requested file, but you were correct about $_SERVER['REQUEST_URI'] which will contain the file And any get variables in the request. Use the latter. parse_url will help you out, it'll break down the sections of your uri into an easy to use array. I'd recommend logging each user who is logged in to an 'onlinenow' table that holds the username, file, variables, and timestamp. Setup some sort of garbage collection to delete rows where the timestamp is expired. Then to display who is online for the entire site, query just the usernames. And to query who is online for a particular page, query the file and variables as well. Hope that helps!
  3. good job man, it's coming along. I clicked around for a minute. need any help with the project?
  4. If you show us your code and what's going on, maybe we can stop em before it happens again
  5. php won't let you run till your done for a reason. it's dangerous. endless loops, math gone bad, bad recursion, etc... you can increase max_execution_time in your php.ini there may be other directives that affect the runtime limit, I'm not sure off the top of my head
  6. for sure, 1 connection is fine. Only reason you'd need multiple connections is for multiple databases. If what your trying to accomplish is going to be more than php can handle in one shot, you might think about splitting it over multiple requests. Set some sort of upper bounds on your script that your going to reach safely before a timeout. Save some sort of data to make sure your next request knows where to start and it will continue from there, and so on. Kind of like pagination...only very different I suppose =) Never run into a situation like this myself so please share how it goes if you come up with anything...english is nice, but php is better
  7. huh? html for blank input field and submit? <form action='' method='post'> <input type='text' name='blank' /> <input type='submit' value='Post' /> </form>
  8. I have no idea why you would do something like this man. what do you have now, and what does the correct end result look like. why would you want to connect to so many databases?
  9. it's easier to use 2 variables in your loop. something like this: $show = range(1,15); $array_length = count($show); echo '<table>'; for ($i = 0, $k = 1; $i < $array_length; $i++, $k++) { if ($k == 1) echo '<tr>'; echo '<td>'.$show[$i].'</td>'; if ($k == 3 || ($i + 1) == $array_length) { echo '</tr>'; $k = 0; } } echo '</table>';
  10. I think I somewhat know what your going through, but could you post your class so I can see what's going on? There's got to be a way to optimize what your doing. 1 connection should suffice most needs
  11. Ok, so you've got a table full of music suggestions and you'd like to randomize the suggestions shown on each refresh. You can use the rand() cmd in your sql query...such as: select suggestions from music order by rand() limit 10 if your just randomizing the Entire list of suggestions, get rid of the limit in your query
  12. dude, you don't want any quotes in the posted data. We've already posted the code to strip any quotes from the strings that your user posts. I'll try to break it down one more time. your html form has an input with name='something' like your example above once that form is submitted, you need to get the post with the name something $something = $_POST['something']; now you want to strip single quotes from the string $something = str_replace("'", '', $something); now you still need to strip double quotes $something = str_replace('"', '', $something); does that help man?
  13. down here in your code: list($width, $height, $type, $attr) = getimagesize($target); resample($target, 800, 800, $type, false); resample($target, 150, 150, $type, true); add one more call to resample...ie resample($target, $width, $height, $type, ?); don't know what attr does, so you'll have to double check that. and you have to make sure that tartget matches your original uploaded file. Should be good to go
  14. try using trim(). not sure if this will help but it's worth a shot $myFile = "./frontpagearticles/testFile.txt"; $fh = fopen($myFile, 'r'); $theData = trim(fgets($fh)); echo file_get_contents($theData); $theData = "./frontpagearticles/" . $theData; echo file_get_contents($theData); echo file_get_contents("./frontpagearticles/allstar.txt");
  15. well, if your variable name is var $trackit = $var[1]['tracking_number']; //then you could do what ever you want with trackit, when you want to update your array assuming you've edited trackit $var[1]['tracking_number'] = $trackit; is that what you mean?
  16. your form could just output an html preview of what the config would look like, so you wouldn't have to worry about saving to a file for preview. Then if they click download. Write the settings to a temp file. Then read the file to the browser like this: $dl_path = '/var/www/project/tmp/'; $file = 'settings.cfg'; header('Content-Description: File Transfer'); header('Content-Type: application/force-download'); header('Content-Length: ' . filesize($dl_path . $file)); header("Content-Disposition: attachment; filename=$file"); readfile($dl_path . $file); That will send the settings.cfg file to the browser as a download, so whether they click save or not, you've sent the file to them, so it's save to unlink($dl_path . $file); to remove it
  17. don't leave your original image untouched. Resize it, without resizing it just to make sure the permissions for your thumb, and main image match. Apache may save your upload as one user, then when you modify the original image to create a thumb, php may save as another user. So if you edit without resizing, your permissions will match.
  18. check your php.ini to make sure the mysql and/or mysqli extensions aren't commented out if that still doesn't work. make sure that your extension_dir directive in your ini file is correct, or copy the extensions to the directory it already expects them at. After any changes to your ini file, remember to restart your apache server for the extensions to be loaded
  19. Your absolutely right. I misinterpreted in my own brain thinking that you meant, 1 client would be sending thousands of requests. Gmail still has to request data at certain intervals, and in order to conserve unused bandwidth from idle clients, they "gracefully degrade" their javascript to lengthen or stop their request intervals from idle users. Whether or not their using xmlhttprequest object, or some sort of actionscript is up to them as the user, just as it is up to us in our applications. Just open up firebug and watch the requests...gmail doesn't only talk to the server when an event happens with their actionscript, a request is made to detect the event (new email, contact just logged in, etc..)
  20. $something = str_replace('"', '', $_POST['something']); $something = str_replace("'", '', $something);
  21. I'm with you garry. I setup my rootpath, then I define contants such as: ROOT_PATH INC_PATH CLASS_PATH UPLOAD_PATH those are probably the most frequently used for me. But I don't like messing with php's pointer's either. Sometimes they just don't seem to know what your talking about.
  22. Ok, I'm not sure, but it sound's like you've run into some sort of scope issue. The way I usually setup my projects is something like this. request goes to index.php, or any other request file in my doc_root then, all request files require some sort of sessions file, or config file that starts the session, sets up db connections, and establishes the doc_root using getcwd() If all that is set in main scope...ie not in a function, or class method, those vars will available anywhere in your includes except when they lose scope to the inside of a function or class method. Constants like DOC_ROOT however ARE available in the global scope so it may be used wherever you'd like. If this doesn't come close, please leave a more detailed description, or post more code so that I can debug it for you on my local server here.
  23. nope, my last name is Linardy. why do you ask? http://linardy.com/
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.