I do not like asking for help until I have thoroughly exhausted my options at my skill level so here it goes. Okay I am modifying a script that uses a config for the DB information. I am trying to get the final db update to update 2 other databases. I have tried different ways explained on the forum and have not come up with the following. The script will update the one DB that is configured in the config but will not connect to the other 2 dbs and update those fields. Furthermore, when I run the script I get no errors. I think my problem is that I need to take out the reference to the config and put the connection in the top of the script. Then label this connection 1 and the rest 2 , 3 ect. I tried this also and it did not work. I need help what am I doing wrong here. Below is the code I am using.
Thanks
<?
include "config.php"; // database connection
$ak=$_POST['ak'];
$userid=$_POST['userid'];
$todo=$_POST['todo'];
$password=$_POST['password'];
$password2=$_POST['password2'];
?>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
<title>thescript</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
<?
$userid=mysql_real_escape_string($userid);
$ak=mysql_real_escape_string($ak);
$tm=time()-86400;
if(!mysql_num_rows(mysql_query("SELECT userid FROM actove WHERE entry='$ak' and userid='$userid' and time > '$tm' and status='pending'"))){
echo "<center><font face='Verdana' size='2' color=red><b>Your activation code is out of date. </b></font> ";
exit;
}
//Show the change password form//
if(isset($todo) and $todo=="new-password"){
$password=mysql_real_escape_string($password);
//Setting flags for checking
$status = "GOOD";
$msg="";
if ( strlen($password) < 6 or strlen($password) > 12 ){
$msg=$msg."Password must be more than 6 char legth and maximum 12 char lenght<BR>";
$status= "FAIL";}
if ( $password <> $password2 ){
$msg=$msg."Both passwords are not matching<BR>";
$status= "FAIL";}
if($status<>"GOOD"){
echo "<font face='Verdana' size='2' color=red>$msg</font><br><center><input type='button' value='Retry' onClick='history.go(-1)'></center>";
}else{ // if all validations are passed.
$password=md5($password); // Encrypt the password before storing
if(mysql_query("update pla_user set pswd='$password' where id='$userid'")){ ////this update works in the db.
$tm=time();
$tt=mysql_query("update key_act set status='done' where pkey='$ak' and userid='$userid' and status='pending'");
echo "<font face='Verdana' size='2' ><center>Thanks <br> Your password has been changed. </font></center>";
}else{echo "<font face='Verdana' size='2' color=red><center>Sorry <br> Failed to create new password please contact the admin. </font></center>";
$userid=$_POST['userid'];
$password=$_POST['password'];
$pass=md5($password);
$conn_new_1=mysql_connect("localhost", "XXX", "XXX");
$q_1=("update pbod_users set password ='$pass' where user_id='$userid'");
echo $q_1 . '<br />'; //get rid of this when you know its working
$db_new_1=mysql_select_db("pbod_clome",$conn_new_1) or die("db cant open");
mysql_query($q_1,$conn_new_1);
mysql_close($conn_new_1);
$conn_new_2=mysql_connect("localhost", "XXX", "XXX");
$q_2=("update loke_user set password ='$pass' where user_id='$userid'");
echo $q_2 . '<br />'; //get rid of this when you know its working
$db_new_2=mysql_select_db("lopis1_killer",$conn_new_2) or die("db cant open");
mysql_query($q_2,$conn_new_2);
mysql_close($conn_new_2);
}
}
}
?>
<center><a href=index.php?page=login>Login</a>
<br><br></center>
</body>
</html>