PHP Session register error -
i hope ill witht his. when im trying log in system im getting errors session register: *fatal error: call undefined function session_register() in c:\xampp\htdocs\check.php on line 18* btw i'm started learn php i'm newbie in there :)
there code register.php:
<?php include('mysql.php'); include('password.php'); $username = $_post['user']; $password = $_post['password']; $re_password = $_post['password2']; if($username == "") { die("you don't enter username!"); } if($password == "" || $re_password == "") { die("you didn't enter 1 of passwords!"); } if($password != $re_password) { die("your passwords don't match! try again."); } $query = mysql_query("select * users username='$username'"); if(mysql_num_rows($query) != 0) { echo "username exists"; } else { $hash = password_hash($password, password_bcrypt); if (password_verify($password, $hash)) { if(!mysql_query("insert users (username, password) values ('$username', '$hash')")) { die("connection problems!"); } echo "<center>"; echo "registration successfull!<br>"; echo "your user name: $username<br>"; echo "<a href='login.php'>login system</a>"; echo "</center>"; } } ?>
check.php:
<?php ob_start(); include('mysql.php'); $username=$_post['user']; $password=$_post['password']; $query = mysql_query ("select * users username='$username' , password='$password'"); if(mysql_num_rows($query) == 1) { // register $myusername, $mypassword , redirect file "login_success.php" session_register("username"); session_register("password"); header("location:success.php"); } else { echo "wrong username or password"; } ob_end_flush(); ?>
before include('mysql.php');
put session_start()
.
next, instead of session_register("username");
put $_session['username'] = $username;
, read like: echo $_session['username']
.
session_register
deprecated, , removed of 5.4.0.