0
<?php
$link = @mssql_connect("-", "-", "-") or die ("Server is down!");
$db = @mssql_select_db('-') or die ("Accout table is missing!");
function doesUsernameExist($name){
    $exit = FALSE;
    $result = @mssql_query("SELECT * FROM Accounttable.. WHERE account='$name'");
    if(mssql_num_rows($result) != 0){
        $exit = TRUE;
    }
    else{
        $exit = FALSE;
    }
    return $exit;
}
if(!isset($_POST['submit'])){
    printSign("");
}
else if(isset($_POST['submit'])){
    $userRev = preg_replace ("[^A-Za-z0-9]", "", $_POST['username']);
    $passRev = preg_replace ("[^A-Za-z0-9]", "", $_POST['password']);
    $day = (int) $_POST['day'];
    $month = (int) $_POST['month'];
    $year = (int) $_POST['year'];
    $email = $_POST['email'];
    if($_POST['username'] == ""){
        printSign("Please enter an username");
    }
    else if($_POST['email'] == ""){
        printSign("Please enter an email");
    }
    else if($_POST['password'] == ""){
        printSign("Please enter an password");
    }
    else if($day == "" || $month == "" || $year == "" || strlen($day) > 2 || strlen($month) > 2 || strlen($year) != 4 || $day == 00 || $month == 00 || $year == 0000){
        printSign("Please enter a correct birthday");
    }
    else if(strlen($_POST['username']) > 15){
        printSign("Your username cannot contain more than 15 characters");
    }
    else if(strlen($_POST['password']) > 36){
        printSign("Your password cannot contain more than 36 characters");
    }
    else if($_POST['username'] != $userRev){
        printSign("Your username contains illegal characters or words");
    }
    else if($_POST['password'] != $passRev){
        printSign("Your password contains illegal characters");
    }
    else if(strlen(filter_var($email, FILTER_VALIDATE_EMAIL)) == 0){ 
        printSign("Your is email is wrong please check it");
    }
    else {
        $userRev = strtolower($userRev);
        $passRev = strtolower($passRev);
        $bday = $month.'/'.$day.'/'.$year;
        $email = $_POST['email'];
        if(!doesUsernameExist($userRev)){
            $stmt = mssql_init('HEREBEINT', $link);
            mssql_bind($stmt, '@account', $userRev, SQLVARCHAR, false, false, 15);
            mssql_bind($stmt, '@password', $passRev, SQLVARCHAR, false, false, 36);
            mssql_bind($stmt, '@birthday', $bday, SQLVARCHAR, false, false, 120);
            mssql_bind($stmt, '@email', $email, SQLVARCHAR, false, false, 120);
            mssql_execute($stmt) or die ("Something is wrong on the execution");
            mssql_free_statement($stmt);
            printSign("<font color='black'>Thank you for registering with the name \"".$userRev."\".</font>");
        }
        else {
            printSign("Username is already taken");
        }
    }
} 

function printSign($error){
    if($error != ""){
        echo $error;
    }
    form code here
}  
?>

i got everything fine, its just its blank, there's no forms of submit button

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by vaultdweller123
0

start quote:

<?php
$link = @mssql_connect("-", "-", "-") or die ("Server is down!");
$db = @mssql_select_db('-') or die ("Accout table is missing!");
function doesUsernameExist($name){
    $exit = FALSE;
    $result = @mssql_query("SELECT * FROM Accounttable.. WHERE account='$name'");
    if(mssql_num_rows($result) != 0){
        $exit = TRUE;
    }
    else{
        $exit = FALSE;
    }
    return $exit;
}
if(!isset($_POST['submit'])){
    printSign("");
}
else if(isset($_POST['submit'])){
    $userRev = preg_replace ("[^A-Za-z0-9]", "", $_POST['username']);
    $passRev = preg_replace ("[^A-Za-z0-9]", "", $_POST['password']);
    $day = (int) $_POST['day'];
    $month = (int) $_POST['month'];
    $year = (int) $_POST['year'];
    $email = $_POST['email'];
    if($_POST['username'] == ""){
        printSign("Please enter an username");
    }
    else if($_POST['email'] == ""){
        printSign("Please enter an email");
    }
    else if($_POST['password'] == ""){
        printSign("Please enter an password");
    }
    else if($day == "" || $month == "" || $year == "" || strlen($day) > 2 || strlen($month) > 2 || strlen($year) != 4 || $day == 00 || $month == 00 || $year == 0000){
        printSign("Please enter a correct birthday");
    }
    else if(strlen($_POST['username']) > 15){
        printSign("Your username cannot contain more than 15 characters");
    }
    else if(strlen($_POST['password']) > 36){
        printSign("Your password cannot contain more than 36 characters");
    }
    else if($_POST['username'] != $userRev){
        printSign("Your username contains illegal characters or words");
    }
    else if($_POST['password'] != $passRev){
        printSign("Your password contains illegal characters");
    }
    else if(strlen(filter_var($email, FILTER_VALIDATE_EMAIL)) == 0){ 
        printSign("Your is email is wrong please check it");
    }
    else {
        $userRev = strtolower($userRev);
        $passRev = strtolower($passRev);
        $bday = $month.'/'.$day.'/'.$year;
        $email = $_POST['email'];
        if(!doesUsernameExist($userRev)){
            $stmt = mssql_init('HEREBEINT', $link);
            mssql_bind($stmt, '@account', $userRev, SQLVARCHAR, false, false, 15);
            mssql_bind($stmt, '@password', $passRev, SQLVARCHAR, false, false, 36);
            mssql_bind($stmt, '@birthday', $bday, SQLVARCHAR, false, false, 120);
            mssql_bind($stmt, '@email', $email, SQLVARCHAR, false, false, 120);
            mssql_execute($stmt) or die ("Something is wrong on the execution");
            mssql_free_statement($stmt);
            printSign("<font color='black'>Thank you for registering with the name \"".$userRev."\".</font>");
        }
        else {
            printSign("Username is already taken");
        }
    }
} 

function printSign($error){
    if($error != ""){
        echo $error;
    }
    form code here
}  
?>

i got everything fine, its just its blank, there's no forms of submit button

Hi
I didn't get your quetion.
Second thing you should make $link variable global when you use it inside another function i.e. you execute sql code.Please given me in brief what you exactly want.

Edited by mike_2000_17: Fixed formatting

0

your problem is "its just its blank, there's no forms of submit button". u mean u only see a blank page, no form and submit button? If my understanding is right? then this is really a comedy.... the answer is quite obvious... i dont see any code of your html form. what you got here is the php receiving end where the data is to be processed.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.