Advertisement
Guest User

Untitled

a guest
Jan 6th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.70 KB | None | 0 0
  1. <?php
  2. /*calls saveForm function using 9 inputs from form*/
  3. saveForm(
  4.     $_POST['inform-username'],
  5.     $_POST['inform-password'],
  6.     $_POST['inform-room_size'],
  7.     $_POST['ensuite'],
  8.     $_POST['price1'],
  9.     $_POST['price2'],
  10.     $_POST['price3'],
  11.     $_POST['price4'],
  12.     $_POST['view'],
  13.     $_POST['comments']);
  14. header("Location: ../index.php");
  15. function saveForm($username, $password, $roomcount, $ensuite, $p1, $p2, $p3, $p4, $view, $comments){
  16.    
  17.     $username = $_POST['inform-username'];
  18.     $password = $_POST['inform-password'];
  19.     $string = "$username||$password";
  20.     if(!strstr($file, "$string"))
  21.     {
  22.         $myFile = "login.txt";
  23.         $fh = fopen($myFile, 'a') or die("can't open file");
  24.         $stringData = "$username\n";
  25.         $stringData = "$password\n";
  26.         fwrite($fh, $stringData);
  27.         fwrite($fh, $stringData);
  28.         fclose($fh);
  29.         }
  30.         else
  31.         {
  32.         echo "";
  33.         }
  34.     }
  35. }
  36.    
  37.    
  38.        
  39.      
  40.    
  41.     $file2 = fopen(__DIR__ . "/" . $username . ".txt", "x+") or die("Unable to open file"); /*opens file*/
  42.    
  43.     $roomcount = $_POST['inform-room_size'];
  44.     $ensuite = $_POST['ensuite'];
  45.     $p1 = $_POST['price1'];
  46.     $p2 = $_POST['price2'];
  47.     $p3 = $_POST['price3'];
  48.     $p4 = $_POST['price4'];
  49.     $view = $_POST['view'];
  50.     $comments = $_POST['comments'];    
  51.        
  52.                
  53.     file_put_contents($file2, $username);
  54.     file_put_contents($file2, $password);
  55.     file_put_contents($file2, $roomcount);
  56.     file_put_contents($file2, $ensuite);
  57.     file_put_contents($file2, $p1);
  58.     file_put_contents($file2, $p2);
  59.     file_put_contents($file2, $p3);
  60.     file_put_contents($file2, $p4);
  61.     file_put_contents($file2, $view);
  62.     file_put_contents($file2, $comments);  
  63.     fclose($file2);    
  64.  
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement