register php

Results 1 to 4 of 4
  1. #1
    Apprentice iphoneman is offline
    MemberRank
    Aug 2012 Join Date
    12Posts

    register php

    Hi all, could someone explain me how to create a registration page and especially how to connect it to my MSSQL, please?
    Last edited by iphoneman; 03-09-13 at 05:08 PM.


  2. #2
    Apprentice iphoneman is offline
    MemberRank
    Aug 2012 Join Date
    12Posts

    Re: register php

    Nobody for help?

  3. #3
    Apprentice Ism3lawy is offline
    MemberRank
    Dec 2012 Join Date
    ИсмаилиLocation
    11Posts

    Re: register php



    i dunno what is database name
    i never tried to make a website for pangya

    so, gimme the
    table names and columns
    then i will help you :D




  4. #4
    French Dev jtb1 is offline
    MemberRank
    Apr 2010 Join Date
    France/GermanyLocation
    278Posts

    Re: register php

    You need use Odbc not mssql :D

    Better way ...

    BUT if you want mssql ...

    I make for you a GENERIC tamplate custom for your table

    <?php
    /*Configuration MSSQL*/
    $myServer = "SD-\SQLEXPRESS"; //Par Defaut :: Nom du pc\SQLEXPRESS
    $myUser = "sa"; //Par Defaut :: sa
    $myPass = "Kiku"; //Par Defaut :: YOUR passord
    $AccountDB = "Pangya_Login"; //Par Defaut :: Your database
    /*Fin de config mssql*/

    /* connection a mssql*/
    mssql_connect($myServer,$myUser,$myPass) or die("Error.");
    mssql_select_db($AccountDB);

    /* Fonction PHP */
    function Anti_Injection($str)
    {
    trim($str);
    if(!preg_match("/^[a-z0-9]+$/i",$str))
    {
    $return = false;
    }
    else
    {
    $return = true;
    }
    return $return;
    }

    function Email_Valide($email)
    {
    if(mb_eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))
    {
    $return = true;
    } else
    {
    $return = false;
    }
    return $return;
    }




    if(!isset($_POST['submit']))
    {
    ?>
    <div class="cbox-ui cbox-title"><center><h2>Inscription</h2></center></div>
    <div class="cbox-ui cbox-content">
    <div class="clearfix"></div>
    <p><center>
    <form class="cmxform" id="regForm" action="http://forum.ragezone.com/?p=register" method="post">
    <p><label><span>Pseudo</span><input type="text" id="username" name="username" class="required" maxlength="15" value="" /></label> <span style="color: green;">* pseudo.</span></p>

    <div class="sep"></div>

    <p><label><span>Mot de passe</span><input type="password" id="password" name="password" class="required password" maxlength="15" /></label> <span style="color: green;">*pass.</span></p>

    <div class="sep"></div>

    <p><label><span>Confirmation</span> <input type="password" id="password2" name="password2" class="required password" maxlength="15" /></label> <span style="color: green;">* same pass.</span></p>

    <div class="sep"></div>

    <p><label><span>E-mail</span> <input type="text" id="email" name="email" class="required email" value="" /></label> <span style="color: green;">* True email please</span></p>
    <br/>
    <br/>
    <p><input type="submit" name="submit" value="Inscription"/></p>
    </form>
    </center>
    </p>
    <div class="clearfix"></div>
    </div>
    <div class="cbox-ui cbox-end"></div>
    <?php
    }
    else
    {
    $username = ($_POST['username']);
    $password = ($_POST['password']);
    $password2 = ($_POST['password2']);
    $email = ($_POST['email']);

    if ((Anti_Injection($username) == FALSE) and (!empty($username)))
    {
    echo "<center>Try to hack ?</center>";
    echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
    }
    if ((Anti_Injection($password) == FALSE) and (!empty($password)))
    {
    echo "<center>Try to hack ?</center>";
    echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
    }
    elseif ((Anti_Injection($password2) == FALSE) and (!empty($password2)))
    {
    echo "<center>Try to hack ?</center>";
    echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
    }
    elseif(Email_Valide($email) == false)
    {
    echo "<center>This is not a email!</center>";
    echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
    }
    else
    {
    $accountquery = mssql_query("SELECT * FROM MYTABLE WHERE account='".$username."'");
    $accountnum = mssql_num_rows($accountquery);
    $emailquery = mssql_query("SELECT * FROM MYTABLE WHERE email='".$email."'");
    $emailnum = mssql_num_rows($emailquery);

    if(empty($password) || empty($password2))
    {
    echo "<center>You Forget the password!</center>";
    echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
    }
    elseif($password != $password2 && $password2 != $password)
    {
    echo "<center>Pass 1 ansd pass 2 are not same !</center>";
    }
    elseif($accountnum != 0)
    {
    echo "<center>This name Exist.</center>";
    echo "<script>setTimeout(\"history.go(-1);\",2000);</script>";
    }
    else
    {
    $sql=("INSERT INTO YOURTABLE(account,password) VALUES ('".$username."','".$pswd.");
    mssql_query($sql) or die ("<center><strong>Error.</strong></center>");

    print('<center>New user :<b> ' . $username . '</b>! <br /> Welcome !</center>');
    }
    }
    }
    ?>



Advertisement