Advertisement
Guest User

Untitled

a guest
Jun 18th, 2013
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.04 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4.     <meta charset="utf-8">
  5. <link rel="stylesheet" href="index.css" />
  6. <title>Funn registrert | Alta Botanikkforening</title>
  7. </head>
  8.  
  9. <body class="content">
  10. <div align="center" class="text">
  11. <?php ?
  12.     ini_set('date.timezone', 'Europe/Oslo');
  13. //This is the directory where images will be saved
  14. $target = "pics/";
  15. $target = $target . basename( $_FILES['Filename']['name']);
  16.  
  17. //This gets all the other information from the form
  18. $Filename=$_FILES['Filename']['name'];
  19. $Description=$_POST['Description'];
  20. $Contact=$_POST['Contact'];
  21. $Time = gmdate('Y-m-d H:i');
  22. $Title=$_POST['Title'];
  23.  
  24.  
  25. //Writes the Filename to the server
  26. if(move_uploaded_file($_FILES['Filename']['tmp_name'], $target)) {
  27.     //Tells you if its all ok
  28.     echo "Filen ". basename( $_FILES['Filename']['name']). " er nå lagt til blant Alta Botanikkforeningens funn.";
  29.     // Connects to your Database
  30.     mysql_connect("localhost", "root", "") or die(mysql_error()) ;
  31.     mysql_select_db("altabotanikk") or die(mysql_error()) ;
  32.  
  33. /*
  34.     //Writes the information to the database
  35.     mysql_query("INSERT INTO picture (Filename,Description,Contact,Time,Title)
  36.     VALUES ('$Filename', '$Description', '$Contact', now(), '$Title')") ;
  37. } else {
  38.     //Gives and error if its not
  39.     echo "Det skjedde noe galt her :/";
  40. }
  41. */
  42.  
  43. $sql = '
  44.     INSERT INTO picture (
  45.         Filename,
  46.         Description,
  47.         Contact,
  48.         Time,
  49.         Title,
  50.     ) VALUES (
  51.         "'.mysql_real_escape_string($Filename).'",
  52.         "'.mysql_real_escape_string($Description).'",
  53.         "'.mysql_real_escape_string($Contact).'",
  54.         "now()",
  55.         "'.mysql_real_escape_string($Title).'",
  56.     )
  57. ';
  58. print '<pre>'.($sql).'</pre>';
  59. mysql_query($sql);
  60. print 'err: '.mysql_error();
  61. die();
  62. ?>
  63. <br/><br/>
  64. <form action="finds.php"><input type="submit" name="submit" value="Tilbake" /></form>
  65. </div>
  66.  
  67. <script>
  68.     parent.document.title = document.title;
  69. </script>
  70.  
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement