Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

Call to undefined function session_register()

Codes here !

Moderators: macek, egami, gesf

Call to undefined function session_register()

Postby prashantminku » Mon Dec 10, 2012 12:05 am

I am getting a problem...when i post the form, i get this as fatal error...
Call to undefined function session_register()...
i changed it with $_session(),but still it is not working..

can you tell me what is the problem??





This is the index.html page.


<form class="login active" method="post" action="login.php">
<h3>Login</h3>
<div>
<label>Username:</label>
<input type="text" name="myusername"/>
<span class="error">This is an error</span>
</div>
<div>
<label>Password:</label>
<input type="password" name="mypassword" />
<span class="error">This is an error</span>
</div>
<div class="bottom">
<div class="remember"><input type="checkbox" /><span>Keep me logged in</span></div>
<input type="submit" value="Login"></input>
<div class="clear"></div>
</div>
</form>




This is the login.php page..



<?php
$host="localhost";
$username="root";
$password="";
$db_name="Example";
$tbl_name="login";

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

$count=mysql_num_rows($result);

if($count>0){

session_register("$myusername");
session_register("$mypassword");
header("location:welcome.php");
}
else {
echo "Wrong Username or Password!";
}
?>

Thi is welcome.php page..

<?php
session_start();
if(!session_is_registered(myusername)){
header("location:index.html");
}
?>

<html>
<body>
Login Successful
</body>
</html>
prashantminku
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri Dec 07, 2012 1:42 am

Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.