/
checkemail.php
34 lines (27 loc) · 1.05 KB
/
checkemail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
include 'config.php';
if( isset($_POST['username'])){
$conn = db2_connect( $dbname , $username , $password );
if ($conn){
$userName = $_POST['username'];
$userNameQuery = "SELECT COUNT(*) FROM ".$computerName.".USERS WHERE email = '$userName' ";
$stmt = db2_prepare($conn, $userNameQuery);
if ($stmt) {
$result = db2_execute($stmt);
if ($result){
$username_result = db2_fetch_array($stmt);
if($username_result[0] == '0'){
echo 'Username is available';
}
else{
echo 'Sorry, the Username '.$userName.' already exists!';
}
}
else{
db2_stmt_errormsg($stmt);
db2_close($conn);
}
}
}
}
?>