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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.