Click to See Complete Forum and Search --> : Individual login from one database
hubiejr
03-19-2006, 11:47 PM
I may not be asking this in the right fourm section, but here it goes.
I have used the tutorial (http://www.tutorialized.com/tutorial/Create-Login-Page/4206) to create a login page in dreamweaver, and it works great.
The question is how do I alter my database so that each username when submitted will go to their own page.
ie. if someone types in login:fire password:fox it will go to www.firefox.com
and if someone types in login:internet password:explorer it will go to www.yousuck.com
I am assuming in need to make another column in the table, but what do I do with it?
TiGGi
03-20-2006, 11:17 AM
You'll have to do some custom programming. First add another field to your database and call it userURL.
On your login page where you redirect user after succesfull login just plugin that field!
hubiejr
03-20-2006, 04:39 PM
I created a new column in my database which contains specific URLs. And then in dreamweaver, where I'm asked to put in my redirectLoginSuccess I put in my column title. But then when I login, the brower tries to find that title, not the entry within the column.
I tried creating a recordset (no idea what that is), but it did'nt work properly, and just gave me an error when trying to open up the apge.
Any help?
TiGGi
03-20-2006, 04:54 PM
what server side are you using?
When your form checks the login credentials it queries the db and returns user info, just include that new field into the query and then you can pass it along. Send you form source code!
hubiejr
03-20-2006, 05:04 PM
Here is the code I'm using...I realize now that I have to "define" $url. I'm just not to sure how to do that. (I have attempted to, as can be seen below) Thanks for your help!
<?php require_once('Connections/Login.php'); ?><?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$url=$_POST['url'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "$url";
$MM_redirectLoginFailed = "http://www.nhl.com";
$MM_redirecttoReferrer = false;
mysql_select_db($database_Login, $Login);
$LoginRS__query=sprintf("SELECT username, password FROM users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $Login) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
TiGGi
03-21-2006, 09:00 AM
I am not that good with php but try this;
add your url field into the query
$LoginRS__query=sprintf("SELECT username, password, URLFIELD FROM users WHERE username='%s' AND password='%s'",
and plug it into this
$MM_redirectLoginSuccess = "$url";
hubiejr
03-21-2006, 09:08 AM
Hey,
Thanks for you help, but still nothing is happening. I'm going to post this in the php section of the fourm and see if i can get more anwsers.