Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1.  
  2.  
  3. $link = mysql_connect($host, $username, $password);
  4. if (!$link) {die('Could not connect: ' . mysql_error());}
  5.  
  6. mysql_select_db ($database);
  7.  
  8. $title=$_POST['title'];
  9. $wlink=$_POST['wlink'];
  10. $description=$_POST['description'];
  11. $month=$_POST['month'];
  12. $year=$_POST['year'];
  13. $category=$_POST['category'];
  14.  
  15. if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) {
  16.  
  17. $tmpName = $_FILES['image']['tmp_name'];
  18.  
  19. $fp = fopen($tmpName, 'r');
  20. $data = fread($fp, filesize($tmpName));
  21. fclose($fp);
  22.  
  23.  
  24. $query = "INSERT INTO rss ";
  25. $query .= "VALUES ('','$title','$category','$month/$year','$description','$wlink','`')";
  26.  
  27. $results = mysql_query($query, $link);
  28.  
  29. # (image) in .= before VALUES
  30. print "Thank you, your file has been uploaded.";
  31. mysql_close();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement