Jump to content

Session Register Issue


princeofpersia

Recommended Posts

Hi guys, I have a page where users can login, code below doesnt register sessions for my page I have session_start and ob_start on my db.php page and also added to this page but still can not get the session, I dont get any sytanx or include errors and everything is fine with database in terms of my registered email and password

 

I would appreciate if you can see where I have made mistake, Thanks in advance :)

 


<?php

//ob
ob_start();
//session
session_start();
include ('../../include/db/connecttodb.php');
$session_email = $_SESSION['email'];
?>
<!--Header starts here-->
<?php

include ('../../include/content/header.php');
include ('../../include/config/detect.php');

?>

<div id="breadcrumbs"><div id="text"><?php
include($_SERVER['DOCUMENT_ROOT']."/backlinks.php"); 
?></div></div><br/>
<div id="pagetitleholder"><div id="pagetitle">
  <h1>Login</h1></div></div>
<!--Main body begins here-->
<div id="maincontentbody">
<br />
<div id="logincontainer">
<div id="pagelogin">
<?php
if(isset($session_email)) { echo"<a href='' class='minibutton'><span>Visit Your Profile</span></a>"; }
else
{
if (isset($_POST['login'])) {	
$myemail=addslashes($_POST['email']);
$mypass=addslashes($_POST['password']);
if(!$myemail || !$mypass) echo"<div id='error'>Please enter both Email & Password</div><br/>";
else {
$pass=md5($mypass);


///Check if account is active


$mygets=sprintf('SELECT * FROM users WHERE myemail="%s" AND active="%s"', mysql_real_escape_string($myemail), mysql_real_escape_string($active));
$result = mysql_query($mygets);
while($check_row=mysql_fetch_array($result)){
$myactive=$check_row['active'];	
}




if ($myactive=0) echo "<div id='error'>Please activate your account before login</div><br/>"; else

{
$mylogin=sprintf('SELECT * FROM users WHERE myemail="%s" AND password="%s"', mysql_real_escape_string($myemail), mysql_real_escape_string($pass));
$resultlogin = mysql_query($mylogin);
if(mysql_num_rows($resultlogin)>=1) {

$_SESSION['email']=$email; //assign session
//header("Location: ../profile/index.php"); //refresh	
echo"$email";


}
else echo"<div id='error'>Your email is not registered with us!</div><br/>";
}

}
}

echo"<div id='#logintitle'>
<h2>Already Registered? Sign In Now</h2><br/></div>

<div id='loginformbody'>
<form name='login' action='' method='post'>
<label for='email'>Email:</label><input type='text' name='email'/><br/>
<label for='password'>Password:</label><input type='password' name='password' /><br/>

<div id='logbtncon'>
<input type='submit' name='login' class='logbtn' value='Log in'/> 
<a href='../recovery/'>Forgotton Password?</a>
</div>	
</form>	
</div>
";
};

?>
</div>
<div id="notregistered"></div>


</div>

</div>
<!--Main body ends here-->
<!--Footer starts here-->
<?php include ('../../include/content/footer.php') ?>
<?php ob_flush(); ?>






Link to comment
https://forums.phpfreaks.com/topic/245204-session-register-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.