3v4l.org

run code in 300+ PHP versions simultaneously
<?php class mbe4 { // var $mbe4_username; // var $mbe4_password; // var $mbe4_clientid; // var $mbe4_serviceid; // var $mbe4_contentclass; // var $mbe4_url; function __construct($username, $password, $clientid, $serviceid, $url="https://billing.mbe4.de/widget/singlepayment") { $this->username = $username; $this->password = $password; $this->clientid = $clientid; $this->serviceid = $serviceid; $this->url = $url; } /* * Senden der Daten an mbe4. * params: * $amount: Die Transaktionssumme in EUR * $contentid: Die Art des zu Buchenden Contents. * 1: News/Info * 2. Chat/Flirt * 3. Game * 4. Klingelton * 5. Bild/Logo * 6. Videoclip * 7. Musikdatei * 8. Lokalisierung * 9. Voting * 10. Gewinnspiel * 11. Portal Zugang * 12. Software * 13. Dokument * 14. Ticket * 15. Horoskop * 16. Freizeit * 17. Unterwegs * 18. Finanzen * 19. Shopping * 20. E-Mail * 21. Spende * return: * Liefert ein Key/Value-Array zurück, welches per GET an mbe4 übertragen werden muss. * */ function create_transaction($id,$description="mbe4 payment", $amount, $contentclass=1, $returnurl,$urlencode=TRUE){ // Timestamp generieren $timestamp=date("Y-m-d")."T".date("H:i:s.000")."Z"; // Hashbase definieren $hashbase= $this->password . $this->username . $this->clientid . $this->serviceid . $contentclass . $description . $id . $amount . $returnurl . $timestamp; // hash erzeugen $hashparam=md5($hashbase); // Build the data array that will be translated into hidden form values. $data = array( // General parameters 'username' =>$this->username, 'clientid' => $this->clientid, 'serviceid' => $this->serviceid, 'contentclass' => $contentclass, 'description' => $description, 'clienttransactionid' => $id, 'amount' => $amount, // mbe4 wants ct, no eur 'callbackurl' => $returnurl, 'timestamp' => $timestamp, 'hash' => $hashparam, ); // Sollen die Werte mit urlencode() codiert werden? if($urlencode==TRUE){ foreach($data as $element){ $element= urlencode($element); } } return $data; } /* validate_transaction($mbe4_params) * Validierung der Zahlung. Dafür werden die von mbe4 übergebenen Parameter * plus das mbe4-Password hintereinander gehängt und eine MD5-Summe aus dem String erstellt. * params: * $mbe4_params: Key-Value-Array aus dem per GET übergebenen Parametern * return: * Response-Code, 0 bedeutet erfolgreiche Zahlung * */ function validate_transaction($mbe4_params, $mbe4_password) { // check hash Signierung $hashbase= $mbe4_password . $mbe4_params["transactionid"] . $mbe4_params["clienttransactionid"] . $mbe4_params["responsecode"] . $mbe4_params["description"] . $mbe4_params["subscriberid"] . $mbe4_params["operatorid"] . $mbe4_params["timestamp"]; if(md5($hashbase)!=$mbe4_params["hash"]){ return 999; // Parameter nicht korrekt oder manipuliert! } return $mbe4_params["responsecode"]; // Transaktionscode zurückgeben } function is_valid_responsecode($responsecode) { if($responsecode==0) return TRUE; else return FALSE; } function get_responsemsg_by_responsecode($responsecode){ switch($responsecode){ case 0: return('OK'); case 1: return('NOT FINAL – request was processed successfully but the answer is not final. (e.g. a TAN was sent to the subscriber and tan received must be called)'); case 2: return('authorization failed'); case 3: return('capture failed'); case 4: return('terminate failed'); case 5: return('refund failed'); case 6: return('prepair failed'); case 7: return('transaction failed'); case 8: return('subscription terminate failed'); case 101: return('invalid parameter'); case 109: return('transaction in wrong status'); case 110: return('wrong PIN'); case 111: return('too many PIN attempts - transaction closed'); case 112: return('subscriber aborted transaction'); case 113: return('no route to operator'); case 121: return('subscriberid unascertainable'); case 126: return('sending TAN SMS failed'); case 150: return('subscriptionid unknown'); case 151: return('subscriptionid not unique'); case 152: return('subscription terminated'); case 200: return('internal server error'); case 999: return('hash cant be verified'); case 201: return('system currently unavailable'); default: return(900); } } } $bar = new mbe4('cms.testing', 'cmsTesting', '1002', '3002', 'https://cms.testing/api/payment/start');
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Deprecated: Optional parameter $description declared before required parameter $returnurl is implicitly treated as a required parameter in /in/vi1IK on line 50 Deprecated: Optional parameter $contentclass declared before required parameter $returnurl is implicitly treated as a required parameter in /in/vi1IK on line 50 Deprecated: Creation of dynamic property mbe4::$username is deprecated in /in/vi1IK on line 13 Deprecated: Creation of dynamic property mbe4::$password is deprecated in /in/vi1IK on line 14 Deprecated: Creation of dynamic property mbe4::$clientid is deprecated in /in/vi1IK on line 15 Deprecated: Creation of dynamic property mbe4::$serviceid is deprecated in /in/vi1IK on line 16 Deprecated: Creation of dynamic property mbe4::$url is deprecated in /in/vi1IK on line 17
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Deprecated: Optional parameter $description declared before required parameter $returnurl is implicitly treated as a required parameter in /in/vi1IK on line 50 Deprecated: Optional parameter $contentclass declared before required parameter $returnurl is implicitly treated as a required parameter in /in/vi1IK on line 50 Deprecated: Creation of dynamic property mbe4::$username is deprecated in /in/vi1IK on line 13 Deprecated: Creation of dynamic property mbe4::$password is deprecated in /in/vi1IK on line 14 Deprecated: Creation of dynamic property mbe4::$clientid is deprecated in /in/vi1IK on line 15 Deprecated: Creation of dynamic property mbe4::$serviceid is deprecated in /in/vi1IK on line 16 Deprecated: Creation of dynamic property mbe4::$url is deprecated in /in/vi1IK on line 17
Output for 8.1.0 - 8.1.27
Deprecated: Optional parameter $description declared before required parameter $returnurl is implicitly treated as a required parameter in /in/vi1IK on line 50 Deprecated: Optional parameter $contentclass declared before required parameter $returnurl is implicitly treated as a required parameter in /in/vi1IK on line 50
Output for 8.0.0 - 8.0.30
Deprecated: Required parameter $amount follows optional parameter $description in /in/vi1IK on line 50 Deprecated: Required parameter $returnurl follows optional parameter $description in /in/vi1IK on line 50
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33

preferences:
239.62 ms | 404 KiB | 382 Q