Jump to content

Recommended Posts

hi ppl... i have created a login page .. and i need to redirect the user to his own page once it login.. in the other words.. i need to redirect the user to his own database.. but the login details is stored in another database... just like once you login into your own account and it is displaying only your details.. hmmm how can i do that with php ... what method is easier and suitable ?? if can juz kindly show me how the code look like too... thanks in advance...

hrm o.O;

 

Couldn't you have your login page, submit to a login_check page... and if login successful, then:

 

 header("Location: whateverpage.php?user=" . $username); 

 

Headers have to be set before anything is printed on screen...

 

And whatever.php page could be that person's own "page/database" whatever... you now have their username to make whatever DB queries you need to make

yea i have this code to check

 

$Username   = $_POST['username'];
$password = $_POST['password'];

// check if the user id and password combination exist in database
$sql = "SELECT username 
        FROM register
		WHERE username = '$Username' AND password = '$password'";

$result = mysql_query($sql) or die('Query failed. ' . mysql_error()); 

if (mysql_num_rows($result) == 1)
 {
	// the user id and password match, 
	$_SESSION['record'] = Username; // store username data
	// set the session
	$_SESSION['db_log_in'] = true;

	// after login we move to the main page
	header('Location: main.php');
	exit;
} else 
{
	$errorMessage = 'Sorry, wrong user id / password';
}

 

but i not very sure how to apply your method ... the header:location.php?.user $username... the user is represented as what? $username is what the user type ?? how to match the user to his corresponding database  ???

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.