Advertisement
Guest User

Untitled

a guest
Dec 24th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. if( isset( $_POST['submit_form'] ) )
  3. {
  4. validate_data($data)
  5. {
  6. $data = trim($data);
  7. $data = stripslashes($data);
  8. $data = strip_tags($data);
  9. $data = htmlspecialchars($data);
  10. $data = mysqli_real_escape_string($data);
  11. return $data;
  12. }
  13.  
  14. $name = validate_data( $_POST['username'] );
  15. $emailid = validate_data( $_POST['useremail'] );
  16. $password = validate_data( $_POST['user_password'] );
  17.  
  18. $host = 'localhost';
  19. $user = 'root';
  20. $pass = ' ';
  21.  
  22. mysql_connect($host, $user, $pass);
  23. mysql_select_db('demo');
  24.  
  25. $insertdata=" INSERT INTO user_data VALUES( '$name','$emailid','$password' ) ";
  26. mysqli_query($insertdata);
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement