Guest User

Untitled

a guest
Mar 8th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. <?php
  2. date_default_timezone_set('Europe/Belgrade');
  3.  
  4. $host = "localhost";
  5. $user = "root";
  6. $password = "bulletstrat";
  7. $base = "proj";
  8.  
  9. $con = mysql_connect($host, $user, $password);
  10. if(!$con)
  11. die("Couldn't connect : " . mysql_error());
  12. mysql_select_db($base, $con);
  13.  
  14. $title = $_POST['titleMusic'];
  15. $artist = $_POST['artist'];
  16. $album = $_POST['album'];
  17. $genre = $_POST['genre'];
  18. $today = date("Y-m-d");
  19. // $user = ;
  20. $req = "INSERT INTO MUSICTMP(titleMusicTmp, artistMusicTmp,
  21. albumMusicTmp, genreMusicTmp, username, datePicTmp)
  22. VALUES('" . mysql_real_escape_string($title) . "', '" .
  23. mysql_real_escape_string($artist) ."','" .
  24. mysql_real_escape_string($album) . "','" .
  25. mysql_real_escape_string($genre) . "', 'flute', '$today')";
  26.  
  27. $target_path = "uploadsTmp/";
  28. $file = $_FILES['musicup'];
  29. $type = $file['type'];
  30. $temp = $file['tmp_name'];
  31.  
  32. //if($type == "image/gif" || $type == "image/jpeg" || $file == "image/png") {
  33. if(is_uploaded_file($temp)) {
  34. if(move_uploaded_file($temp, $target_path . $file['name'])) {
  35. mysql_query($req, $con);
  36. echo "The " . $title . " music successfully upload !";
  37. } else
  38. echo "File cannot be moved to $target_path";
  39. } else
  40. echo "Unable to upload !";
  41. //} else
  42. // echo "Please select a picture..."
  43. ?>
Add Comment
Please, Sign In to add comment