perezf Posted September 2, 2007 Share Posted September 2, 2007 Im making a login script with sessions, and when i logged in i recieved a message Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 I dont really know what that is and how to fix it can someone explain to me on how to fix that here is my script for logging in <?php $username = $_POST['username']; $password = $_POST['password']; if( (empty($username)) || (empty($password)) ) { print("<p>Please fill in all fields to continue</p>"); } else { $password = md5($password); $query = "SELECT username FROM ph_users WHERE username = '$username' AND password = '$password'"; $result = mysql_query($query) or die("<p>Please Try Again</p>"); $row = mysql_fetch_row($result); if($row > 1) { session_start(); session_register('username'); print("<p>Thank you for logging in</p>"); } else { print("<p>Please Try Again</p>"); } } ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="POST"> <label>Your UserName:</label><br><input type="text" size="30" name="username"><br><br> <label>Your Password:</label><br><input type="password" size="30" name="password"><br><br> <input type="submit" name="login" value="Login to your Account"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/67586-solved-wierd-message/ Share on other sites More sharing options...
pocobueno1388 Posted September 2, 2007 Share Posted September 2, 2007 Replace this line: session_register('username'); with: $_SESSION['username'] = "Value"; That *might* get rid of the error. Your registering your session the deprecated way. Quote Link to comment https://forums.phpfreaks.com/topic/67586-solved-wierd-message/#findComment-339515 Share on other sites More sharing options...
perezf Posted September 2, 2007 Author Share Posted September 2, 2007 how does this work $_SESSION['username'] = "Value"; what does Value stand for Quote Link to comment https://forums.phpfreaks.com/topic/67586-solved-wierd-message/#findComment-339518 Share on other sites More sharing options...
pocobueno1388 Posted September 2, 2007 Share Posted September 2, 2007 Well, you have to give the session a value. I'm guessing the value would be the users username...If you don't want to assign a value to it, just do this: $_SESSION['username'] = TRUE; The value of the session is what would be displayed if you echoed it out. Quote Link to comment https://forums.phpfreaks.com/topic/67586-solved-wierd-message/#findComment-339519 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.