okay, this is a little complex, so bare with me (also, can reward people with webspace/shell for any really generous responces 🙂). first, here is the existing code...
function loginaction($username, $password) {
global $uid;
dbconnect();
$query = "SELECT * FROM IPM_users WHERE username='$username'";
if (!($result = mysql_query($query))) {
die("Couldn't retrieve authorization data, please try again later");
}
if (mysql_num_rows($result) > 0) {
if ($user=mysql_fetch_array($result)) {
if (md5($password) == $user[password]) {
($SECURE_COOKIES == "true")? $SSL=1: $SSL=0;
setcookie("uid", $user[id], "0", "", "", $SSL);
$uid = $user[id];
mytasks();
} else {
login();
}
}
} else {
login();
}
}
what i want to do is use username/password from another database (seen below)
dbconnect2();
$query = "select username, password, password('$pass') from $table where username = '$user'";
$result = mysql_db_query($db, $query, $connection) or die ("error in query: $query");
$dbrow = mysql_fetch_array($result, MYSQL_NUM);
$pass = $dbrow[1];
$pass2 = $dbrow[2];
if ($pass == $pass2)
if that user/password check out, i want to check and see if user exist in the project database (dbconnect), if so, log the person is. if not create the user (note i do NOT want to dump the password. for safety reasons that should stay in dbconnect2, so i used NULL to fill in the password space), then login. the code i came up with this is below.
(mysql_num_rows($result) < 0) {
$query="INSERT INTO IPM_users VALUES (NULL,'$username','NULL','$username','$domain','$username@$domain','1')";
mysql_query($query);
if (md5($password) == $user[password]) {
($SECURE_COOKIES == "true")? $SSL=1: $SSL=0;
setcookie("uid", $user[id], "0", "", "", $SSL);
$uid = $user[id];
mytask();
}
i am not sure if this code is correct, but i'm giving it as a reference. thank you for reading, php for life! also, i blame my cold in the reason i can't figure this out, although the real reason is i probably left out a few } 🙂