Re: Need fast help IP count
Are you saying you want it to check the users IP address and the users login?
Re: Need fast help IP count
the script already check for ip, but not the account i want to make to check is the account already voted for today if he had voted 1 time, he can vote again after 24 hours that is what i want to be
Re: Need fast help IP count
What you need to do is, when the user first votes you need to store the userid and the vote_time using the NOW() function in your DB. In your if statement, you make a query that check for userid and vote_time < interval('24 hours'). Make sense?
Re: Need fast help IP count
Why not require the user to log-in in-order to vote then save both the username and ip address to the database. If the user attempts to vote again have a script to check if their username and ip address is already the database then display a message telling to user that they may only vote once.
Re: Need fast help IP count
they need to be loged to vote, but if they change the ip they can vote again and again, that is what i want to fix if they vote once from the account to be included in the database and cannot vote again, please need fast fix about this
Re: Need fast help IP count
You could probably do something like this.
Re: Need fast help IP count
can someone help to fix the code because it must had an also maybe $_SESSION['account'] or $_SESSION['login'] and to check them in database, i had tryed some guides but i cannot manage it to get it work like it should be. If someone knows php to help here
Re: Need fast help IP count
Did you even read what I posted? It will work.
Re: Need fast help IP count
Quote:
Originally Posted by
xxarmoxx
Did you even read what I posted? It will work.
Yes i understand your option with SQL Job, but how should this help exactly with the php script
I think the best option is to include it in the php script that to solve the problem with the account and ip change
Re: Need fast help IP count
xxarmoxx means something along the lines of:
PHP Code:
<?php
date_default_timezone_set('Country/City');
if (date("F d Y H:i:s.") > date("F d Y H:i:s." lastvote)){
// Do something
}
?>
Where lastvote would be the date on which the person last voted which, you will pull from the database.
Edit:
Replace country with the country you want the time zone for and the same for the city.
Re: Need fast help IP count
so if i make the hole code in the if it will work ?
Code:
<?php
date_default_timezone_set('Bulgaria/Sofia');
if (date("F d Y H:i:s.") > date("F d Y H:i:s." lastvote)){
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>
}
?>