seany123 Posted October 31, 2011 Share Posted October 31, 2011 Do you login to your game/site? if so then the sessions should be working fine, which is whats confusing me. Quote Link to comment Share on other sites More sharing options...
zelig Posted October 31, 2011 Author Share Posted October 31, 2011 Yes, you have to login to get into my website. I'm trying to run the script without logging in, since it's going to be a cron job. But the 'testerzelig' account is logged in on another browser, in the 'rest' state, to see if the cron job is working. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 31, 2011 Share Posted October 31, 2011 register_globals should be Off. You should have error_reporting set to -1 (negative one). It may be a good idea to call php_info() and verify the directives are being read properly by php. If that checks out, the next logical step would be to see exactly what the #_SESSION array holds by putting this immediately after include('../lib.php');, which I would change to require_once() instead because it's essential to the functionality of the script that it be included properly. echo '<pre>'; print_r($_SESSION); echo '</pre>'; Quote Link to comment Share on other sites More sharing options...
zelig Posted October 31, 2011 Author Share Posted October 31, 2011 This is what prints out now, after I made all those changes and restarted Apache. Array ( ) Error: either $_SESSION[userid] or $_SESSION[hash] was not set. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 31, 2011 Share Posted October 31, 2011 Quick note: I have a typo above, there's no underscore in phpinfo(). My suspicion is that there is a header error not allowing the session to be started, but it isn't being reported for some reason. Add this immediately after the opening <?php tag in your script, and see if any errors show up. ini_set('display_errors', 'On'); error_reporting(-1); Quote Link to comment Share on other sites More sharing options...
zelig Posted October 31, 2011 Author Share Posted October 31, 2011 Hmm... This posted: Strict Standards: main() [function.main]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /home/katarra/public_html/config.php on line 14 Strict Standards: Only variables should be assigned by reference in /home/katarra/public_html/config.php on line 14 Array ( ) Error: either $_SESSION[userid] or $_SESSION[hash] was not set. Quote Link to comment Share on other sites More sharing options...
seany123 Posted October 31, 2011 Share Posted October 31, 2011 The queries your running will NOT work unless your logged in, reason being the queries are using $player->id, which is set by your $_SESSION['userid']; for example: $player = check_user($db, $secret_key); $query = $db->execute("select * from `users` where `id`=?", $player->id); the query is selecting all from users where id = 0 so when your testing the session_id you need to be logged in. Quote Link to comment Share on other sites More sharing options...
zelig Posted October 31, 2011 Author Share Posted October 31, 2011 How will this work, then, as a cronjob? Is there a way I can test it out to make sure it is working? I have it setup to do the cron every minute, but it doesn't appear to be working. That's why I was running it manually. Quote Link to comment Share on other sites More sharing options...
seany123 Posted October 31, 2011 Share Posted October 31, 2011 You have created an Cronjob on your phpmyadmin? or have you done it as a php file? Quote Link to comment Share on other sites More sharing options...
zelig Posted October 31, 2011 Author Share Posted October 31, 2011 I've created it as a cronjob through my server. I was running it manually as a php file to see if it was working or not. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.