Jump to content

login trouble


dnbhead22

Recommended Posts

errors:

 

Deprecated: Function session_register() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/login.php on line 18

 

Warning: session_register() [function.session-register]: Cannot send session cookie - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/login.php:18) in /Applications/XAMPP/xamppfiles/htdocs/login.php on line 18

 

Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at /Applications/XAMPP/xamppfiles/htdocs/login.php:18) in /Applications/XAMPP/xamppfiles/htdocs/login.php on line 18

 

Deprecated: Function session_register() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/login.php on line 22

 

Code:

<?php

if ($_POST['email']) {

include_once "connect_to_mysql.php";
$email = stripslashes($_POST['email']);
$email = strip_tags($email);
$email = mysql_real_escape_string($email);
$password = preg_replace("[^A-Za-z0-9]", "", $_POST['password']); 
$password = md5($password);

$sql = mysql_query("SELECT * FROM members WHERE email='$email' AND password='$password' AND emailactivated='1'"); 
$login_check = mysql_num_rows($sql);
if($login_check > 0){ 
    while($row = mysql_fetch_array($sql)){ 
        
        $id = $row["id"];   
        session_register('id'); 
        $_SESSION['id'] = $id;
  
    $username = $row["username"];   
        session_register('username'); 
        $_SESSION['username'] = $username;

        mysql_query("UPDATE members SET lastlogin=now() WHERE id='$id'"); 
        
	header("location: member_profile.php?id=$id"); 
	exit();
    } 
} else {

  print '<br /><br /><font color="#FF0000">No match in our records, try again </font><br />
<br /><a href="login.php">Click here</a> to go back to the login page.';
  exit();
}
}
?>

 

any help really appreciated...thanks!!

 

Link to comment
https://forums.phpfreaks.com/topic/260194-login-trouble/
Share on other sites

comment out the two lines that have "session_register(xxx)" on them, and add "session_start()" to the page directly under the opeing php tags.  the problem with the header is that it can't perform the action because the warnings are being thrown by the depreciated function and as such there is information being passed to the screen before the header call - which just doesn't work.

Link to comment
https://forums.phpfreaks.com/topic/260194-login-trouble/#findComment-1333580
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.