Quantcast

NE SHWATAM !!!! PHP POMOC

D-Devil992

Zainteresovan član
Poruka
194
E pogledajte ovaj kod, ne znam zasto radi owako, a zasto nece kad ispravim:

Kod:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$confpassword = $_POST['confpassword'];
$email = $_POST['email'];
$ip = $_SERVER['REMOTE_ADDR'];
mysql_connect('localhost','root','humanfist992') or die('Server connection failed');
mysql_select_db('RegLog') or die('Database connection failed');
$ipcheck = mysql_query("SELECT * FROM users WHERE ip = '$ip'");
$ipcheckrun = mysql_fetch_array($ipcheck);
$emailcheck = mysql_query("SELECT * FROM users WHERE email = '$email'");
$emailcheckrun = mysql_fetch_array($emailcheck);
[U]$usernamecheck = mysql_query("SELECT * FROM users WHERE 'username' = 'username'");[/U]
$usernamecheckrun = mysql_fetch_array($usernamecheck);

if (empty($username) || empty($password) || empty($confpassword) || empty($email) || $_POST['ip'] = $ipcheckrun['ip'] || $_POST['email'] = $emailcheckrun['email'] || $_POST['username'] = $usernamecheckrun['username'] || $password <> $confpassword || !preg_match("/^([a-zA-Z0-9])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/",$_POST['email'])) 
{
	include 'Registration.php';	
	
if (empty($username)) 
{
	echo "<font color = 'red'>Please fill in the username form!<font/><br/>";
	
}
if (empty($password)) 
{
	echo "<font color = 'red'>Please fill in the password form!<font/><br/>";
	
}
if (empty($confpassword)) 
{
	echo "<font color = 'red'>Please fill in the password confirm form!<font/><br/>";
	
}
if (empty($email)) 
{
	echo "<font color = 'red'>Please fill in the e-mail form!<font/><br/>";
}
if ($ip = $ipcheckrun['ip']) 
{
	echo "<font color = 'red'>Your IP Address is already in the database!<font/><br/>";
}	
if ($email = $emailcheckrun['email']) 
{
    echo "<font color = 'red'>E-Mail Adress is already in the database!<font/><br/>";
} 
if ($username = $usernamecheckrun['username'])
{
echo "<font color = 'red'>Screen Name is taken!<font/><br/>";  
}
if ($password <> $confpassword) 
{
	echo "<font color = 'red'>Passwords do not match!<font/><br/>";
}
if (!preg_match("/^([a-zA-Z0-9])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/",$_POST['email']))
{ 
echo "<font color = 'red'>Invalid email format!<font/><br/>"; 
}
}else{
mysql_query("INSERT INTO users (username, password, email, ip) VALUES ('$username','$password','$email','$ip')") or die(mysql_error());	
echo "You have successfully created your account, please go to login page!";



}



?>

Pogledajte podvuceno: kad stavim 'username'= '$username' radi, ali kad stavim username ='$username' nece, al kad to isto uradim za email i ip koji se potpuni isto citaju, radi? Dal to ima veze zbog znakova ili ??? O.o
 

Top
  Blokirali ste reklame
Dragi prijatelju, nemojte da blokirate reklame - isključite Ad Blocker na Forumu, jer će tako mesto vaših susreta na Krstarici ostati besplatno za korišćenje.