reg.php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    reg.php

    am here coding a registration page but am kinda stuck i neeed an error that shows that the name is already taken.....i do have one but when u register it a name thats not already there it still says already exits here is my coding please help out



    <?php
    include("utils.php");
    include("tbc.php");
    //include("functions.php");
    echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"http://chillblock.wapdesire.com/nt4_us/teamblaze_css\" />";

    echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";

    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";


    ?>






    <?php


    $login = $_POST["login"];
    $pass = $_POST["pass"];
    $email = $_POST["email"];


    echo "<head>";

    echo "<link rel=\"icon\" type=\"favicon_ico\" href=\"http://chillblock.wapdesire.com/nt4_us/img/teamblaze.ico\" />";


    echo "<title>NT4.us - mobile wapsite creator/Mobile site builder</title>";

    echo "</head>";

    echo "<p align=\"center\">";

    if($_POST["login"] == '' || $_POST["pass"] == ''|| $_POST["email"] == '' )
    {
    $error = "<img src=\"img/no.gif\" alt=\"\"/> Please Fill out all the fields";
    }
    else if(strlen($_POST["login"]) < 4)
    {
    $error = "<img src=\"img/no.gif\" alt=\"\"/> Username - (sitename) must be 4 characters or more";
    }
    else if(strlen($_POST["pass"]) <4)
    {
    $error = "<img src=\"img/no.gif\" alt=\"\"/> Password must be 4 characters or more";

    }

    else if(!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $_POST['email']))
    {

    $error = "<img src=\"img/no.gif\" alt=\"\"/> Please provide a valid email address";

    }
    else if($_POST["login"])
    {
    $error = "<img src=\"img/no.gif\" alt=\"\"/> Username - (sitename) is already taken, please try again";


    }else{

    mysql_query('INSERT INTO users (login, pass, email) VALUES ("' . addslashes($_POST['login']) . '", "' . md5($_POST['pass']) . '", "' . addslashes($_POST['email']) . '")');
    $uid = mysql_insert_id();


    echo "<img src=\"img/yes.gif\" alt=\"\"/> Site created successfully<br/>---<br/>";
    echo "<p>";

    echo "Site url: <b>$login$hostname</b><br/>";

    echo "Password: <b>$pass</b><br/>";

    echo "Email Address: <b>$email</b><br/>---<br/>";

    echo "<a href=\"sitepanel.php\">Site Manager/Admin Control</a><br/>";


    echo "</p>";
    }


    echo "$error";

    echo "</p>";




    ?>

    #2
    i will give you a simple example:

    $does_it_exits = mysql_fetch_array(mysql_query("select count (*) from users where login = '".$login."' "));
    if ($does_it_exits[0] > "0") { echo "User exist!"; exit(); }
    mysterio.al - programming is a functional art

    Comment


      #3
      ok bro let me test that...

      Comment


        #4
        i keep getting this error

        Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/chill/public_html/nt4_us/reg.php on line 38

        and the table is in the sql.

        Comment


          #5
          wat part of ur code is the error?
          com site: http://vampist.net
          download site: http://wapdloads.net
          fb: http://www.facebook.com/pmplx

          Comment


            #6
            exist = mysql_fetch_array(mysql_query("SELECT count (*) from users where login = '".$login."' "));


            there

            Comment


              #7
              Are they right tables in there !! ?? !!
              Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
              Visit: WapMasterz Coming Back Soon!
              _______
              SCRIPTS FOR SALE BY SUBZERO
              Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
              FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
              _______
              Info & Tips
              php.net
              w3schools.com

              Comment


                #8
                yes it is i dont know y am getting that error

                Comment


                  #9
                  i think 1 of there dont have value.
                  Did I help you?
                  You can help me too
                  Your donations will help me finance my studies.

                  Comment


                    #10
                    i fixed it am now on the login page

                    Comment


                      #11
                      then that's good
                      Did I help you?
                      You can help me too
                      Your donations will help me finance my studies.

                      Comment


                        #12
                        yeah functions kinda giving me problems atm

                        Comment

                        Working...
                        X