什么时候我会在signup.php中注册...问题是,当我按下提交时,凭据不会插入到数据库中。有人可以帮帮我吗?当我点击提交然后我没有得到错误但成功注册..我在直接管理员的PHP版本是5.1。
这是我的signup.php的代码:
<head>
<title>.:: NitanCrime ::.</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<?php /* ------------------------- */
include("yep.php");
if(check_login()) {
print "<html>";
print "<head>";
print "<LINK href='images/mxstyle.css' type=text/css rel=stylesheet>";
print "</head>";
print "<body style='background: #grey; margin: 100px;'>";
print "<table align='center' width=100%>";
print "<tr>Je bent al ingelogd</tr>";
mysql_query("DELETE FROM `[online]` WHERE `login`='{$_COOKIE['login']}' AND `validate`='{$_COOKIE['validate']}' AND `IP`='{$_SERVER['REMOTE_ADDR']}'");
unset($_SESSION['login']);
unset($_SESSION['IP']);
unset($_SESSION['data']);
print <<<ENDHTML
</table>
}
</body>
</html>
ENDHTML;
exit;
}
$inboxchek =1;
if(isset($_GET['v']) && ($_GET['v'] == 1 || $_GET['v'] == 2)) {
setcookie("v",$_GET['v'],time()+24*60*60*365,"/","");
$_COOKIE['v'] = $_GET['v'];
}
if(isset($_GET['baas'])) {
setcookie("baas",$_GET['baas'],time()+24*60*60*365,"/","");
$_COOKIE['baas'] = $_GET['baas'];
}
if(!isset($_GET['baas'])) {
setcookie("baas","",time()+24*60*60*365,"/","");
$_COOKIE['baas'] = "";
}
if(isset($_COOKIE['login'],$_COOKIE['validate'])) {
setcookie("login",$_COOKIE['login'],time()+24*60*60,"/","");
setcookie("validate",$_COOKIE['validate'],time()+24*60*60,"/","");
}
mysql_query("UPDATE `[users]` SET `online`=NOW() WHERE `login`='{$data->login}'");
$ref = $_GET['x'];
$dbres = mysql_query("SELECT `id` FROM `[users]` WHERE `activated`=1");
$members = mysql_num_rows($dbres);
$dbres = mysql_query("SELECT `id` FROM `[users]` WHERE `level`=100");
$paymembers = mysql_num_rows($dbres);
$dbres = mysql_query("SELECT `id` FROM `[users]` WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(`online`) < 300");
$online = mysql_num_rows($dbres);
$chek = mysql_query("SELECT `login` FROM `[users]` WHERE `login`='$ref'");
$ok = mysql_num_rows($chek);
function ip() {
if(getenv('HTTP_X_FORWARDED_FOR')) {
return getenv('HTTP_X_FORWARDED_FOR');
} elseif(getenv('HTTP_CLIENT_IP')) {
return getenv('HTTP_CLIENT_IP');
} else {
return getenv('REMOTE_ADDR');
}
}
$baas = $_COOKIE['baas'];
$IP = ip();
$login = $_POST['login'];
$pass = $_POST['pass'];
$passconfirm = $_POST['passconfirm'];
$email = $_POST['email'];
$type = $_POST['type'];
${"select$type"} = "selected";
if(isset($_POST['submit'])) {
$Dupe = mysql_query("SELECT * FROM `[users]` WHERE `IP`='{$_SERVER['REMOTE_ADDR']}' AND `level`='2'");
$dU = mysql_num_rows($Dupe);
if($dU >=2){ echo " Je Mag Slechts 1 Account per Ip Adres Hebben! $dU"; exit; }
$message = Array(
"Je login mag alleen A-Z, a-z, 0-9, _ en - hebben",
"Vul een geldig e-mail adres in",
"Selecteer een type crimineel",
"Er bestaat al iemand met die login",
"Er is al iemand met die e-mail");
$msgnum = -1;
if(preg_match('/^[a-zA-Z0-9_\-]+$/',$login) == 0)
$msgnum = 0;
if(preg_match('/^.+@.+\..+$/',$email) == 0)
$msgnum = 1;
else {
$dbres = mysql_query("SELECT `id` FROM `[users]` WHERE `login`='$login'");
if(mysql_num_rows($dbres) > 0)
$msgnum = 3;
$dbres = mysql_query("SELECT `id` FROM `[users]` WHERE `email`='$email'");
if(mysql_num_rows($dbres) > 0)
$msgnum = 4;
$clientIP = $IP;
$forwardedFor = ($_SERVER['HTTP_X_FORWARDED_FOR'] != "") ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['HTTP_CLIENT_IP'];
$forwardedFor = preg_replace('/, .+/','',$forwardedFor);
if($ref !='' AND $ok == 0){ echo " Foutive Refferal $ref "; exit; }
if($msgnum == -1) {
$code = rand(100000,999999);
$passs = rand(100000,999999);
$land = rand(1,4);
mysql_query("UPDATE `[users]` SET `land`='1' WHERE `login`='$data->login'");
mysql_query("INSERT INTO `[users]`(`signup`,`login`,`pass`,`regIP`,`email`,`land`) values(NOW(),'$login',MD5('$passs'),'$IP','$email','$land')");
mysql_query("UPDATE `[users]` SET `cash`=`cash`+'10000',`ervaring`=`ervaring`+'500' WHERE `login`='$ref'");
mysql_query("INSERT INTO `[messages]`(`time`,`IP`,`forwardedFor`,`from`,`to`,`subject`,`message`) values(NOW(),'{$_SERVER['REMOTE_ADDR']}','$forwardedFor',' NitanCrime ','$ref','Refferal','Je Maakte $login lid op NitanCrime! Je verdiende 10,000')");
mysql_query("INSERT INTO `[temp]`(login,IP,code,area,time) values('$login','$IP',$code,'$land','signup',NOW())");
$id = mysql_insert_id();
mail($email,"NitanCrime Aanmelding","Hey!\n Welkom op NitanCrime\n\nBedankt voor u registratie. U kunt nu inloggen!\n\nHier is u informatie:\n\nGebruikersnaam: $login\nWachtwoord: $passs\n\nOnthoud u wachtwoord goed, deze kan niet meer achterhaald worden. Deze kan echter wel veranderd worden!\n\nVriendelijke groeten,\n\n NitanCrime","From: NitanCrime <aanmelding@nitancrime.com>\n");
}
}
}
/* ------------------------- */ ?>
<HTML>
<HEAD>
</HEAD>
<body>
<?
if($msgnum != -1) {
if(isset($msgnum) && $msgnum != -1)
print "<td><center>{$message[$msgnum]}</center></td>\n";
if($_GET['x'] == "") {
$baas = "(Geen)";
}
else {
$baas = $_GET['x'];
}
print <<<ENDHTML
<table style="position: absolute; left: 270px; top: 148px;" border=0 cellspacing=0 cellpadding=0>
<form method="post">
<BR><BR><BR>
<table cellspacing="1" cellpadding="2" align="center">
<tr><td align=center colspan="2" class=main><b>Aanmelden</b></td></tr>
<tr><td class=sub width=100><font color=black>Gebruikersnaam:</font></td>
<td class=sub><INPUT name="login" type="text" VALUE='' maxlength="16" style="width: 150;"></td></tr>
<tr><td class=sub width=100><font color=black>Email:</font></td>
<td class=sub><INPUT name="email" type="text" VALUE='' style="width: 150;"></td></tr>
<td class=sub colspan="2" align=center><input type="submit" name="submit" style=" height: 20; width: 110;" value="Aanmelden"></td>
</table>
</tr></form>
ENDHTML;
}
else
print " Je bent aangemeld!, Er is een e-mail gestuurd naar $email met Je wachtwoord! <b>Check u Ongewenste Mail!</b>\n";
?>
</BODY>
</HTML>
<? mysql_close($mysql); ?>
答案 0 :(得分:0)
我并不完全知道[]的用途是什么,或{}是什么,但是你的''和''相互搞乱了。
$sql = "DELETE FROM `online` WHERE `login`='$username' LIMIT 1";
mysql_query($sql);
上面的部分应该可以正常工作,问题来自于在php 5中访问数组时。
$sql = "DELETE FROM `online` WHERE `login`='$_COOKIE['login']' LIMIT 1";
mysql_query($sql);
由于双倍'',上述行无效。试试这个尝试。
$sql = "DELETE FROM `online` WHERE`login`='".$_COOKIE['online']." LIMIT 1";
mysql_query($sql);
使用双引号退出str,以便插入变量。
希望这有帮助,
旁注:我不确定它是否是间距,但看起来你在某处有一个开放的if语句。
另外如果您使用的是php 5,mysqli应该可以正常工作。你应该仍然改变它mysqli。在许多情况下,它更快,更安全。没有更多的工作了。