hello - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of hello.php

  1. <?php
  2. $autoidcreate = $_REQUEST["autoidcreate"];
  3. $submit = $_REQUEST["submit"];
  4. $name = $_REQUEST["name"];
  5. $org = $_REQUEST["org"];
  6. $orgno = $_REQUEST["orgno"];
  7. $street1 = $_REQUEST["street1"];
  8. $street2 = $_REQUEST["street2"];
  9. $street3 = $_REQUEST["street3"];
  10. $city = $_REQUEST["city"];
  11. $postalcode = $_REQUEST["postalcode"];
  12. $countrycode = $_REQUEST["countrycode"];
  13. $phone = $_REQUEST["phone"];
  14. $fax = $_REQUEST["fax"];
  15. $emailaddress = $_REQUEST["emailaddress"];
  16. if($autoidcreate){
  17. $rest=strtolower($name);
  18. $rest = str_replace(" ","",$rest);
  19. $rest = str_replace("å","",$rest); 
  20. $rest = str_replace("ä","",$rest); 
  21. $rest = str_replace("ö","",$rest); 
  22. $rest = str_replace("Å","",$rest); 
  23. $rest = str_replace("Ä","",$rest); 
  24. $rest = str_replace("Ö","",$rest); 
  25. $rest = substr($rest,0,6);
  26. $datumid=date("ym");
  27. $slumpid=rand(10000,99999);
  28. $contactid=$rest.$datumid."-".$slumpid;
  29. echo $contactid;
  30. } else {
  31. $contactid = $_REQUEST["contactid"];
  32. }
  33. if($submit){
  34. include 'loggain.php';
  35. $aktivTRID=Create_TRID();
  36. $skickaframe='<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  37. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
  38. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  39. xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
  40. <command>
  41. <create>
  42. <contact:create
  43. xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
  44. xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0
  45. contact-1.0.xsd">
  46. <contact:id>'.$contactid.'</contact:id>
  47. <contact:postalInfo type="loc">
  48. <contact:name>'.$name.'</contact:name>
  49. <contact:org>'.$org.'</contact:org>
  50. <contact:addr>
  51. <contact:street>'.$street1.'</contact:street>
  52. <contact:street>'.$street2.'</contact:street>
  53. <contact:street>'.$street3.'</contact:street>
  54. <contact:city>'.$city.'</contact:city>
  55. <contact:pc>'.$postalcode.'</contact:pc>
  56. <contact:cc>'.$countrycode.'</contact:cc>
  57. </contact:addr>
  58. </contact:postalInfo>
  59. <contact:voice x="">'.$phone.'</contact:voice>
  60. <contact:fax>'.$fax.'</contact:fax>
  61. <contact:email>'.$emailaddress.'</contact:email>
  62. <contact:disclose flag="0">
  63. <contact:voice/>
  64. <contact:email/>
  65. </contact:disclose>
  66. </contact:create>
  67. </create>
  68. <extension>
  69. <iis:create xmlns:iis="urn:se:iis:xml:epp:iis-1.2"
  70. xsi:schemaLocation="urn:se:iis:xml:epp:iis-1.2 iis-1.2.xsd">
  71. <iis:orgno>['.$countrycode.']'.$orgno.'</iis:orgno>
  72. <iis:vatno></iis:vatno>
  73. </iis:create>
  74. </extension>
  75. <clTRID>'.$aktivTRID.'</clTRID>
  76. </command>
  77. </epp>';
  78. echo $skickaframe;
  79. $epp->sendFrame($skickaframe);
  80. $answer = $epp->getFrame();
  81. echo $answer;
  82. $epp->disconnect();
  83. //echo stristr($answer,"Command completed successfully");
  84. if(stristr($answer,"Command completed successfully")==true) {
  85. echo "<font color=\"#006600\" size=\"2\"><center>$contactid has been created successfully</center></font>";
  86. $sql = "INSERT INTO contacts (id,name,org,street,street2,street3,city,pc,cc,voice,fax,email,orgno) VALUES ('$contactid','$name','$org','$street1','$street2','$street3','$city','$postalcode','$countrycode','$phone','$fax','$emailaddress','$orgno')";
  87. $result = mysql_query($sql);
  88. echo mysql_error();
  89. } else {
  90.         if(stristr($answer,"Object exists")==true) {
  91.         echo "<font color=\"#FF0000\" size=\"2\"><center>This contactID is already in use</center></font>";
  92.         } else {
  93.         echo "<font color=\"#FF0000\" size=\"2\"><center>A error occurred!</center></font>";
  94.         }
  95. }
  96. }
  97. ?>
File Description
  • hello
  • PHP Code
  • 22 Dec-2020
  • 3.2 Kb
You can Share it: