Crew-Portal Posted August 8, 2007 Share Posted August 8, 2007 I have never seen this before. I just started making a new login script and about 3 minutes into it I started getting an error: 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 Here is the script login.php <?php session_start(); ?> <form action="go.php" method="post"> Username: <input type="text" name="username" /> Password: <input type="password" name="password" /> <input type="submit" value="Login" class="button"> </form> <?php echo $login_s; ?> <?php if (isset($_POST['destroy'])) { //if login pressed session_destroy(); } else { //else show form ?> <form action="" method=post> <input type=submit name=destroy value=Destroy Session!> <?php } ?> go.php <?php session_start(); $connection = @mysql_connect(localhost, ****, *******) or die("Couldn't connect."); $db = @mysql_select_db(database, $connection) or die("Couldn't select database."); $sql="SELECT * FROM user WHERE username = \"$_POST[username]\" AND password = \"$_POST[password]\""; $result = @mysql_query($sql,$connection) or print("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error()); $num=mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { $active = $row['active']; $confirm = $row['confirm']; } if($num >0) { if($active == "yes") { $valid_user = $_POST['username']; session_register("valid_user"); if (isset($valid_user)){ $login_s = 'You Have Been Sucessfully Logged In!'; } include("index.php"); } } ?> Okay I do realize this script is not safe but As I said I started designing it 2 minutes ago so who really cares. The only problem is that I got this error. Could someone help? Quote Link to comment https://forums.phpfreaks.com/topic/63843-solved-wierd-error/ Share on other sites More sharing options...
trq Posted August 8, 2007 Share Posted August 8, 2007 You might want to read up on sessions. session_regsister() has long been depricated. Quote Link to comment https://forums.phpfreaks.com/topic/63843-solved-wierd-error/#findComment-318197 Share on other sites More sharing options...
Crew-Portal Posted August 8, 2007 Author Share Posted August 8, 2007 Hu? I didnt change the script and all of a sudden the error just stopped coming up! it may have been an error in the PHP .dlls itself? IDK but its working fine now so sorry for buggin you guys! TOPIC SOLVED!!! Quote Link to comment https://forums.phpfreaks.com/topic/63843-solved-wierd-error/#findComment-318199 Share on other sites More sharing options...
trq Posted August 8, 2007 Share Posted August 8, 2007 Still, session_register() has long bee depricated and should no longer be used. Quote Link to comment https://forums.phpfreaks.com/topic/63843-solved-wierd-error/#findComment-318204 Share on other sites More sharing options...
Crew-Portal Posted August 8, 2007 Author Share Posted August 8, 2007 Wait the errors back and what do you mean it shouldnt be used? How am I supposed to register variables in PHP5? Quote Link to comment https://forums.phpfreaks.com/topic/63843-solved-wierd-error/#findComment-318214 Share on other sites More sharing options...
trq Posted August 8, 2007 Share Posted August 8, 2007 How am I supposed to register variables in PHP5 session_registaer() was deprictaed long before php5. A simpe example... p1.php <?php session_start(); $_SESSION['foo'] = 'bar'; echo '<a href="p2.php">link</a>'; ?> p2.php <?php session_start(); if (isset($_SESSION['foo'])) { echo $_SESSION['foo']; } ?> No session_register() required. Quote Link to comment https://forums.phpfreaks.com/topic/63843-solved-wierd-error/#findComment-318217 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.