|
|
תגיד לי איך קוראים לעמודה ב MySQL של ה nx ב accounts
תנסה את זה:
קוד 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 paypalNX = paypalNX + '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>
זה לא מספרים זה ניקרא sha1, זה שנייה לסדר:
login.php:
register_do.php:קוד PHP:<?php
include("function.php");
session_start(); ?>
<?php
if(isset($_SESSION['id'])) {
echo "
<center><br>Hello, <font color=\"blue\">".$_SESSION['name'].".<br /><br /></center></font>
"; include("ucp.php");
echo"<center>
<input type=\"submit\" name=\"Logout\" value=\"Logout\" onClick=\"parent.location='?page=logout'\" /></center>";
} else {
if(!isset($_POST['login_x'])){
echo "
<table border=\"0\" >
<tr>
<form method=\"POST\">
<tr> Username:</tr>
<tr><input class=\"cleardefault\" size=\"14\" type=\"text\" name=\"username\" maxlength=\"12\" style=\"width: 170px;\" />
<tr> Password:</tr>
<tr><input class=\"cleardefault\" size=\"14\" type=\"password\" name=\"password\" style=\"width: 170px;\" />
<center>
</tr>
</table>
<table>
<tr>
<br/><center>
<input type=\"image\" src=\"images/login.png\" name=\"login\" value=\"Login\" alt=\"login\" /></form></center>
</tr>
</center>
</table>";
} else {
$u = mysql_real_escape_string($_POST['username']);
$p = mysql_real_escape_string($_POST['password']);
$s = mysql_query("SELECT * FROM `accounts` WHERE `name`='".sql_sanitize($u)."'") or die(mysql_error());
$i = mysql_fetch_array($s);
if($i['password'] == ($p.$i['salt']) || ($p) == $i['password']) {
$user = mysql_query("SELECT * FROM `accounts` WHERE `name`='".sql_sanitize($i['name'])."' AND `password`='".sql_sanitize($i['password'])."'") or die(mysql_error());
$auser = mysql_fetch_array($user);
$_SESSION['id'] = $auser['id'];
$_SESSION['name'] = $auser['name'];
if($auser['webadmin'] == "1"){
$_SESSION['admin'] = $auser['webadmin'];
}
if($auser['gm'] == "1") {
$_SESSION['gm'] = true;
}
echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=\"?page=index\">";
} else {
echo "<br />The username or password is incorrect. Please try again.<br>You will be redirected in 3 seconds<br />
<meta http-equiv='refresh' content='4;url=\"?page=index\"'><br />";
}
}
}
?>
vote.php:קוד PHP:<div id="main">
<center>
<div class="sidebartop">Registration Result</div>
<div class="sidebarbox">
<?php
/* Store user details */
$name = mysql_real_escape_string($_POST['name']);
$pass = (mysql_real_escape_string($_POST['pass']));
$email = mysql_real_escape_string($_POST['email']);
$dob = mysql_real_escape_string($_POST['dob']);
$vpass = (mysql_real_escape_string($_POST['vpass']));
$sel = 'SELECT * FROM accounts WHERE name="'.$_POST['name'].'"';
if($name == ""){
echo '<center>No username filled in.</center>';
exit();
} elseif(mysql_num_rows(mysql_query($sel)) >= 1 ){
echo '<center>This username already exists.</center>';
exit();
} elseif($pass == ""){
echo '<center>No password filled in.</center>';
exit();
} elseif($vpass != $pass){
echo '<center>The passwords did not match.</center>';
exit();
} elseif ($email == "") {
echo 'There was no email filled in.';
die();
} elseif ($dob == "") {
echo 'There was no Date Of Birth filled in.';
die();
} else {
$d = 'INSERT INTO accounts (name, password, email, birthday) VALUES ("'.sql_sanitize($name).'","'.sql_sanitize($pass).'", "'.sql_sanitize($email).'", "'.sql_sanitize($dob).'")';
mysql_query($d) OR die (mysql_error());
echo '<center>Your account has been successfully created. You may now log in</center>';
}
?>
</div>
</div>
</div>
קוד 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"] != ($_POST["password"].$info["salt"]) && ($_POST["password"])) && $info["password"] != ($_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 paypalNX = paypalNX + '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>
לאן אתה לא יכול להתחבר?
טעות שלי אני גם רואה את הסיסמה וגם מתחבר לאתר
הVOTE
שגיאות:
אחרי הרשמה הוא רושם:
והVOTE אני צריך לחכות עוד 12 שעות להצביע שובNotice: Undefined index: name in C:\wamp\www\AltairCMS\pages\register_do.php on line 7
Notice: Undefined index: pass in C:\wamp\www\AltairCMS\pages\register_do.php on line 8
Notice: Undefined index: email in C:\wamp\www\AltairCMS\pages\register_do.php on line 9
Notice: Undefined index: dob in C:\wamp\www\AltairCMS\pages\register_do.php on line 10
Notice: Undefined index: vpass in C:\wamp\www\AltairCMS\pages\register_do.php on line 11
Notice: Undefined index: name in C:\wamp\www\AltairCMS\pages\register_do.php on line 12
No username filled in.
כדי לנסות שוב כנס ל MySQL ל voterecords ותמחק את השורה שיש שם
והשגיאה זה בגלל שהגעת לדף הזה איכשהו בלי לרשום את הפרטים?
זה אמור לעשות שלא תצטרך לחקות 12 שעות
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"] != ($_POST["password"].$info["salt"]) && ($_POST["password"])) && $info["password"] != ($_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 paypalNX = paypalNX + '5000' WHERE name='" .mysql_real_escape_string($_POST["name"]) . "'");
mysql_query("UPDATE accounts SET lastvote='" .time(). "' WHERE name='" . mysql_real_escape_string($_POST["name"]) . "'");
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>