|
-
Jul 28th, 2012, 07:25 PM
#1
Thread Starter
Fanatic Member
Need fast help IP count
Hello, this script is for vote reward, but it logs only IP's in the database, and if user change his ip he can vote again and again unlimited, can someone fix this script also to login the account when he clicks on all votes 1 time he can click again after 24 hours
Code:
<?PHP
if(isset($_POST[id_vote])) {
include("vote.php");
$ip = $_SERVER['REMOTE_ADDR'];
$login = clean_var( stripslashes($_SESSION['user']) );
$id = substr( clean_var( stripslashes($_POST[id_vote]) ) , 3);
$file = "vote_logs/".date("Y-m-d", time())."_$id.dat";
if(empty($_SESSION['pass']) || empty($_SESSION['user'])) {
echo $die_start . mmw_lang_guest_must_be_logged_on . $die_end . $rowbr;
}
elseif(is_file($file) && $vote[$id][2]>0) {
$handle = fopen($file, "r");
$data = fread($handle, filesize($file));
fclose($handle);
$substr_count = substr_count($data,$ip);
if($substr_count <= 0) {
$data = "$ip \n";
$fp = fopen($file, 'a');
fputs($fp, $data);
fclose($fp);
mssql_query("UPDATE MEMB_CREDITS SET credits = credits + ".$vote[$id][2]." WHERE memb___id='$login'");
echo "$okey_start Thanks For Vote! $okey_end $rowbr";
writelog("vote_for_us","Vote <b>$id</b> Has Been <font color=#FF0000>Added</font> For $_SESSION[user] - ".$vote[$id][2]);
}
else {
echo "$die_start Today You Can't Vote For This! $die_end $rowbr";
}
}
elseif(isset($_SESSION['pass']) && isset($_SESSION['user']) && $vote[$id][2]>0) {
$data = "$ip \n";
$fp = fopen($file, 'a');
fputs($fp, $data);
fclose($fp);
mssql_query("UPDATE MEMB_CREDITS SET credits = credits + ".$vote[$id][2]." WHERE memb___id='$login'");
echo "$okey_start Thanks For Vote! $okey_end $rowbr";
writelog("vote_for_us","Vote <b>$id</b> Has Been <font color=#FF0000>Added</font> For $_SESSION[user] - ".$vote[$id][2]);
}
else {
echo "$die_start Fatal ErroR! $die_end $rowbr";
}
}
?>
<script>
function windopen(url) {
window.open(url,"HellEntry","width=800,height=540,left=0,top=0");
// window.top.location.href = url;
// window.location = url;
}
</script>
<center><big><b>Vote For Us</b></big><br> <br></center>
<table class="sort-table" height="30" border="0" cellpadding="0" cellspacing="0" align="center" width="400">
<thead><tr>
<td width="10">#</td>
<td>URL</td>
<td width="100">Credit You Get</td>
<td width="20"><?echo mmw_lang_voting;?></td>
</tr>
</thead>
<?
include("vote.php");
if(count($vote)==0) {
echo "<tr><td colspan='4'>".mmw_lang_no_vote."</td></tr>";
}
else {
for($i=0; $i < count($vote); ++$i) {
$rank = $i + 1;
$rand = rand(100,999);
echo "<tbody><tr>
<td>$rank</td>
<td>".$vote[$i][0]."</td>
<td>".$vote[$i][2]."</td>
<td><form name=\"vote\" method=\"post\" action=\"\"><input name=\"id_vote\" type=\"hidden\" value=\"$rand$i\"><input type=\"submit\" value=\"".mmw_lang_to_vote."\" title=\"".$vote[$i][0]."\" onclick=\"return windopen('".$vote[$i][1]."')\"></form></td>
</tr></tbody>";
}
}
?>
</table>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|