Guest User

Untitled

a guest
Jul 16th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. <?php
  2. $host="localhost"; // Host name
  3. $username=""; // Mysql username
  4. $password=""; // Mysql password
  5. $db_name=""; // Database name
  6. $tbl_name="";
  7. ?>
  8. <html>
  9. <head>
  10. <?php include("head.php"); ?>
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  12. <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
  13. <title>Arcanum - TERA Database</title>
  14. </head>
  15. <body>
  16. <div id="page-wrap-3">
  17. <p>
  18. <?php
  19. //initilize PHP
  20. if ( isset ( $_POST['submit'] ) ) //If submit is hit
  21. {
  22. //then connect as user
  23. //change username and password to your mySQL username and password
  24. mysql_connect("localhost","","");
  25. //if you wish to connect to a local MySQL database the code is mysql_connect("localhost","root",""); until you set a username and password
  26. //select which database you want to edit
  27. mysql_select_db("")or die( "<p><span style=\"color: red;\">Unable to select database</span></p>");
  28. //convert all the posts to variables:
  29. $name = mysql_real_escape_string(htmlspecialchars($_POST['name']));
  30. $category = $_POST['category'];
  31. $subcategory = $_POST['subcategory'];
  32. $class_id = $_POST['class_id'];
  33. $level = $_POST['level'];
  34. $bind = $_POST['bind'];
  35. $tier = $_POST['tier'];
  36. $trade = $_POST['trade'];
  37. $ilvl = $_POST['ilvl'];
  38. $amod = $_POST['amod'];
  39. $xdmg = $_POST['xdmg'];
  40. $dmod = $_POST['dmod'];
  41. $bal = $_POST['bal'];
  42. $description = mysql_real_escape_string(htmlspecialchars($_POST['description']));
  43. $description2 = mysql_real_escape_string(htmlspecialchars($_POST['description2']));
  44. $description3 = mysql_real_escape_string(htmlspecialchars($_POST['description3']));
  45. $sprice = $_POST['sprice'];
  46. $bprice = $_POST['bprice'];
  47. $percent = $_POST['percent'];
  48. $source = mysql_real_escape_string(htmlspecialchars($_POST['source']));
  49. $tnail = @$_POST['thumbnail'];
  50. //Insert the values into the correct database with the right fields
  51. $result = mysql_query("INSERT INTO `{$tbl_name}` VALUES ('NULL','NULL','{$name}', '{$category}', '{$subcategory}', '{$class_id}', '{$level}', '{$bind}', '{$tier}', '{$trade}', '{$ilvl}', '{$amod}', '{$xdmg}', '{$dmod}', '{$bal}', '{$description}', '{$description2}', '{$description3}', '{$sprice}', '{$bprice}', '{$percent}','{$source}', 'misc.png', '0')") or die(mysql_error());
  52. mysql_close();
  53. //confirm
  54. echo "<p><span style=\"color: red;\">Thank You; your comments have been entered in my database. DO NOT REFRESH THE PAGE or data will be sent again.</span></p>";
  55. }
  56. else
  57. {
  58. // close php so we can put in our code
  59. ?>
  60. <?php
  61. } //close the else statement
  62. ?>
Add Comment
Please, Sign In to add comment