Advertisement
Guest User

Untitled

a guest
May 30th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. <?php
  2. $user="root";
  3. $password="wuffy";
  4. $database="l2live"; //Char+login DB
  5.  
  6. $nochar=false;
  7. $voted=false;
  8. $disp = true;
  9. if(($_COOKIE['vote']) != '1')
  10. {
  11. if(!empty($_POST['name']))
  12. {
  13. mysql_connect(localhost,$user,$password);
  14. @mysql_select_db($database) or die( "Unable to select database");
  15. $name = strtolower(mysql_real_escape_string($_POST['name']));
  16. $today = date("mdHi");
  17. $query="SELECT * FROM characters WHERE char_name='$name' LIMIT 1";
  18. $result = mysql_query($query);
  19. if($row = mysql_fetch_array($result))
  20. {
  21. $guid = $row['charId'];
  22. $acct = $row['account_name'];
  23. $res = mysql_query("SELECT * FROM votewatch WHERE account_name='$acct' LIMIT 1");
  24. if($r2 = mysql_fetch_array($res))
  25. {
  26. $ct = $r2['ctime'];
  27. if($today-$ct < 1200)
  28. {
  29. $disp = false;
  30. mysql_close();
  31. return;
  32. }
  33. else
  34. {
  35. mysql_query("DELETE FROM votewatch WHERE account_name='$acct' LIMIT 1");
  36. }
  37. }
  38. $reward = mysql_real_escape_string($_POST['reward']);
  39. if($reward == 0)
  40. {
  41. mysql_query("INSERT INTO items (owner_id, object_id, item_id, count, enchant_level, loc, loc_data, time_of_use, custom_type1, custom_type2, mana_left, time) VALUES ($guid, '0', '6673', '50000', 0 , INVENTORY , 0 , NULL , '0', '0', '-1', '-1')" );
  42. }
  43. else
  44. {
  45. mysql_query("INSERT INTO items (owner_id, object_id, item_id, count, enchant_level, loc, loc_data, time_of_use, custom_type1, custom_type2, mana_left, time) VALUES ($guid, '0', '$reward', '50000', 0 , INVENTORY , 0 , NULL , '0', '0', '-1', '-1')" );
  46. }
  47. mysql_query("INSERT INTO votewatch(acct_name, ctime) VALUES($acct, $today)");
  48. $voted = true;
  49. }
  50. else
  51. {
  52. $nochar = true;
  53. }
  54. mysql_close();
  55. }
  56. }
  57. else
  58. {
  59. $disp = false;
  60. }
  61.  
  62. ?>
  63. <div id='container' style='-moz-user-select: none; -khtml-user-select: none; user-select: none; cursor:default; padding-bottom:5px; width:320px; border: 4px double red; position: absolute; top:20px; left:20px; background-color:black; color:white;'>
  64. <div id='header' style='font-family: Arial; margin-bottom: 0.5em; border-bottom: 1px solid red; text-align: center; background-color:gray; color:#ffffff'>
  65. Please vote for our server!
  66. <span align='right' style='position:absolute; left: 305px; text-align: right;'>
  67. <a href='javascript:void();' style='font-size:10px; color:white; text-decoration:none;' onclick='javascript:document.getElementById("container").style.display="none";'>
  68. [X]
  69. </a>
  70. </span>
  71. </div>
  72. <div id='text' style='padding: 5px; padding-left: 7px; font-size: 12px; border-bottom: 1px solid red;'>
  73. Voting for our server helps us grow and evolve,
  74. and eventually become better than before.
  75. You can vote once every 12 hours, and you'll get a reward for doing so!
  76. </div>
  77. <form style='text-align: center; margin-bottom: 2px; margin-top: 5px;' method='post' action='index.php'>
  78. <div style='font-size: 12px; valign:center;'>
  79. Character Name:&nbsp;&nbsp;
  80.  
  81. <input type='text' name='name' style='font-size: 12px; width: 80px; background-color: black; color: white; border: 1px solid red;' />
  82. <input type='submit' style='font-size: 12px; position:relative; top:1px; color:white; height: 17px; border:1px solid red; background-color:black;' value='Vote!' />
  83. </div>
  84. <div style='font-size: 12px; valign:center; margin-top: 5px; padding-top: 3px;'>
  85. Choose a reward:&nbsp;&nbsp;
  86. <select name='reward' style='background-color: black; color: white; font-family: Arial; font-size: 12px; border: 1px solid red; height: 17px; font-size: 10px;'>
  87. <option value='0'>10 Gold</option>
  88. <option value='6673'>Scroll of Agility V</option>
  89. <option value='27499'>Scroll of Intellect V</option>
  90. <option value='27500'>Scroll of Protection V</option>
  91. <option value='27501'>Scroll of Spirit V</option>
  92. <option value='27502'>Scroll of Stamina V</option>
  93. <option value='27503'>Scroll of Strength V</option>
  94. </select>
  95. </div>
  96. <?php
  97. if($nochar)
  98. {
  99. echo "<br /><span style='font-size: 12px; color: black; background-color:pink; padding: 3px; position: relative; top: -8px; border: 1px solid red;'>A character with that name was not found</span>";
  100. }
  101. if($voted)
  102. {
  103. echo "<br /><span style='font-size: 12px; color: white; background-color:black; padding: 3px; position: relative; top: -8px; border: 1px solid red;'>Thank you for voting!</span>";
  104. echo "<script language='javascript'>setTimeout(\"location.href='votegateway.php'\",3000);</script>";
  105. }
  106. ?>
  107. </form>
  108. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement