Advertisement
Guest User

Untitled

a guest
Jul 10th, 2017
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.15 KB | None | 0 0
  1. <?php
  2. $dbhost = "localhost";
  3. $dbuser = "xxxxxxx";
  4. $dbpass = "xxxxxxxxx";
  5. $dbname = "xxxxxxxxxxxx";
  6. $conn = mysql_connect("".$dbhost."","".$dbuser."","".$dbpass."");  
  7. mysql_select_db("".$dbname."") or die(mysql_error());
  8. $text = $_POST[ 'text' ];
  9. $date = date("m/d/y - h:iA");
  10. $ip = $_SERVER['REMOTE_ADDR'];
  11. $now = strtotime("now");
  12. $now1 = strtotime("-60 seconds");
  13. $check = mysql_query( "SELECT COUNT(*) FROM `paste` WHERE `ip` = '$ip' AND `tempo` > '$now1' AND `tempo` <= '$now' ") or die(mysql_error());
  14. $lst = mysql_fetch_array($check);
  15. mysql_free_result($check);
  16. $cnt = $lst[0];
  17. if ($cnt >= 3) {
  18. echo 'Flood detected. you are only allowed to submit 3 entries every 60 seconds.';
  19. }else{
  20. if( $_POST[ 'password' ] == '') {
  21. $password = 'None';
  22. }else{
  23. $password = mysql_escape_string(hash('sha512', $now . $_POST[ 'password' ] . $now));
  24. }
  25. if( $_COOKIE['skin'] == 'Tech' ) {
  26. $skin = 'Tech';
  27. }else{
  28. $skin = 'Default';
  29. }
  30. mysql_query("INSERT INTO `paste` (password, content, skin, date, tempo, ip) VALUES(\"{$password}\", \"{$text}\", \"{$skin}\", \"{$date}\", \"{$now}\", \"{$ip}\")");
  31. header( 'Location: index.php?id=' . mysql_insert_id() ) ;
  32. }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement