Advertisement
Guest User

mainScreen register

a guest
Nov 13th, 2019
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.88 KB | None | 0 0
  1. <?php
  2.     $wsdl = "http://localhost:8080/TTTWebApplication/TTTWebService?WSDL";
  3.     $trace = true;
  4.     $exceptions = true;
  5.     try {
  6.         $proxy = new SoapClient($wsdl, array('trace' => $trace, 'exceptions' => $exceptions));
  7. ?> 
  8.        
  9.         <form>
  10.             <input type="button" value="Login" onclick="" />
  11.         </form>
  12.         <form action="register.php">
  13.             <input name="register" type="submit" value="Register"/>
  14.         </form>
  15.  
  16. <?php  
  17.     } catch (Exception $e) {
  18.         echo $e->getMessage();
  19.     }
  20. ?>
  21.  
  22. <?php
  23.     $wsdl = "http://10.100.106.46:8080/TTTWebApplication/TTTWebService?WSDL";
  24.     $trace = true;
  25.     $exceptions = true;
  26.     try {
  27.         $proxy = new SoapClient($wsdl, array('trace' => $trace, 'exceptions' => $exceptions));
  28.        
  29.         //form goes here
  30.         echo "
  31.             <form method=\"post\">
  32.                 <div>
  33.                     <label>First Name</label>
  34.                     <input type=\"text\" name=\"fname\">
  35.                 </div>
  36.                 <div>
  37.                     <label>Surname</label>
  38.                     <input type=\"text\" name=\"sname\">
  39.                 </div>
  40.                 <div>
  41.                     <label>Username</label>
  42.                     <input type=\"text\" name=\"username\">
  43.                 </div>
  44.                 <div>
  45.                     <label>Password</label>
  46.                     <input type=\"name\" name=\"password\">
  47.                 </div>
  48.                 <div>
  49.                     <button type=\"submit\" name=\"submit\" value=\"submit\">Create account</button>
  50.                 </div>
  51.             </form>
  52.         ";
  53.  
  54.         echo "
  55.             <p>Already have an account? <a href=\"login.php\">Sign in</a>.</p>
  56.         ";
  57.  
  58.         if(isset($_POST['submit'])){
  59.             $xml_array["username"]=$_POST["username"];
  60.             $xml_array["password"]=$_POST["password"];
  61.             $xml_array["name"]=$_POST["fname"];
  62.             $xml_array["surname"]=$_POST["sname"];
  63.  
  64.             $response=$proxy->register($xml_array);
  65.             $val=(string) $response->return;
  66.            
  67.             if($val=="ERROR-INSERT"|$val=="ERROR-RETRIEVE"|$val="ERROR-DB"|$val="ERROR-REPEAT"){
  68.                 //fails
  69.                 header("mainScreen.php");
  70.             } else {
  71.                 header("mainScreen.php");
  72.             }
  73.             exit;
  74.         }
  75.     } catch (Exception $e) {
  76.         echo $e->getMessage();
  77.     }
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement