Good day friends , I 'm programming a code for registering new accounts , the code below works for me perfectly , but only need to do, check if the account exists, if the account exists give me a warning, else proceed with the registration.
thanks, waiting for answers = )
thanks, waiting for answers = )
HTML Code:
<form action="reg.php" method="post" id="myform"> <span style="text-align: center"> <label for="login">Login</label> <input id="login" name="login" class="text" /> </span> <span style="text-align: center"> <label for="pass">Password</label> <input id="pass" name="pass" class="password" /> </span> <span style="text-align: center"> <input type="image" src="images/sendButton.png" class="send" /> </span> <div class="clr"></div> </form>
PHP Code:
<?php
$login = $_REQUEST["login"];
$pass = $_REQUEST["pass"];
$md5_key = '5dd23';
$endPw = $md5_key . $pass;
$md5 = md5($endPw);
$serverName = "localhost";
$uid = "admin";
$pwd = "123456789";
$databaseName = "auth";
$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd,
"Database"=>$databaseName);
/* Connect using SQL Server Authentication. */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$tsql = "insert into dbo.Accounts (login_name, password, block, withdraw_remain_time, age, auth_ok, pcbang, last_login_server_idx, referral_id, referral_code, server_list_mask) values ('$login','$md5','0','0','18','1','1','1','0','0','0')";
/* Execute the query. */
$stmt = sqlsrv_query( $conn, $tsql);
if ( $stmt )
{
$something = "Submission successful.";
}
else
{
$something = "Submission unsuccessful.";
die( print_r( sqlsrv_errors(), true));
}
$output=$something;
/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>