I wrote a script to allow people to log in to an admin side of the site to update events. It worked for about 2 months no problems. I got a call about two days ago that users are getting error when trying to log in. The error they are getting is "Fatal error: Call to undefined function session_register() in /home/smslive/public_html/app/themes/church2/church2/admin/checklogin.php on line 29". If anyone has any ideas on how to fix it I would greatly appreciate it.
Here is the code for "checklogin.php":
<?php
ob_start();
$host="localhost";
$username="username";
$password="password";
$db_name="database";
$tbl_name="table";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$myusername=$_POST['email'];
$mypassword=$_POST['password'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE email='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("email");
session_register("password");
header("location:/admin/edit.php");
}
else {
echo header("location:/admin/fail.php");
}
ob_end_flush();
?>
Here here is the session for the edit.php
session_start();
if(!session_is_registered("email")){
header("location:/admin/index.php");
}
?>