Re: [PHP-DB] Session start
Barry, session_start(); will not wipe clean the user's session so there is something else going on. Does the login.html authentication script correctly set $_SESSION['username'] ? Also, it has been my experience that code like isset($_SESSION['username']) is better if you replace it with array_key_exists('username',$_SESSION) Thanks, --Dustin Barry Zimmerman wrote: I have a problem with my system, not sure how I can fix this one. A user has a log in page and takes them to different pages, now each of these pages has a check to make sure they are logged in with the following code: session_start(); if (!(isset($_SESSION['username']) $_SESSION['username'] != '')) { header (Location: login.html); exit; } So if they are not logged in it redirects them to the log in page. No problems there. Now if a user is not logged in and comes back to that page, it starts the session so giving them a session id and redirects them back to thge login page. The problem I have is I do NOT want the session to start, I need them to hit the log in page with no sessions there. I have tried all sorts but just cannot get this to work. I have tried adding this to the code. session_start(); if (!(isset($_SESSION['username']) $_SESSION['username'] != '')) { *session_destroy();* header (Location: login.html); exit; } But that did not work? Please I am stuck for ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: **{SPAM}** [PHP-DB] numeric string to single digit array
Richard, Someone might have a quicker/better way, but what about: ?php $numbers = '1223123'; $numberarray = str_split($numbers,1); print_r($numberarray); ? Thanks, --Dustin Richard Dunne wrote: Can anyone tell me how how to convert a string of integers into an array of single digit integers. i.e. 1223123 into ['1','2,','2','3','1,'2','3'] ? When I retreive a column of single digit integers I end up with a long string of numbers. I think PHP is seeing this as one whole number and therefore is not splitting or exploding it. I hope I am wrong in my thinking and there is a simple solution, though I am not seeing it. Can anyone help me? Richard. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Autorunning a file
Alexander, Assuming you are on a *nix machine and php is installed in /usr/local you could schedule a cron job with the command: /usr/local/bin/php phpfile.php where phpfile.php is the file you want to execute. Hope this helps. Thanks, --Dustin Alexander wrote: Is there anyway to auto execute a PHP file? I'm working on a script that tracks activity and IPs of visitors, and then at a certain time daily emails me the results. Any idea of a way to do this? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php