ich habe mir aus den released homepages die DamnedRev3_Shadow HP runtergeladen. Dort ist ein fertiges Paypal-Script bereits integriert.
Das Paypal-Button-Script (Buy-Now-Button) habe ich natürlich angepasst.
Es funktioniert insofern, dass ich die Zahlung auf meinem Paypal-Konto erhalte. Aber es wird kein Datenbankeintrag erstellt.
Nach der Zahlung soll ja eine IPN an meine homepage geschickt werden (an die payed.php). Diese php datei soll dann die daten von paypal überprüfen und in die mssql datenbank die donatepoints eintragen.
Also entweder ist mein paypalbutton falsch konfiguriert, oder das script ist falsch, oder das was paypal als bestätigung des kaufs schickt wird blockiert (ports..).
Habe die ports 80, 443 tcp freigegeben auf meinem Root.
payed.php:
Code:
<?php
include('inc/config.inc.php');
// 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";
//If testing on Sandbox use:
$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
//$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
while (!feof($fp)) {
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0) {
// check the payment_status is Completed DONE
// check that txn_id has not been previously processed DONE
// check that receiver_email is your Primary PayPal email DONE
// check that payment_amount/payment_currency are correct DONE
// process payment DONE
//$checktxn = mysql_query('SELECT COUNT(*) as count FROM `'.TABLE_PREFIX.'donationlogs` WHERE `txn_id`=\''.mysql_real_escape_string($_POST['txn_id']).'\'');
odbc_exec($mssql, 'USE [WEBSITE_REV3]');
$result = odbc_exec($mssql, 'SELECT * FROM [rev3_pplogs] WHERE txn_id=\''.mysql_real_escape_string($_POST['txn_id']).'\'');
$total_rows = odbc_num_rows($result);
if($_POST['payment_status'] == 'Completed') {
$status = true;
} else {
$status = false;
}
if($total_rows == 0) {
$txn = true;
} else {
$txn = false;
}
if($_POST['receiver_email'] == $_CONFIG['ppemail']) {
$receiver = true;
} else {
$receiver = false;
}
if($_POST['mc_currency'] == 'EUR') {
$eur = true;
} else {
$eur = false;
}
$dp = $_POST['option_selection1'];
switch($dp) {
case '1200': if($_POST['mc_gross'] == '10.00') { $amount = true; }; break;
case '2500': if($_POST['mc_gross'] == '20.00') { $amount = true; }; break;
case '6500': if($_POST['mc_gross'] == '50.00') { $amount = true; }; break;
case '13000': if($_POST['mc_gross'] == '100.00') { $amount = true; }; break;
/* NORMAL
case '1000': if($_POST['mc_gross'] == '10.00') { $amount = true; }; break;
case '2000': if($_POST['mc_gross'] == '20.00') { $amount = true; }; break;
case '5250': if($_POST['mc_gross'] == '50.00') { $amount = true; }; break;
case '11000': if($_POST['mc_gross'] == '100.00') { $amount = true; }; break;
*/
default: $amount = false; break;
}
if(($status == true) && ($txn == true) && ($receiver == true) && ($eur == true) && ($amount == true)) {
$worth = $_POST['mc_gross'];
$worth = str_replace('.', ',', $_POST['mc_gross']);
odbc_exec($mssql, 'USE [WEBSITE_REV3]');
odbc_exec($mssql, 'INSERT INTO [rev3_pplogs] (txn_id, account, worth, email, datetime) VALUES(\''.mssql_escape_string($_POST['txn_id']).'\', \''.mssql_escape_string($_POST['option_selection2']).'\', \''.mssql_escape_string($worth).'\', \''.mssql_escape_string($_POST['payer_email']).'\', \''.date('d.m.Y H:i:s').'\')');
odbc_exec($mssql, 'USE [ACCOUNT_DBF]');
odbc_exec($mssql, 'UPDATE [ACCOUNT_TBL] SET cash=cash+\''.mssql_escape_string($dp).'\' WHERE account=\''.mssql_escape_string($_POST['option_selection2']).'\'');
}
// echo the response
echo "The response from IPN was: <b>" .$res ."</b><br><br>";
//loop through the $_POST array and print all vars to the screen.
foreach($_POST as $key => $value){
echo $key." = ". $value."<br>";
}
} else if (strcmp ($res, "INVALID") == 0) {
// log for manual investigationk
// echo the response
echo "The response from IPN was: <b>" .$res ."</b>";
}
}
fclose ($fp);
}
?>
Hier ist noch ein anderes Paypal Script, welches einfach nur die Daten, die paypal sendet, ausgeben soll. Dies hat auch nicht ganz funktioniert.
Code:
<?php
$pp_hostname = "www.paypal.com"; // Change to [url]www.sandbox.paypal.com[/url] to test against sandbox
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-synch';
$tx_token = $_GET['tx'];
$auth_token = "uz14k8H0gpDXY_Xhjc2j_b_c8pwNajYmbWc4pcRDrBrb31kezIz-YpNUdi";
$req .= "&tx=$tx_token&at=$auth_token";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://$pp_hostname/cgi-bin/webscr");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
//set cacert.pem verisign certificate path in curl using 'CURLOPT_CAINFO' field here,
//if your server does not bundled with default verisign certificates.
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Host: $pp_hostname"));
$res = curl_exec($ch);
curl_close($ch);
if(!$res){
//HTTP ERROR
}else{
// parse the data
$lines = explode("\n", $res);
$keyarray = array();
if (strcmp ($lines[0], "SUCCESS") == 0) {
for ($i=1; $i<count($lines);$i++){
list($key,$val) = explode("=", $lines[$i]);
$keyarray[urldecode($key)] = urldecode($val);
}
// check the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your Primary PayPal email
// check that payment_amount/payment_currency are correct
// process payment
$firstname = $keyarray['first_name'];
$lastname = $keyarray['last_name'];
$itemname = $keyarray['item_name'];
$amount = $keyarray['payment_gross'];
echo ("<p><h3>Thank you for your purchase!</h3></p>");
echo ("<b>Payment Details</b><br>\n");
echo ("<li>Name: $firstname $lastname</li>\n");
echo ("<li>Item: $itemname</li>\n");
echo ("<li>Amount: $amount</li>\n");
echo ("");
}
else if (strcmp ($lines[0], "FAIL") == 0) {
// log for manual investigation
}
}
?>
Your transaction has been completed, and a receipt for your purchase has been emailed to you.<br> You may log into your account at <a href='https://www.paypal.com'>www.paypal.com</a> to view details of this transaction.<br>
hat echt keiner ne ahnung davon? ich mein das script wurd ja released. sollte ja richtig sein. frage is nur was muss man sonst noch alles einstellen bei seinem paypal konto, damit das läuft?
ja das ist richtig, hatte es mal mit sandbox versucht. jez stehts wieder auf normal. sandbox suckt, krieg keinen account mit bankverbindung eingerichtet. deswegen muss ich warten bis jemand donated.
ok, ich schreib dir meinen skype-namen. danke
[Hilfe]Donate Script 01/21/2013 - Web Development - 6 Replies Hallo Community,
ich habe noch nicht so viel erfahrung was php angeht und brauche da mal etwas hilfe.
Es sind viele funkten und sachen doppelt oder unnütz das weis ich auch :)
Wo ich hilfe bei brauch einen dump schutz dort einzufügen damit man die DB nicht voll spammt so einfach.
Und vielleicht eine eine vereinfachte version währe auch hilfreich.
Funktionen:
<?php
[S]Psc Donate Script [B]85 E*Gold 10/16/2012 - Coders Trading - 3 Replies Heyho Leute :D ,
Ich komme mal auf den Punkt und suche ein PSC Donate Script für meinen Server :)
Ich würde euch mit 85 E*Gold bezahlen :)
Mfg , Weekend.
Paypal Donate Script? 03/12/2012 - Flyff Private Server - 22 Replies Guten Tag e*Pvper's
Ich wollte mal Fragen ob es ein Donation Script über Paypal gibt.
Wo man aber auch natürlich auswählen muss wieviele Points und dann Spenden muss in Logs gespeichert wird und dann bekommt man die Coins.
Habe bei Google nichts gefunden.
Danke aber schonmal im Vorraus!
Mit freundlichen Grüßen
RyukTheShinigami
[Release] Donate Script 10/20/2011 - Flyff PServer Guides & Releases - 29 Replies Hi,
da mir aufgefallen ist das es noch garnicht so ein donate script gibt. Dachte ich mir ich release mal meins.
PHP Code :
<?php
$server = "DEINSERVER\SQLEXPRESS";
$user = "";
$pass= "";
$username = $_POST;
$password = $_POST;