תנסה ככה:
logout.php:
קוד PHP:
<div id="main">
<div class="sidebartop">Logged out!</div>
<div class="sidebarbox">
<center>
<?php
if(isset($_SESSION['id'])){
session_destroy();
echo "You are now logged out! Please come again soon!<br />You will get redirected in 3 seconds.<META HTTP-EQUIV=Refresh CONTENT=\"3; URL=/?page=index\"></td></tr></table>";
} else {
echo "<br />You are already logged out!<br /><br />";
}
?>
</div>
</div>
vote.php:
קוד PHP:
<div id="main">
<div class="sidebartop">Vote</div>
<div class="sidebarbox">
<!-- VOTE -->
<?php
error_reporting(E_ALL ^ E_NOTICE);
function getVoteErr($err) {
if($err == "1") {
echo '<p class="error">Please fill in the correct account credentials.</p>';
} elseif($err == "2") {
echo '<p class="error">You must be logged out to vote for rewards.</p>';
} elseif($err == "3") {
echo '<p class="error">You\'ve already voted with this account in the past 12 hours!<br />Last time you voted was on: '.$_SESSION['vote_date'].'!</p>';
}
}
if(isset($_POST['doVote'])) {
$earnednx = false;
$account = $_POST['name'];
$account = mysql_real_escape_string($account);
mysql_select_db($host['database']);
$query=mysql_query("SELECT * FROM accounts WHERE name='" . mysql_real_escape_string($_POST["name"]) . "'");
$info=mysql_fetch_assoc($query);
if($_POST["name"] == "") {
$_SESSION['vote_err'] = "1";
echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
} elseif($_POST["password"] == "") {
$_SESSION['vote_err'] = "1";
echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
} elseif(mysql_num_rows($query) < 1) {
$_SESSION['vote_err'] = "1";
echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
} elseif(($info["password"] != hash('sha512',$_POST["password"].$info["salt"]) && sha1($_POST["password"])) && $info["password"] != sha1($_POST["password"])) {
$_SESSION['vote_err'] = "1";
echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
} elseif($info["loggedin"] > 0) {
$_SESSION['vote_err'] = "2";
echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
} else {
$ip = $_SERVER['REMOTE_ADDR'];
$time = time();
$query = mysql_query("SELECT *, SUM(`times`) as amount FROM voterecords WHERE account='$account'");
$lasttime = mysql_fetch_array($query);
$amount = $lasttime['amount'];
$insertnew = false;
if ($amount == "") {
$insertnew = true;
}
$timecalc = $time - $lasttime['date'];
if (!$insertnew) {
if ($timecalc < 43200) { // 43200 ms is 12 hours
date_default_timezone_set(''.$timezone.'');
$_SESSION['vote_err'] = "3";
$_SESSION['vote_date'] = date('M d\, h:i:s A', $lasttime['date']);
echo '<meta http-equiv="refresh" content="0;url=?page=vote">';
} else {
$update = mysql_query("SELECT * from voterecords WHERE ip='$ip' AND account = '$account'");
if ($update) {
mysql_query("UPDATE voterecords SET account='$account', date='$time', times=times+1 WHERE account='$account'");
mysql_query("UPDATE voterecords SET account='$account', date='$time', times=times+1 WHERE ip='$ip'");
$earnednx = true;
} elseif (!$update) {
$ipinsert = mysql_query("INSERT INTO voterecords (`account`, `ip`, `date`, `times`) VALUES ('$account', '$ip', '$time', 1)");
if (!$ipinsert) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $ipinsert;
die($message);
} else {
$earnednx = true;
}
} else {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $update;
die($message);
}
}
} else {
$success = mysql_query("INSERT INTO voterecords (`account`, `ip`, `date`, `times`) VALUES ('$account', '$ip', '$time', 1)");
if (!$success) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $success;
die($message);
} else {
$earnednx = true;
}
}
// Insert the NX into the db now
if ($earnednx) {
mysql_query("UPDATE accounts SET votePoints = votePoints + '1' WHERE name='" . mysql_real_escape_string($_POST["name"]) . "'");
mysql_query("UPDATE accounts SET mPoints = mPoints + '5000' WHERE name='" .mysql_real_escape_string($_POST["name"]) . "'");
mysql_query("UPDATE accounts SET lastvote='" .time(). "' WHERE name='" . mysql_real_escape_string($_POST["name"]) . "'");
mysql_close($conn);
echo '<html>';
echo '<head>';
unset($_SESSION['vote_err']);
echo '<meta HTTP-EQUIV="REFRESH" content="0; url='.$votelink.'">';
echo '</head>';
echo '</html>';
}
}
}
?><!-- END VOTE PHP SCRIPT -->
<!-- BEGIN VOTE -->
<div align="center">
<div id="message-yellow">Not interested in any rewards, but still wanna vote? <a href="<?php echo $votelink; ?>" target="_blank">Click Here</a></div>
<br />
<div id="vote">
<fieldset class="normal">
<legend>Vote</legend>
<b>Welcome to the Vote Page!</b><br />
You can vote for us every 12 hours, and get rewards for voting.<br /><br />
<b>Attention: Once transferred to vote page, please type the word you read in the captcha image and click "Submit".</b><br /><br />
Also, once you click submit, your Account and IP Address will be logged.<br />Please don't try to fool us with fake votes, bypasses, ect.<br>You may get suspended/banned.<br /><br />
<b>Below, please fill in your login credentials.</b><br />Click submit once filled out to get confirmed.<br />
5k NX and 1 Vote Point will be added to your account
<form action="?page=vote" method="POST"><br>
<div style="width:70px; float:left;">Username:</div><input type="text" name="name" maxlength="15" class="input" ><br />
<div style="width:70px; float:left;">Password:</div><input type="password" name="password" maxlength="15" class="input" ><br />
<input type="hidden" name="submit_check" value="1">
<input type="submit" name="doVote" value="Submit" class="doVote"><br />
<?php getVoteErr($_SESSION['vote_err']); ?>
</form>
</div>
</div>
</div>
</div>