clausowitz Posted August 29, 2011 Share Posted August 29, 2011 Hi, I have a little code that checks if the user is logged in. Since I moved to another service it doesn't work anymore. <?php // Start_session, check if user is logged in or not, and connect to the database all in one included file include_once("scripts/checkuserlog.php"); if (!isset($_SESSION['idx'])) { $msgToUser = '<br /><br /><font color="#FF0000">Only site members can do that</font><p><a href="register.php">Join Here</a></p>'; include_once 'msgToUser.php'; exit(); } else if ($logOptions_id != $_SESSION['id']) { $msgToUser = '<br /><br /><font color="#FF0000">Only site members can do that</font><p><a href="register.php">Join Here</a></p>'; include_once 'msgToUser.php'; exit(); } ?> <?php if (isset($_SESSION['idx'])) { $decryptedID = base64_decode($_SESSION['idx']); $id_array = explode("p3h9xfn8sq03hs2234", $decryptedID); $logOptions_id = $id_array[1]; $logOptions_username = $_SESSION['username']; $logOptions_username = substr('' . $logOptions_username . '', 0, 15); ?> Quote Link to comment https://forums.phpfreaks.com/topic/245988-decryptedid-base64_decode_sessionidx/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 29, 2011 Share Posted August 29, 2011 Define: it doesn't work? There could be a dozen different things for the code fragments you posted that could have stopped as the result of moving between different server configurations. Exactly what symptom or error did you see in front of you that leads you to believe - 'it doesn't work'? Quote Link to comment https://forums.phpfreaks.com/topic/245988-decryptedid-base64_decode_sessionidx/#findComment-1263333 Share on other sites More sharing options...
clausowitz Posted August 29, 2011 Author Share Posted August 29, 2011 Well before when I logged in I never had any problem getting the message: else if ($logOptions_id != $_SESSION['id']) { $msgToUser = '<br /><br /><font color="#FF0000">Only site members can do that</font><p><a href="register.php">Join Here</a></p>'; but now some pages i can get one and others I get this error. It must have something to do with the server cause I didn't change anything in the code, just moved the website to another domain. Marco Quote Link to comment https://forums.phpfreaks.com/topic/245988-decryptedid-base64_decode_sessionidx/#findComment-1263336 Share on other sites More sharing options...
clausowitz Posted August 29, 2011 Author Share Posted August 29, 2011 I use this on login: <?php $id = $row["id"]; $_SESSION['id'] = $id; // Create the idx session var $_SESSION['idx'] = base64_encode("g4p3h9xfn8sq03hs2234$id"); // Create session var for their username $username = $row["username"]; $_SESSION['username'] = $username; // Create session var for their email $useremail = $row["email"]; $_SESSION['useremail'] = $useremail; // Create session var for their password $userpass = $row["password"]; $_SESSION['userpass'] = $userpass; // GET USER IP ADDRESS $ipaddress = getenv('REMOTE_ADDR'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/245988-decryptedid-base64_decode_sessionidx/#findComment-1263338 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.