Page 1 of 1

[SOLVED] Checking if user already exists????

Posted: Sun Jun 20, 2004 5:00 am
by ddragas
Why this script doesnt work?
I get warning:
"Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0"

and script is:

Code: Select all

<?php
session_start();
?>
<?php


include("con_db.php");

mysql_select_db("iznajmljivaci") or
die("Nije moguæe pristupiti bazi podataka");

/* provjera dali ulaz veæ postoji */
$sel = "SELECT email FROM iznajmljivaci where email = '$email'"; 
$quer = mysql_query($sel); 
$row = mysql_fetch_array($quer); 
$email = $_SESSION['email'] = $row["email"]; 

// check if email exist

if ($email == "") { 

//insert into database;

} else { 

echo "e-mail already exists";
}
?>

?>

Posted: Sun Jun 20, 2004 5:07 am
by CerIs
Not sure about the error but i you could try something like this instead:

Code: Select all

<?php if(mysql_result(mysql_query("SELECT COUNT(*) FROM affmembers WHERE Username='$Username_f'"), 0))
die (header("Location: affiliates2.php?Error=Sorry this username has allready been taken, please try another."));


?>
Thats one i use and it works pretty well.

Posted: Sun Jun 20, 2004 6:43 am
by ddragas
Thank you