grant Posted March 31, 2011 Share Posted March 31, 2011 only thing i cant get is the user id not posting to data base to give the user the points there bought paypal button that users are buying the points from the idea is that when users buy points the users get the points with me going to give them to the users but cant seem to get the user id to go in database just blank any help wold be great Sql CREATE TABLE IF NOT EXISTS `ipn` ( `itemname` text collate latin1_general_ci NOT NULL, `date` text collate latin1_general_ci NOT NULL, `itemnumber` text collate latin1_general_ci NOT NULL, `paymentstatus` text collate latin1_general_ci NOT NULL, `paymentamount` text collate latin1_general_ci NOT NULL, `currency` text collate latin1_general_ci NOT NULL, `txnid` text collate latin1_general_ci NOT NULL, `receiveremail` text collate latin1_general_ci NOT NULL, `payeremail` text collate latin1_general_ci NOT NULL, `first` text collate latin1_general_ci NOT NULL, `last` text collate latin1_general_ci NOT NULL, `quantity` text collate latin1_general_ci NOT NULL, `user_id` text collate latin1_general_ci NOT NULL <<<<< -Not posting to data base ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; paypal button <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> <td align="center"> <input type=hidden name=cmd value=_xclick> <input type="hidden" name="business" value="******************"> <input type="hidden" name="item_name" value="1"> <input type="hidden" name="payer_id" value="<? echo $user_class->id ?>"> <<<< Dont think the id is posting <input type="hidden" name="amount" value="100"> <input type="hidden" name="no_shipping" value="0"> <input type="hidden" name="return" value="http://www.**********/donatordone.php?payment=done"> <input type="hidden" name="cancel_return" value="http://www.***********.net/donatordone.php"> <input type="hidden" name="notify_url" value="http://www.***************/*****.php"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="tax" value="0"> <input type="hidden" name="on0" value="username"> <input type="hidden" name="os0" value="<? echo $user_class->username ?>" maxlength="60" > <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" width="68" height="23" border="0" name="submit" alt=""> </td> </form> Quote Link to comment Share on other sites More sharing options...
Kieran-R Posted March 31, 2011 Share Posted March 31, 2011 How does HTML result in something being posted in the database? Never heard of that before. Quote Link to comment Share on other sites More sharing options...
grant Posted March 31, 2011 Author Share Posted March 31, 2011 its not html its php Quote Link to comment Share on other sites More sharing options...
Kieran-R Posted March 31, 2011 Share Posted March 31, 2011 Well From what you have posted, there is no full PHP. Quote Link to comment Share on other sites More sharing options...
grant Posted March 31, 2011 Author Share Posted March 31, 2011 i only posted the button not my full php page wot am trying to use Quote Link to comment Share on other sites More sharing options...
Kieran-R Posted March 31, 2011 Share Posted March 31, 2011 Then how are we meant to fix your code? Post the PHP Quote Link to comment Share on other sites More sharing options...
grant Posted March 31, 2011 Author Share Posted March 31, 2011 <?php include "dbcon.php"; function Send_Event ($id, $text){ $timesent = time(); $text = mysql_real_escape_string($text); $result= mysql_query("INSERT INTO `events` (`to`, `timesent`, `text`)". "VALUES ('$id', '$timesent', '$text')"); } function microtime_float() { $time = microtime(); return (double)substr( $time, 11 ) + (double)substr( $time, 0, 8 ); } $time = microtime_float(); // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); // assign posted variables to local variables $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; $first = $_POST['first_name']; $last = $_POST['last_name']; $quantity = $_POST['quantity']; $user_id = $_POST['custom']; $result1000 = mysql_query("INSERT INTO `ipn` (`itemname`, `date`, `itemnumber`, `paymentstatus`, `paymentamount`, `currency`, `txnid`, `receiveremail`, `payeremail`, `first`, `last`, `quantity`, `user_id`)"."VALUES ('".$item_name."', '$time', '".$item_number."', '".$payment_status."', '".$payment_amount."', '".$payment_currency."', '".$txn_id."', '".$receiver_email."', '".$payer_email."', '".$first."', '".$last."', '".$quantity."', '".$user_id."')"); $result2 = mysql_query("SELECT*FROM `grpgusers` WHERE `id`='".$user_id."'"); $worked = mysql_fetch_array($result2); if($item_number == 1 && $payment_status == "Completed"){ $userpoints = $worked['points'] + 25000; $result = mysql_query("UPDATE `grpgusers` SET `rmdays`='".$userrmdays."', `points`='".$userpoints."', `bank`='".$usermoney."' WHERE `id`='".$user_id."'"); Send_Event($user_id, "Your ".$item_name." points has just been credited. "); } if ($item_number == 2 ){ $userpoints = $worked['points'] + 1000; $result = mysql_query("UPDATE `grpgusers` SET `points`='".$userpoints."' WHERE `id`='".$user_id."'"); Send_Event($user_id, "Your ".$item_name." has just been credited. "); } if ($item_number == 3 ){ $userpoints = $worked['points'] + 2500; $result = mysql_query("UPDATE `grpgusers` SET `rmdays`='".$userrmdays."', `points`='".$userpoints."', `bank`='".$usermoney."' WHERE `id`='".$user_id."'"); Send_Event($user_id, "Your ".$item_name." has just been credited. "); } if ($item_number == 4 ){ $userpoints = $worked['points'] + 50000; $result = mysql_query("UPDATE `grpgusers` SET `rmdays`='".$userrmdays."', `points`='".$userpoints."', `bank`='".$usermoney."' WHERE `id`='".$user_id."'"); Send_Event($user_id, "Your ".$item_name." has just been credited. "); } ?> Quote Link to comment Share on other sites More sharing options...
grant Posted March 31, 2011 Author Share Posted March 31, 2011 dont matter now got it 8) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.