hello - PHP Online
Form of PHP Sandbox
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
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.
Result of php executing
Full code of hello.php
- <?php
- $autoidcreate = $_REQUEST["autoidcreate"];
- $submit = $_REQUEST["submit"];
- $name = $_REQUEST["name"];
- $org = $_REQUEST["org"];
- $orgno = $_REQUEST["orgno"];
- $street1 = $_REQUEST["street1"];
- $street2 = $_REQUEST["street2"];
- $street3 = $_REQUEST["street3"];
- $city = $_REQUEST["city"];
- $postalcode = $_REQUEST["postalcode"];
- $countrycode = $_REQUEST["countrycode"];
- $phone = $_REQUEST["phone"];
- $fax = $_REQUEST["fax"];
- $emailaddress = $_REQUEST["emailaddress"];
- if($autoidcreate){
- $rest=strtolower($name);
- $rest = str_replace(" ","",$rest);
- $rest = str_replace("å","",$rest);
- $rest = str_replace("ä","",$rest);
- $rest = str_replace("ö","",$rest);
- $rest = str_replace("Å","",$rest);
- $rest = str_replace("Ä","",$rest);
- $rest = str_replace("Ö","",$rest);
- $rest = substr($rest,0,6);
- $datumid=date("ym");
- $slumpid=rand(10000,99999);
- $contactid=$rest.$datumid."-".$slumpid;
- echo $contactid;
- } else {
- $contactid = $_REQUEST["contactid"];
- }
- if($submit){
- include 'loggain.php';
- $aktivTRID=Create_TRID();
- $skickaframe='<?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <epp xmlns="urn:ietf:params:xml:ns:epp-1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd">
- <command>
- <create>
- <contact:create
- xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"
- xsi:schemaLocation="urn:ietf:params:xml:ns:contact-1.0
- contact-1.0.xsd">
- <contact:id>'.$contactid.'</contact:id>
- <contact:postalInfo type="loc">
- <contact:name>'.$name.'</contact:name>
- <contact:org>'.$org.'</contact:org>
- <contact:addr>
- <contact:street>'.$street1.'</contact:street>
- <contact:street>'.$street2.'</contact:street>
- <contact:street>'.$street3.'</contact:street>
- <contact:city>'.$city.'</contact:city>
- <contact:pc>'.$postalcode.'</contact:pc>
- <contact:cc>'.$countrycode.'</contact:cc>
- </contact:addr>
- </contact:postalInfo>
- <contact:voice x="">'.$phone.'</contact:voice>
- <contact:fax>'.$fax.'</contact:fax>
- <contact:email>'.$emailaddress.'</contact:email>
- <contact:disclose flag="0">
- <contact:voice/>
- <contact:email/>
- </contact:disclose>
- </contact:create>
- </create>
- <extension>
- <iis:create xmlns:iis="urn:se:iis:xml:epp:iis-1.2"
- xsi:schemaLocation="urn:se:iis:xml:epp:iis-1.2 iis-1.2.xsd">
- <iis:orgno>['.$countrycode.']'.$orgno.'</iis:orgno>
- <iis:vatno></iis:vatno>
- </iis:create>
- </extension>
- <clTRID>'.$aktivTRID.'</clTRID>
- </command>
- </epp>';
- echo $skickaframe;
- $epp->sendFrame($skickaframe);
- $answer = $epp->getFrame();
- echo $answer;
- $epp->disconnect();
- //echo stristr($answer,"Command completed successfully");
- if(stristr($answer,"Command completed successfully")==true) {
- echo "<font color=\"#006600\" size=\"2\"><center>$contactid has been created successfully</center></font>";
- $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')";
- $result = mysql_query($sql);
- echo mysql_error();
- } else {
- if(stristr($answer,"Object exists")==true) {
- echo "<font color=\"#FF0000\" size=\"2\"><center>This contactID is already in use</center></font>";
- } else {
- echo "<font color=\"#FF0000\" size=\"2\"><center>A error occurred!</center></font>";
- }
- }
- }
- ?>