Advertisement
Guest User

Untitled

a guest
Jun 6th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2. $username = "";
  3. $password = "";
  4. $hostname = "localhost";
  5.  
  6. //connection to the database
  7. $dbhandle = mysql_connect($hostname, $username, $password)
  8. or die("Unable to connect to MySQL");
  9.  
  10. //select a database to work with
  11. $selected = mysql_select_db("c9",$dbhandle)
  12. or die("Could not select examples");
  13. $status = $_REQUEST['status'];
  14. $uname = $_REQUEST['uname'];
  15. $uid = $_REQUEST['uid'];
  16. $email = $_REQUEST['email'];
  17. $pid = $_REQUEST['pid'];
  18.  
  19. $uploaddir = "FOLDER PATH";
  20. $uploadfile = $uploaddir.basename($_FILES['userfile']['name']);
  21. if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
  22. $image = $_FILES['userfile']['name'];
  23. $success = "INSERT INTO `table`(`id`,`userid`,`name`,`image`,`status`, `email`,`pid`) VALUES ('','$uid','$uname','$image','$status','$email','$pid')";
  24. $true = mysql_query($success);
  25. $success1 = "INSERT INTO `table1`(`comment_post_ID`,`comment_author`,`comment_author_email`,`comment_content`) Values('$pid','$uname','$email','$status')";
  26. $true1 = mysql_query($success1);
  27. echo $status;
  28. } else {
  29. echo mysql_error();
  30. echo $image;
  31. }
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement