codexx Posted June 10, 2007 Share Posted June 10, 2007 Hey Everyone, My datacenter updated their php version and I am getting this error. (Its on a login page) 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 my code being used is: <? if ($_POST['username'] && $_POST['password']) { $username = $_POST['username']; $password = $_POST['password']; dbConnect(); $pass = md5($password); $result = mysql_query(" SQL QUERY"); if (mysql_num_rows($result) == 0) { ?> // Invalid Page <? }else{ while ($row = mysql_fetch_assoc($result)) { //REGISTER SESSION session_register("*valuehere*"); Thanks in Advance, Sean Quote Link to comment https://forums.phpfreaks.com/topic/55025-solved-session-side-error-message/ Share on other sites More sharing options...
AndyB Posted June 10, 2007 Share Posted June 10, 2007 If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled. register_globals: important note: Since PHP 4.2.0, the default value for the PHP directive register_globals is off, and it is completely removed as of PHP 6.0.0. http://ca.php.net/manual/en/function.session-register.php Quote Link to comment https://forums.phpfreaks.com/topic/55025-solved-session-side-error-message/#findComment-272002 Share on other sites More sharing options...
codexx Posted June 11, 2007 Author Share Posted June 11, 2007 Thanks alot, I guess I didn't read it slow enough. What is the new way to register a session variable so it can still be retrieved using $_SESSION[''] ? Quote Link to comment https://forums.phpfreaks.com/topic/55025-solved-session-side-error-message/#findComment-272024 Share on other sites More sharing options...
AndyB Posted June 11, 2007 Share Posted June 11, 2007 $_SESSION['fruit'] = "banana"; Quote Link to comment https://forums.phpfreaks.com/topic/55025-solved-session-side-error-message/#findComment-272026 Share on other sites More sharing options...
redarrow Posted June 11, 2007 Share Posted June 11, 2007 untested but i am sure it ok. <?php session_start(); // database connection $db=mysql_connect("localhot","username","password"); mysql_connect_db("datebase_name",$db); // post user_name and password. $username = $_POST['username']; $password = $_POST['password']; // if the condition is posted if ($_POST['username'] && $_POST['password']) { // swap varables $pass = md5($password); $pass=$_POST['pass']; $query="select * from colum where password='$pass'"; if (mysql_num_rows($result) == 0) { // echo message or redirect user. }else{ while ($row = mysql_fetch_assoc($result)) { $_SESSION['name']=$row['user_name']; $_SESSION['password']=$row['password']; // send message or redirect user. } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/55025-solved-session-side-error-message/#findComment-272037 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.