Hey novastar
How do you pass varibles from another DB?
we tryed:
PHP Code:
session_start();
//connections whith DataBase
$str=file("config.php");
$k = str_replace("hostName=", "", $str[0]); $k = rtrim($k);
$o = str_replace("userName=", "", $str[1]); $o = rtrim($o);
$d = str_replace("password=", "", $str[2]); $d = rtrim($d);
$db = str_replace("datebase=", "", $str[3]); $db = rtrim($db);
$DB = mysql_connect($k,$o,$d);
mysql_select_db($db,$DB);
$id =$_GET['id'];
$active =$_GET['active'];
$checkA = mysql_query("select active,userName,email,userPass from tusers where userID = ".$id, $DB);
$checkA = mysql_result($checkA,0,'active');
if($checkA == $active)
{
$checkA = mysql_query("UPDATE tusers SET active = '' where userID = ".$id, $DB);
session_register('userIDD');
$_SESSION['userIDD'] = $id;
setcookie("userIDD", $id);
$username=mysql_result($checkA,0,'userName');
$email=mysql_result($checkA,0,'email');
$password=mysql_result($checkA,0,'userPass');
virtual("file_with_your_code.php");
$redirect = "<META HTTP-EQUIV='Refresh' CONTENT='0; URL=somefile.php'>\n";
}
else
{$redirect = "";}
But it's not working...
Quote:
Originally Posted by novastar
i use a modified version of the code they gave a couple posts back which works great for me.
Code:
<?php
$username="username";
$email="email@address.com";
$password="password";
$usergroupid="2";
$timezoneoffset="-6";
define('THIS_SCRIPT', 'remote_register.php');
chdir('/home/site/public_html/forum');
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_user.php');
$userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);
$userdm->set('username', $username);
$userdm->set('email', $email);
$userdm->set('password', $password);
$userdm->set('usergroupid',$usergroupid);
$userdm->set('ipaddress', $ipaddress);
$userdm->set('timezoneoffset', $timezoneoffset);
$userdm->set_bitfield('options', 'adminemail', '1');
$userdm->set_bitfield('options', 'showemail', '1');
#If there are errors (eMail not set, eMail banned, Username taken, etc.) you can check for errors using
if (count($userdm->errors)) {
for($i=0; $i<count($userdm->errors); $i++) {
print "ERROR{$i}:{$userdm->errors[$i]}\n";
}
} else {
# If everything is OK
$newuserid = $userdm->save();
print "vbuserid:$newuserid\n";
}
chdir('/home/site/public_html/');
?>
I would have taken more time to tinker with it, and possibilly put it in a function, but as there is only 1 place in my scripting but that works fine for me.
Im running it on vBulletin 3.6.2
|