Hi all, Sorry for my bad english, i'am a dutch man but i gonna try. I have a different database for making accounts than amember. I try to insert username, package id, password and a expire date. but it wont work, i realy dont know in what file the sql query have to come. i make this script and amember must do this after the payment is complete. Code: if (count($vars['product_id'])==17) do { $hostname = "ip adress"; $username = "username"; $password = "password"; $database = "database"; function showerror() { die("Error" .mysql_errno() . " : " . mysql_error()); exit; } if (!($connection= @ mysql_connect($hostname, $username, $password))) showerror(); if (!mysql_select_db($database, $connection)) showerror(); $sql = " INSERT INTO rsl_accounts ( packageid, username, password, expires ) VALUES ( 1, tiger, tiger, 99999999 ) "; if(!$res = mysql_query($sql)) { trigger_error(mysql_error().'<br />In query: '.$sql); } else { $id = mysql_insert_id(); } } while (0); can someone help me please i dont know anymore what to do, i try to insert this script in signup.php but that is not correct i think.
Have a look: http://manual.amember.com/Using_site.inc.php_and_hooks http://manual.amember.com/Using_site.inc.php_and_hooks#finish_waiting_payment.28.24payment_id.29
thanx, do you maybe know what the name of the variable is from the usernames, becouse i tryed different one, but no succes, even bij the password. it try $login $_amember_login $member $pass $password
Have a look: http://manual.amember.com/Integrating_aMember_Pro_with_website a few different ways: $_SESSION['_amember_user'] for example
tryed this whitout succes mysql_query("INSERT INTO rsl_accounts (accountid, packageid, username, password, expires) VALUES ('', '1', '".$_SESSION['_amember_user']."', '".sha1($pass)."', '$insertdag')"); i have a session at rule number 1 here my code for paypal_r.inc.php Code: <?php session_start(); $regAN = $_POST['regAN']; $link2 = mysql_connect("85.12.40.132","username","password"); mysql_select_db("rsl_dbextern",$link2); mysql_query("INSERT INTO rsl_accounts (accountid, packageid, username, password, expires) VALUES ('', '1', '".$_SESSION['_amember_user']['phone']."', '".sha1($pass)."', '$insertdag')"); ?>
Sorry, are you doing this as a plugin or as a standalone php page? If I standalone php page, I would start simple when troubleshooting it to find out if the issue is with the database query or the session variables. For example, can you echo the user variable? Code: echo $_SESSION['_amember_user']; If it is a plugin, it works very different (as Alexander suggested above) and would be something like $payment[member_id])
i did try this at a plugin but know iam doing it in thanx.php i realy far, just one more thing. I try to get the product id but doesnt work. Code: $hash = sha1($_SESSION['_amember_user']['pass']); $regAN = $_POST['regAN']; $products = & $db->get_products_list(); if ($products == 17) { $link2 = mysql_connect("85.12.40.132","rsl_dbextern","password"); mysql_select_db("rsl_dbextern",$link2); mysql_query("INSERT INTO rsl_accounts (accountid, packageid, username, password, expires) VALUES ('', '1', '". $_SESSION['_amember_user']['name_f'] ."', '$hash', '$insertdag')"); } it does work, but the if doesnt work at all, i try to let work this if the id of the product is 17, but know he dont do anything. when i take the if away it works, but i need the product id
Where you use this code exactly? Also how it should work? Should it be executed only when user purchase product 17? $products = & $db->get_products_list(); just return associative array of all products defined in amember CP -> manage products so if ($products == 17) will not work. This is not user's products.
in thanks.php works it now. PHP: $hash = sha1($_SESSION['_amember_user']['pass']);$product = $product_id;if ($product == 17) { $link2 = mysql_connect("85.12.40.132","rsl_dbexternn","password"); mysql_select_db("rsl_extern",$link2); mysql_query("INSERT INTO rsl_accounts (accountid, packageid, username, password, expires) VALUES ('', '1', '". $_SESSION['_amember_user']['login'] ."', '$hash', '$insertdag')");}if ($product == 18) { mysql_query("INSERT INTO rsl_accounts (accountid, packageid, username, password, expires) VALUES ('', '2', '". $_SESSION['_amember_user']['login'] ."', '$hash', '$insertdubbel')");} but whe i insert it into ipn.php from a payment plugin it doesn't work even in pay.php from mollie. is it different there ?