Jump to content

scott212

Members
  • Posts

    58
  • Joined

  • Last visited

    Never

Everything posted by scott212

  1. Not really sure what SSI is... But the rest isn't too difficult: 1. Get the data from the form with $_GET['blah'] or $_POST['poo'] and do any form validation you may want. 2. writing: $pathToFile = "/news.dat"; $handle = fopen($pathToFile, 'a'); // opens the file for appending $content = "write me"; // clear your data of line breaks and line ends. (I usually replace it with ":::" or something so I can replace them later) fwrite($handle, $content); // write to the file fclose($handle); 3. reading: $handle = fopen($pathToFile, 'r'); $entries = file($handle); //  reads the file into an array, indexed by new lines $entries = array_reverse($entries); // reverse the array so new entries appear first fclose($handle); 4. iterate over the array however you want to display the contents. Is this what you wanted to do? I would recommend looking at http://www.tizag.com/phpT/fileread.php for more help
  2. I would like to expand on the original question if I may. Would there be any reliable way to change the logged in status when the users session ended? Or if not that, maybe when a user is logged in, you could store there session id in the db and on a page reload, a search could get that list, then check that against list to see if the server still has any of these session open? Then you could see exactly who is online at any given time. Is this possible?
  3. I've got a community site build in progress and it handles image uploads to be associated with an identity. When the script uploads the image it of course resizes, renames, and places the image in the users directory. Well now that I've added the ability to change that image, since the new image is in the same place as the old one and has the same name, the browser has a hard time letting go of the old one. Anyone got any ideas on how this should be handled? For now I'm using an old flash cheat that sorta works where you append a random number to the end of the html image call such as: [code] <img src="blahblah.jpg?rand=<? echo rand(0,999); ?>" />  // result: <img src="blahblah.jpg?rand=567" /> [/code]
  4. nope, your right, I'm a dink. Thanks
  5. Does anyone know the key combination for the caret to use in regular expressions? (windows)
  6. I'm not sure what others will say, but I approach that situation a little differently. I do the majority of my form processing for a page at the top of that page inside of an 'if' statement to see if the button name is valid (i.e. if the form was submitted). During the form processing at the top of the page, should the script fail a conditional, you just exit out and it continues on with the page. It also makes it really easy to pass feedback to the rest of the page about what went wrong. Cheers!
  7. I figured it out right as you posted this, what an excellent thing! Guess I've just avoided the complexity of multidimensionals, now I wish I wouldn't have, thanks!
  8. I've seen people use session variables with a second indexes like this: [tt]$_SESSION['id_01']['id_02'][/tt] I can't seem to find any documentation on this method, anyone have any links? If it works like it seems, what would the syntax be to iterate through the second indexes within the confines of a first id? Such as if I had: [tt]$_SESSION['basket']['01'], $_SESSION['basket']['02'], $_SESSION['basket']['03'][/tt] How could I iterate through the different items in 'basket' using a foreach or for loop?
×
×
  • 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.