Guest User

Untitled

a guest
Nov 24th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.53 KB | None | 0 0
  1. <head>
  2. <title>
  3. Registration Form Car Spots Belgium
  4. </title>
  5. <style type="text/css">
  6.  
  7.  
  8. .container {
  9. background-color:gray;
  10. width:150px;
  11. border:2px solid black;
  12. font: 12px Verdana, sans-serif;
  13.  
  14. }
  15. </style>
  16. </head>
  17. <body>
  18. <?php
  19.  
  20. // If the form hasn't been submitted yet
  21. if (!isset($_POST['title'])) {
  22.  
  23.     // Echo the form. Customize this how you please
  24.     echo "<form class=container method=post action=u.php >";
  25.     echo "<td><tr>Title: <input type=text name=title> <div style= color:red;> Example: </br> Mercedes E250</div></td></tr><br>";
  26.     echo "<td><tr>File Name: <input type=text name=password></td></tr><br>";
  27.     echo "<input type=submit value=Insert>";
  28.     echo "</form>";
  29.    
  30.     $date = date('d-m-Y');
  31.  
  32. // If the form has been submitted
  33. }else{
  34.  
  35.     // FILL THIS IN WITH YOUR DATABASE INFO
  36.     $db_host = 'localhost';
  37.     $db_user = '*';
  38.     $db_name = 'linh7219_shit';
  39.     $db_pass = '*';
  40.     $tbl_name = 'photos';
  41.  
  42.     // Connect to the database
  43.     mysql_connect($db_host, $db_user, $db_pass) or die ('Cannot Connect Database');
  44.     mysql_select_db($db_name) or die ('Cannot Select Database');
  45.    
  46.     // Randomly generate an id
  47.     $id = rand();
  48.    
  49.     $name = $_POST['title'];
  50.  
  51.     // Run the query into the database
  52.     mysql_query("INSERT INTO `".$tbl_name."` VALUES (".$id.", '".mysql_real_escape_string($_POST['title'])."', '".mysql_real_escape_string($_POST['password'])."', '".mysql_real_escape_string($date)."');");
  53.    
  54.     // Echo the complete message. Customize this as you please
  55.     echo "Upload Complete <br>";
  56.     echo "Succes, " . $name;
  57.  
  58.  
  59. }
  60.  
  61. ?>
  62. </body>
Add Comment
Please, Sign In to add comment