Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dbhost = "localhost";
- $dbuser = "xxxxxxx";
- $dbpass = "xxxxxxxxx";
- $dbname = "xxxxxxxxxxxx";
- $conn = mysql_connect("".$dbhost."","".$dbuser."","".$dbpass."");
- mysql_select_db("".$dbname."") or die(mysql_error());
- $text = $_POST[ 'text' ];
- $date = date("m/d/y - h:iA");
- $ip = $_SERVER['REMOTE_ADDR'];
- $now = strtotime("now");
- $now1 = strtotime("-60 seconds");
- $check = mysql_query( "SELECT COUNT(*) FROM `paste` WHERE `ip` = '$ip' AND `tempo` > '$now1' AND `tempo` <= '$now' ") or die(mysql_error());
- $lst = mysql_fetch_array($check);
- mysql_free_result($check);
- $cnt = $lst[0];
- if ($cnt >= 3) {
- echo 'Flood detected. you are only allowed to submit 3 entries every 60 seconds.';
- }else{
- if( $_POST[ 'password' ] == '') {
- $password = 'None';
- }else{
- $password = mysql_escape_string(hash('sha512', $now . $_POST[ 'password' ] . $now));
- }
- if( $_COOKIE['skin'] == 'Tech' ) {
- $skin = 'Tech';
- }else{
- $skin = 'Default';
- }
- mysql_query("INSERT INTO `paste` (password, content, skin, date, tempo, ip) VALUES(\"{$password}\", \"{$text}\", \"{$skin}\", \"{$date}\", \"{$now}\", \"{$ip}\")");
- header( 'Location: index.php?id=' . mysql_insert_id() ) ;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement