Advertisement
Guest User

Untitled

a guest
May 18th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <?
  2.  
  3. $dbuser="root";
  4. $dbpass="121212";
  5. $dbname="videotuga"; //the name of the database
  6. $chandle = mysql_connect("localhost", $dbuser, $dbpass)
  7. or die("Connection Failure to Database");
  8. mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found." . $dbuser);
  9.  
  10. if ($_SERVER["REQUEST_METHOD"] == "POST")
  11. {
  12.  
  13. $nome = $_POST["nome"];
  14. $link = $_POST["link"];
  15. $comentario = $_POST["comentario"];
  16. $dat = gmdate("Y-m-d H:i:s");
  17.  
  18. mysql_query("INSERT INTO videos (nome, link, comentario, data) VALUES('$nome', '$link', '$comentario', '$dat')") or sqlerr(__FILE__, __LINE__);
  19.  
  20.  
  21. header("Location: $BASEURL/listagem.php");
  22. die;
  23. }
  24.  
  25. ?>
  26.  
  27. <form method=post action=adicionarvideo.php>
  28. <table border=1 cellspacing=0 cellpadding=5>
  29.  
  30. <tr><td class=rowhead>*Nome</td><td><input type=text name=nome size=100></td></tr>
  31.  
  32. <tr><td class=rowhead>*Embed do video</td><td><input type=text name=link size=100></td></tr>
  33.  
  34. <tr><td class=rowhead>Comentário</td><td><textarea rows=8 type=\"text\" name=comentario cols="90" size=\"80\" /></textarea></td></tr>
  35.  
  36. <tr><td colspan=2 align=center><input type=submit value="Inserir"></td></tr>
  37. </table></form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement