Dobrý Deň. Mal by som malý problém...
Stiahol som si registračku. Prekodoval mi ju Lukasas aby sa pri registrácii ulážali úcti do dvoch DB no ale problem je v tom že keď sa registrujem do DB jednej sa mi vše uloži no ale do druhej DB mi nezapíše ID ! V čom može byť chyba ?
CODE:
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<link rel="shortcut icon" href="img/favicon.ico" />
<link rel="stylesheet" type="text/css" media="screen, projection" href="css/master2.css"/>
<?php
$connection = mysql_connect(***)
or die("Connection to the database could not be established");
mysql_select_db("auth") or die ("Database could not be selected");
$mysqluser = mysql_real_escape_string($_POST["mysqluser"]);
$email = mysql_real_escape_string($_POST["email"]);
$pw = mysql_real_escape_string($_POST["pw"]);
$pw2 = mysql_real_escape_string($_POST["pw2"]);
$ip = getenv("REMOTE_ADDR");
$expansion = mysql_real_escape_string($_POST["expansion"]);
if ($mysqluser == "" || $pw != $pw2 || $pw == "" || $email == "")
{
echo"<title>Account Creation - Error</title>
<body>
<center>
<br>
<br>
<br>
<img src=\"img/feildi.png\" title=\"ERROR\" alt=\"ERROR\" />
<br>
All feilds where filled in incorecly!
<br>
<a href=\"index.php\">Back</a>
</center>
</body>";
exit;
}
if (!preg_match('/^[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)*\@[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+(?:\.[^\x00-\x20()<>@,;:\\".[\]\x7f-\xff]+)+$/i', $email))
{
echo '<title>Account Creation - Error</title>
<body>
<center>
<br>
<br>
<br>
<img src="img/emaili.png" title=\"ERROR\"alt=\"ERROR\" />
<br>
<p>Email Address Is Invaild!</p>
<a href="index.php">Back</a>
</center>
</body>';
exit();
}
{
$result = mysql_query("SELECT * FROM account WHERE username LIKE '$mysqluser'");
$menge2 = mysql_num_rows($result);
if ($menge2 == 0)
{
$entry = "INSERT INTO account (username, sha_pass_hash, email, last_ip, expansion) VALUES (UPPER('".$mysqluser."'), SHA1(CONCAT(UPPER('".$mysqluser."'),':',UPPER('".$pw."'))),'".$email."','".$ip."','".$expansion."')";
$enter = mysql_query($entry);
mysql_select_db("auth_wotlk") or die ("Database 2 could not be selected");
$entry2 = $entry;
$enter2 = mysql_query($entry2);
if ($enter == true && $enter2 == true)
{
echo "<title>Account Created</title>
<body>
<br>
<br>
<br>
<center><img src=\"img/success.png\" title=\"Success\" alt=\"Success\" />
<br>
Your Account Was Created!
<br>
<a href=\"index.php\">Back</a>
</center>
</body>";
}
else
{
echo "<title>Account Creation - Error</title>
<body>
<center>
<br>
<br>
<br>
<img src=\"img/errorc.png\" title=\"Connection Error\" alt=\"Connection Error\" />
<br>
There was an error connecting to the server, pleases try again later!
<br>
<br>
<a href=\"index.php\">Back</a>
</center>
</body>";
}
}
else
{
echo "<title>Account Creation - Error</title>
<body>
<br>
<br>
<br>
<center><img src=\"img/accnt.png\" title=\"Account Name Is Taken\" alt=\"Account Name Is Taken\" />
<br>
This account name is allready taken pleases click back and try again!
<br>
<a href=\"index.php\">Back</a>
</center>
</center>
</body>";
}
}
?>