my problem is dat im getting when trying to register a session the error im getting is u have been logged in successfully Deprecated: Function session_register() is deprecated in C:\wamp\www\music website\login.php on line 25 Deprecated: Function session_register() is deprecated in C:\wamp\www\music website\login.php on line 26 include ('connect.php'); $user = $_POST['u_name']; $pass = $_POST['pwd']; if(!$user){ echo "please enter your username. <br>"; } if(!$pass){ echo "please enter your password"; } if ($user && $pass){ $sql= ("SELECT * FROM user_accounts WHERE username = '$user' AND password = '$pass'"); $res = mysql_query($sql); $count = mysql_num_rows($res); if ($count ==0){ echo "ur user name or password may be incorrect! try again"; } ELSE { if ($count ==1){ $row = mysql_fetch_array($res); echo "u have been logged in successfully"; session_register('user'); session_register('pass'); } } } PHP:
Its a warning not an error, 2 different things.... however, its saying that session_register is deprecated... if you look at the documentation, you will see why; http://php.net/manual/en/function.session-register.php
Dont forget that it is a good idea to turn error messages of after you are done fixing the problems. Nobody want to see errormsgs unless it is while debugging. Good luck!
Whilst debugging/maintenance mode enable all error_reporting/handlers to help debug, but on an active/live site it can be disabled (as it can seem a distraction to visitors) - which means you can log them - that way they don't appear but you get a record of the errors (only viewable by you). Alternatively you can still display errors, but customize them to display something prettier than the default, by using the set_error_handler() function.
session_register(), session_is_registered() and session_unregister() are dependent on register_globals. Register_globals were turned off starting in php4.2 in the year 2002. No new code should have been written after that point in time that used these functions. These functions have been removed in php6. Any code using them will stop working under php6 and must be changed to use the $_SESSION array variables.