SitePoint Sponsor

User Tag List

Page 7 of 12 FirstFirst ... 34567891011 ... LastLast
Results 151 to 175 of 295
  1. #151
    Yugo full of anvils bronze trophy hillsy's Avatar
    Join Date
    May 2001
    Location
    :noitacoL
    Posts
    1,859
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, the code in question is:

    PHP Code:
    $uid = isset($_POST['uid']) ? $_POST['uid'] : $_SESSION['uid'];
    $pwd = isset($_POST['pwd']) ? $_POST['pwd'] : $_SESSION['pwd']; 
    Both of these ($uid and $pwd) are strings. So if I set them both to empty strings first, this problem should go away?

    That seems a bit odd, seeing as the code above is setting them anyway. Or am I missing something?

    Do you have to declare variables in PHP before you can use them? For example in ASP you have to use dim, and in CF you have to use <cfset>. Seems like with PHP you can just get in there and start assigning values to them
    that's me!
    Now A Pom. And a Plone Nut
    Broccoli Martinez Airpark

  2. #152
    SitePoint Member whanke's Avatar
    Join Date
    May 2003
    Location
    Missouri (aka Mizery)
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In 6 pages of this thread not once did anyone mention a logout.php script. Anyone have any such thing? Perhaps one that logs the user out and throws them back to the login page? or your home page?

  3. #153
    ********* Member website's Avatar
    Join Date
    Oct 2002
    Location
    Iceland
    Posts
    1,238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hillsy
    OK, the code in question is:

    PHP Code:
    $uid = isset($_POST['uid']) ? $_POST['uid'] : $_SESSION['uid'];
    $pwd = isset($_POST['pwd']) ? $_POST['pwd'] : $_SESSION['pwd']; 
    Both of these ($uid and $pwd) are strings. So if I set them both to empty strings first, this problem should go away?

    That seems a bit odd, seeing as the code above is setting them anyway. Or am I missing something?

    Do you have to declare variables in PHP before you can use them? For example in ASP you have to use dim, and in CF you have to use <cfset>. Seems like with PHP you can just get in there and start assigning values to them
    Well, no, this error should only come if you are trying to 'use' a variable/index that isn't set, say you haven't declared $var1['test'] then this code
    PHP Code:
    $var2 $var1['test'
    will print out the error. So in your case I would think that $_SESSION['uid'] isn't set, but you are trying to assign $_SESSION['uid'] to $uid and I would think that is causing the error, as it says Undefined index which means that the index in the array ($_SESSION is the array, uid and pwd are the indexes) aren't set, they don't exist. Could that be? Try placing
    PHP Code:
    print_r($_SESSION); 
    before these lines come and see exactly what indexes are set.
    - website

  4. #154
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    lisboa
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by whanke
    In 6 pages of this thread not once did anyone mention a logout.php script. Anyone have any such thing? Perhaps one that logs the user out and throws them back to the login page? or your home page?
    i use this:
    PHP Code:
    <?php
      session_start
    ();
      unset(
    $_SESSION['nome']);
     unset(
    $_SESSION['pp']);
      
    session_destroy();
     
    $expiry 60*60*24*365;
      
    setcookie('nome'$nometime()-$expiry"/" ); 
      
    setcookie('pp'$pptime()-$expiry"/" );
     echo 
    "<script language=\"JavaScript\">parent.location='logout2.php?action=logout'</script>";
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "[url=http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd[/url]">
    <html xmlns="[url=http://www.w3.org/1999/xhtml]http://www.w3.org/1999/xhtml[/url]">
    <head>
    <title>logout</title>
    <link rel = "Stylesheet" type="text/css" href = "phpb.css" />
    <meta http-equiv="Content-type"
    content="text/html; charset=ISO-8859-1" />
    </head>
    <body>
    </body>
    </html>
    and then send him to a page simply saying:
    your session is ended.
    the good part about the above script is that even if you try to use the go back button, you cant reenter the protected pages (in case you have them)

  5. #155
    SitePoint Member whanke's Avatar
    Join Date
    May 2003
    Location
    Missouri (aka Mizery)
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    perfect. I'll try it out later this evening. thanks.

    will
    www.techlh.com

  6. #156
    Anonymous
    SitePoint Community Guest
    right on

  7. #157
    SitePoint Member
    Join Date
    Oct 2002
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great article and most of it works. But when I use my ID and password I get the message from the db.php file saying that the site database is unavailable. Does anyone have an idea about the explanation for that.

  8. #158
    SitePoint Member
    Join Date
    Oct 2002
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Even though it is a bit embarrasing I have to say that I myself found out what was wrong - so that you good people do not waste time on helping me. I had forgotten to change the second appearence of my database to the real name. What a good nigth´s sleep can do!

  9. #159
    Anonymous
    SitePoint Community Guest
    Es perfecto!! llevo mucho tiempo buscando un sistema de usuarios y lo encontre!!!

  10. #160
    Anonymous
    SitePoint Community Guest
    The best!!!! one question only...

    how can I do to view all users???

    Thanks a lot!

  11. #161
    SitePoint Member Rinoa's Avatar
    Join Date
    Jul 2003
    Location
    spain
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Hi!! ^^ It's perfect your managing users with php sessions tutorial !!!

    One question only.. how can I do a user list? to explain all users in my web and that all people can see them.

    Thanks a lot

    Rinoa

  12. #162
    SitePoint Member Rinoa's Avatar
    Join Date
    Jul 2003
    Location
    spain
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation

    I make this:
    PHP Code:
    <?php include 'accesscontrol.php'?>
    <html>
    <head>
    <title>Documento sin t&iacute;tulo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>

    <div align="center">
      <table width="287" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr> 
          <td> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border: 1 solid #000000">
              <tr> 
                <td bgcolor="#508BC7" colspan="2"> <div align="center"> <font color="#FFFFFF"><strong>Usuarios</strong></font></div></td>
              </tr>
              <tr> 
                <td bgcolor="#FFFFFF" colspan="2"> <table width="343" border="0" cellspacing="0" cellpadding="0" align="center">
                    <tr bgcolor="#F0F8FF"> 
                      <td width="11%"><strong><font face="Arial, Helvetica, sans-serif"><font size="2">ID</font></font></strong></td>
                      <td width="46%"><strong><font face="Arial, Helvetica, sans-serif"><font size="2">Usuario</font></font></strong></td>
                      <td width="43%"><strong><font face="Arial, Helvetica, sans-serif"><font size="2">Web</font></font></strong></td>
                    </tr>
                    <tr align="left" valign="top"> 
                      <td colspan="3"> <font face="Arial, Helvetica, sans-serif"><strong><font size="1"> 
                        <?
                    $masID 
    mysql_db_query ("mydb","SELECT * from user order by ID LIMIT 1000")or die(mysql_error());
                    while (
    $row mysql_fetch_array($masID)){
                    
    $ID "$row[ID]";
                    
    $userid "$row[userid]";
                    
    $web "$row[web]";
                    print 
    "<tr><td>$ID</td><td>$userid</td><td>$web</td></tr>";
                    }
                    
                    
    ?>
                        </font></strong></font></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table>
    </div>
    </body>
    </html>
    It's very easy and work perfect

  13. #163
    SitePoint Member
    Join Date
    Jul 2003
    Location
    n.ireland
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi! this has made me learn alot, am still new to php and sql!
    but am trying to convert this script to work on wap (wml)

    i have got it all working apart from the register page, i just cant it to work! when the wap register page is filled in and the submit button is pressed it just reloads the signup.php page, so what i need to know is where should the info form the from on the signup.php page be sent??

    the html part is:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <title> New User Registration </title>
      <meta http-equiv="Content-Type"
        content="text/html; charset=iso-8859-1
    </head>
    <body>
    
    <h3>New User Registration Form</h3>
    <p><font color="orangered" size="+1"><tt><b>*</b></tt></font>
       indicates a required field</p>
    <form method="post" action="<?=$_SERVER['PHP_SELF']?>">
    <table border="0" cellpadding="0" cellspacing="5">
        <tr>
            <td align="right">
                <p>User ID</p>
            </td>
            <td>
                <input name="newid" type="text" maxlength="100" size="25" />
                <font color="orangered" size="+1"><tt><b>*</b></tt></font>
            </td>
        </tr>
        <tr>
            <td align="right">
                <p>Full Name</p>
            </td>
            <td>
                <input name="newname" type="text" maxlength="100" size="25" />
                <font color="orangered" size="+1"><tt><b>*</b></tt></font>
            </td>
        </tr>
        <tr>
            <td align="right">
                <p>E-Mail Address</p>
            </td>
            <td>
                <input name="newemail" type="text" maxlength="100" size="25" />
                <font color="orangered" size="+1"><tt><b>*</b></tt></font>
            </td>
        </tr>
    <td align="right">
                <p>Password</p>
            </td>
            <td>
                <input name="newpass" type="text" maxlength="100" size="25" />
                <font color="orangered" size="+1"><tt><b>*</b></tt></font>
            </td>
        </tr>
        <tr valign="top">
            <td align="right">
                <p>Other Notes</p>
            </td>
            <td>
                <textarea wrap="soft" name="newnotes" rows="5" cols="30"></textarea>
            </td>
        </tr>
        <tr>
            <td align="right" colspan="2">
                <hr noshade="noshade" />
                <input type="reset" value="Reset Form" />
                <input type="submit" name="submitok" value="   OK   " />
            </td>
        </tr>
    </table>
    </form>
    
    </body>
    </html>
    which works fine and sends the info back to signup.php

    so my wap (wml) version would be some thing like this:
    PHP Code:
    <?php
    header
    ("Content-type: text/vnd.wap.wml"); 
    include(
    "headerwml.php");
    echo 
    "<wml>";
    echo 
    "<card id=\"WAPchat\" title=\"RelaxWap\">";   
    echo 
    "<p align=\"center\">";
    echo 
    "<strong>wap3</strong><br/>";  
    echo 
    "New User Registration <br/>";


    echo 
    "User ID:<br/>";
    echo 
    "<input name=\"newid\" type=\"text\" maxlength=\"7\"/><br/>";
    echo 
    "Full Name:<br/>";   
    echo 
    "<input name=\"newname\" type=\"text\" maxlength=\"15\"/><br/>";
    echo 
    "E-Mail address:<br/>";   
    echo 
    "<input name=\"newemail\" type=\"text\" maxlength=\"30\"/><br/>";
    echo 
    "password:<br/>";   
    echo 
    "<input name=\"newpass\" type=\"password\" maxlength=\"15\"/><br/>";
    echo 
    "other notes::<br/>";   
    echo 
    "<input name=\"newnotes\" type=\"text\" maxlength=\"30\"/><br/>";   
    echo 
    "<do type=\"accept\">";
    echo 
    "<go href=\"{$_SERVER['PHP_SELF']}\" name=\"submitok\" sendreferer=\"true\" method=\"post\">";
    echo 
    "<postfield name=\"newid\" value=\"$(newid)\"/>";
    echo 
    "<postfield name=\"newname\" value=\"$(newname)\"/>";
    echo 
    "<postfield name=\"newemail\" value=\"$(newemail)\"/>";
    echo 
    "<postfield name=\"newpass\" value=\"$(newpass)\"/>";
    echo 
    "<postfield name=\"newnotes\" value=\"$newnotes\"/>";
    echo 
    "</go>";
    echo 
    "</do>";
    echo 
    "</p>";
    echo 
    "</card>";  
    echo 
    "</wml>";   
    ?>
    which just doesnt do the job of registering the person!!! which is strange because the login script works:
    PHP Code:
    <?php
    header
    ("Content-type: text/vnd.wap.wml"); 
    include(
    "headerwml.php");
    echo 
    "<wml>";
    echo 
    "<card id=\"WAPchat\" title=\"RelaxWap\">";   
    echo 
    "<p align=\"center\">";
    echo 
    "<strong>wap1</strong><br/>";  
    echo 
    "Login Required<br/>";
    echo 
    "You must log in to access this site.<br/>";
    echo 
    "If you are not a registered user<br/>"
    echo 
    "<a title=\"Enter\" href=\"signup.php\">click here</a><br/>\n";

    echo 
    "User ID:<br/>";
    echo 
    "<input type=\"text\" name=\"uid\" size=\"8\"/>";
    echo 
    "<br/>";
    echo 
    "Password:<br/>";
    echo 
    "<input type=\"password\" name=\"pwd\" size=\"8\"/>";
    echo 
    "<br/>";
    echo 
    "<anchor title=\"Log in\">Log in";
    echo 
    "<go href=\"index.php\" method=\"post\">";
    echo 
    "<postfield name=\"uid\" value=\"$(uid)\"/>";
    echo 
    "<postfield name=\"pwd\" value=\"$(pwd)\"/>";
    echo 
    "</go>";
    echo 
    "</anchor>";
    echo 
    "</p>";
    echo 
    "</card>";  
    echo 
    "</wml>";   
    ?>
    please can some one tell me why the register part doesnt work purely on a php side if thats the case...
    thanx in advance (and sorry for the mass of code!)
    -gavin

  14. #164
    Anonymous
    SitePoint Community Guest
    i think that this is a good article. However, i have to read twice to understand many things. But compliments to the writer

  15. #165
    Anonymous
    SitePoint Community Guest
    kick ass!

  16. #166
    Anonymous
    SitePoint Community Guest
    hi
    Thes Good Article

    I am Love PHP

  17. #167
    SitePoint Addict sporkit's Avatar
    Join Date
    Jan 2003
    Location
    DeKalb, IL
    Posts
    290
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is by far the most usefull article I have ever read in the world of PHP scripting. From this code I have been able to work all kinds of usefull logins into my pages. Thanks!

  18. #168
    SitePoint Member
    Join Date
    Aug 2003
    Location
    US & France
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi everybody

    like many of you i'm really new to all this, but kevin's article is so clear that after reading and studying it several times and trying out the script (knowing nothing about php and never creating a database with mysql) i got things going.

    using my web host's server (php v. 4.3.2 and mysql 4.0.13) the signup.php sends out the email with username and password, then the email refers back to accesscontrol.php where we login...everything works great. But try to login and...nothing. the first time i tried it i went to the protectedpage.php. as should be. but never again. now all i see in the browser is the accesscontrol.php address, and the source code is completely empty.

    i've looked all through the forum related to "managing users" and haven't found anything related to this problem. anybody have a suggestion?

    thanks

    mac

  19. #169
    SitePoint Author Kevin Yank's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne, Australia
    Posts
    2,571
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Mac,

    You should not be sending the address of accesscontrol.php to your users, nor should they type the address to it in their browsers.

    Instead, the user should go directly to protectedpage.php. If he or she is not logged in, that page will display the form contained in accesscontrol.php, prompting them to log in. When the login attempt is successful, the contents of protectedpage.php will be displayed.

    accesscontrol.php is a script that works behind the scenes to protect other PHP scripts. It should never be loaded directly, because once a user is logged in, it has nothing to display!
    Kevin Yank
    CTO, sitepoint.com
    I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
    Baby’s got back—a hard back, that is: The Ultimate CSS Reference

  20. #170
    SitePoint Member
    Join Date
    Aug 2003
    Location
    US & France
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    told you i was new - works like a charm - thanks kevin!

  21. #171
    SitePoint Member
    Join Date
    Aug 2003
    Location
    US & France
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi again Kevin,

    trying out this code, i just got this error :

    Fatal error: Call to undefined function: html_header() in /home/***/public_html/**/pwchange.php on line 5

    using php v. 4.3.2.

    thanks

    mac

  22. #172
    SitePoint Member
    Join Date
    Aug 2003
    Location
    US & France
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry didn't copy - referring to your "Simple just-lying-around code submitted for your inspection:" to change password post #56 from Dec 2, 2002, 09:32

    <?
    include('accesscontrol.php');

    if ($chgpw == "" ):
    html_header(); // Print standard page header
    ?>
    <p>This page will become a little more functional later,
    but for now you can change your password if you wish/p>
    <form action="<?=$PHP_SELF?>" method=post>
    <center>
    <table border=0 cellpadding=0 cellspacing=0>
    <tr>
    <td align=right><p>New password: <input
    type=password name=newpw></td>
    </tr>
    <tr>
    <td align=right><p>Retype: <input type=password
    name=newpw2></td>
    </tr>
    <tr>
    <td align=right><input type=submit name=chgpw
    value=" OK "></td>
    </tr>
    </table>
    </form>
    <?
    else:
    if ($newpw != $newpw2) {
    error_message("The two password fields did
    not match! Please try again." );
    }
    if ($newpw == "" ) {
    error_message("You did not provide a
    password. Please try again." );
    }
    $sql = "UPDATE user SET password=PASSWORD('$newpw')
    WHERE userid='$userid'";
    if (mysql_query($sql)):
    // Update the password in the user's session
    $userpassword=$newpw;
    html_header();
    ?>
    <p><STRONG>Password change successful!</STRONG></p>
    <p>Your password has been changed! Click
    <a href="index.php">here</a> to return to the main page of
    the Web site.</p>
    <?
    else:
    error_message("A database error occurred
    while processing your request.\\nIf the problem persists,
    please contact you@email.com.\\n".
    mysql_error());
    endif;
    endif;
    html_footer();
    ?>

  23. #173
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    London
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy sessions question

    Hi there I'm working in something similar which doesn't involve users but involves sessions. I'm trying to carry a few variables through a small bi-lingual cms system... The first variable that I needed to carry was the language preference, was unsure to whether I should use $_COOKIE or $_SESSION to do it and decided to do it with $_SESSION so if anyone has cookies turned off still works...

    anyway this is what I've got so far there are a couple of things that I'm not quite sure how to do them :

    PHP Code:

    <?php
    #if received a request to change language reset $_SESSION['dataBaseTable']
    if (isset($_GET['changeLang'])) {
    # session start
    session_start();
      
    $_SESSION['dataBaseTable'] = "portfolioG_".$_GET['changeLang'];
      
    header ("Location: ".$_SERVER['PHP_SELF'] );
      
      
    /*if I don't refresh the page the change is not immediately reflected*/
    }

    /* this doesn't seem right but is the only solution i could think of if someone hasn't got an active session*/

    # check  whether the session is alive
    # session start
    session_start();
    if (!isset(
    $_SESSION['dataBaseTable'])) {
      
    header ("Location: ".$_SERVER['PHP_SELF']."?changeLang=en" );
      }

    /* this doesn't work and sets off and endless loop..... */ 

    # check  wheter the session is alive if not alert
     
    if (!isset($_COOKIE['PHPSESSID'])) {
      echo (
    "no cookies enhabled!!");
      exit;
      }
      
    #print all cookies for tracking
    print_r($_COOKIE);

    ?>

    <!-- this are just to testing links to switch the value of the cookie therefore the value of $_SESSION['dataBaseTable'] -->
    <br />
    <a href="<?php echo $_SERVER['PHP_SELF']."?changeLang=es" ?>">change to spanish</a>

    <a href="<?php echo $_SERVER['PHP_SELF']."?changeLang=en" ?>">change to english</a>

    <br /><a href="<?php echo $_SERVER['PHP_SELF'?>">reload</a>

    <br /><br /><br /><hr>
    and then pull the data from the database selected. I'm I doing this the right way?

    The other problem I've found is that if I turn cookies of in my browser (Safari), nothing works.. I thought session would be stored on the server /tmp is cookies were not available...

    I've checked php.ini and everything seems to be in order..

    do I have to refer to <?SID?> if the cookie is not avail??

    session.use_trans_sid=1
    session.use_cookies=On
    session.save_handler=files
    session.save_path=/tmp

    any help would be greatly appreciated

  24. #174
    SitePoint Zealot
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    does anyone know how to send a e-mail after a sign up

    hello can anyone help me with, sending a e-mail to a user with there new password and the user name:

    here's my code which does not yet do the e-mail after sign -up

    register.php

    <?php
    include("config.php");
    if($loged=='yes')
    {
    echo "$lang[registerloged]";
    }
    else
    {
    ?>
    <style type="text/css">
    <!--
    @import url("form.css");
    @import url("form.css");
    @import url("style.css");
    -->
    </style>
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <img src="http://www.copyexpress.ca/Images/Customer%20Login.JPG">
    <form action="reg.php" method="post" class="fieldcell">
    <div align="left">First name:
    <input name="fname" type="text" class="fieldcell" size="30">
    <BR>
    Last name:
    <input name="sname" type="text" class="fieldcell" size="30">
    <BR>
    Company Name:
    <input name="businesstype" type="text" class="fieldcell" size="30">
    <BR>
    Address:
    <input name="address1" type="text" class="fieldcell" size="30">
    <BR>
    City:
    <input name="city" type="text" class="fieldcell" size="30">
    <BR>
    Province/State:
    <select name="province" class="fieldcell">
    <option value="ON">Ontario</option>
    <option value="AB">Alberta</option>
    <option value="BC">British Columbia</option>
    <option value="MB">Manitoba</option>
    <option value="NB">New Brunswick</option>
    <option value="NF">Newfoundland</option>
    <option value="NT">Northwest Territories</option>
    <option value="NS">Nova Scotia</option>
    <option value="NU">Nunavut</option>
    <option value="PE">Prince Edward Island</option>
    <option value="QC">Quebec</option>
    <option value="SK">Saskatchewan</option>
    <option value="YT">Yukon</option>
    <option value="AL">Alabama</option>
    <option value="AK">Alaska</option>
    <option value="AR">Arkansas</option>
    <option value="CA">California</option>
    <option value="CO">Colorado</option>
    <option value="DE">Delaware</option>
    <option value="DC">District of Coumbia</option>
    <option value="FL">Florida</option>
    <option value="GA">Georgia</option>
    <option value="HI">Hawaii</option>
    <option value="ID">Idaho</option>
    <option value="IL">Illinois</option>
    <option value="IN">Indiana</option>
    <option value="IA">Iowa</option>
    <option value="LA">Louisiana</option>
    <option value="ME">Maine</option>
    <option value="MD">Maryland</option>
    <option value="MA">Massachusetts</option>
    <option value="MI">Michigan</option>
    <option value="MS">Mississippi</option>
    <option value="MN">Minnesota</option>
    <option value="MO">Missouri</option>
    <option value="MT">Montana</option>
    <option value="NE">Nebraska</option>
    <option value="NV">Nevada</option>
    <option value="NH">New Hampshire</option>
    <option value="NJ">New Jersey</option>
    <option value="NM">New Mexico</option>
    <option value="NY">New York</option>
    <option value="ND">North Dakota</option>
    <option value="OH">Ohio</option>
    <option value="OK">Oklahoma</option>
    <option value="OR">Oregon</option>
    <option value="PA">Pennsylvania</option>
    <option value="SC">South Carolina</option>
    <option value="SD">South Dakota</option>
    <option value="TN">Tennessee</option>
    <option value="TX">Texas</option>
    <option value="UT">Utah</option>
    <option value="VT">Vermont</option>
    <option value="WA">Washington</option>
    <option value="VA">Virginia</option>
    <option value="WA">West Virginia</option>
    <option value="WY">Wyoming</option>
    </select>
    <BR>
    Country:
    <select name="country" class="fieldcell">
    <option value="CA">Canada</option>
    <option value="US">United States</option>
    <option value="AF">Afghanistan</option>
    <option value="AL">Albania</option>
    <option value="DZ">Algeria</option>
    <option value="AS">American Samoa</option>
    <option value="AD">Andorra</option>
    <option value="AO">Angola</option>
    <option value="AI">Angular</option>
    <option value="AQ">Antarctica</option>
    <option value="AG">Antigua and Barbuda</option>
    <option value="AR">Argentina</option>
    <option value="AM">Armenia</option>
    <option value="AW">Aruba</option>
    <option value="AU">Australia</option>
    <option value="AT">Austria</option>
    <option value="AZ">Azerbaijan</option>
    <option value="BS">Bahamas</option>
    <option value="BH">Bahrain</option>
    <option value="BD">Bangladesh</option>
    <option value="BB">Barbados</option>
    <option value="BY">Belarus</option>
    <option value="BE">Belgium</option>
    <option value="BZ">Belize</option>
    <option value="BJ">Benin</option>
    <option value="BM">Bermuda</option>
    <option value="BT">Bhutan</option>
    <option value="BO">Bolivia</option>
    <option value="BA">Bosnia and Herzegovina</option>
    <option value="BW">Botswana</option>
    <option value="BV">Buffet Island</option>
    <option value="BR">Brazil</option>
    <option value="IO">British Indian Ocean Territory</option>
    <option value="BN">Brunei Arousal</option>
    <option value="BG">Bulgaria</option>
    <option value="BF">Burkina Faso</option>
    <option value="BI">Burundi</option>
    <option value="KH">Cambodia</option>
    <option value="CM">Cameroon</option>
    <option value="CV">Cape Verde</option>
    <option value="KY">Cayman Islands</option>
    <option value="CF">Central African Republic</option>
    <option value="TD">Chad</option>
    <option value="CL">Chile</option>
    <option value="CN">China</option>
    <option value="CX">Christmas Island</option>
    <option value="CC">Coco's (Keeling) Islands</option>
    <option value="CO">Colombia</option>
    <option value="KM">Comoros</option>
    <option value="CG">Congo</option>
    <option value="CD">Congo, Democratic Republic</option>
    <option value="CK">Cook Islands</option>
    <option value="CR">Costa Rica</option>
    <option value="CI">Cote divorce</option>
    <option value="HR">Croatia</option>
    <option value="CU">Cuba</option>
    <option value="CY">Cyprus</option>
    <option value="CZ">Czech Republic</option>
    <option value="DK">Denmark</option>
    <option value="DJ">Djibouti</option>
    <option value="DM">Dominica</option>
    <option value="DO">Dominican Republic</option>
    <option value="TP">East Timor</option>
    <option value="EC">Ecuador</option>
    <option value="EG">Egypt</option>
    <option value="SV">El Salvador</option>
    <option value="GQ">Equatorial Guinea</option>
    <option value="ER">Eritrea</option>
    <option value="EE">Estonia</option>
    <option value="ET">Ethiopia</option>
    <option value="FK">Falkland Islands (Malians)</option>
    <option value="FO">Faeroe Islands</option>
    <option value="FJ">Fiji</option>
    <option value="FI">Finland</option>
    <option value="FR">France</option>
    <option value="GF">French Guiana</option>
    <option value="PF">French Polynesia</option>
    <option value="TF">French Southern Territories</option>
    <option value="GA">Gabon</option>
    <option value="GM">Gambia</option>
    <option value="GE">Georgia</option>
    <option value="DE">Germany</option>
    <option value="GH">Ghana</option>
    <option value="GI">Gibraltar</option>
    <option value="GR">Greece</option>
    <option value="GL">Greenland</option>
    <option value="GD">Grenada</option>
    <option value="GP">Guadeloupe</option>
    <option value="GU">Guam</option>
    <option value="GT">Guatemala</option>
    <option value="GN">Guinea</option>
    <option value="GW">Guinea-Bissau</option>
    <option value="GY">Guyana</option>
    <option value="HT">Haiti</option>
    <option value="HM">Heard Island and McDonald Islands</option>
    <option value="VA">Holy See (Vatican City State)</option>
    <option value="HN">Honduras</option>
    <option value="HK">Hong Kong</option>
    <option value="HU">Hungary</option>
    <option value="IS">Iceland</option>
    <option value="IN">India</option>
    <option value="ID">Indonesia</option>
    <option value="IR">Iran, Islamic Republic</option>
    <option value="IQ">Iraq</option>
    <option value="IE">Ireland</option>
    <option value="IL">Israel</option>
    <option value="IT">Italy</option>
    <option value="JM">Jamaica</option>
    <option value="JP">Japan</option>
    <option value="JO">Jordan</option>
    <option value="KZ">Kazakhstan</option>
    <option value="KE">Kenya</option>
    <option value="KI">Kiribati</option>
    <option value="KP">Korea, Democratic People's Republic</option>
    <option value="KR">Korea, Republic of</option>
    <option value="KW">Kuwait</option>
    <option value="KG">Kurdistan</option>
    <option value="LA">Lao People's Democratic Republic</option>
    <option value="LV">Latvia</option>
    <option value="LB">Lebanon</option>
    <option value="LS">Lesotho</option>
    <option value="LR">Liberia</option>
    <option value="LY">Libyan Arab Amah</option>
    <option value="LI">Liechtenstein</option>
    <option value="LT">Lithuania</option>
    <option value="LU">Luxembourg</option>
    <option value="MO">Mac au</option>
    <option value="MK">Macedonia, Former Yugoslav Republic</option>
    <option value="MG">Madagascar</option>
    <option value="MW">Malawi</option>
    <option value="MY">Malaysia</option>
    <option value="MV">Maldives</option>
    <option value="ML">Mali</option>
    <option value="MT">Malta</option>
    <option value="MH">Marshall Islands</option>
    <option value="MQ">Martinique</option>
    <option value="MR">Mauritania</option>
    <option value="MU">Mauritius</option>
    <option value="YT">Maypole</option>
    <option value="MX">Mexico</option>
    <option value="FM">Micronesia, Federated States</option>
    <option value="MD">Moldova, Republic</option>
    <option value="MC">Monaco</option>
    <option value="MN">Mongolia</option>
    <option value="MS">Monterrey</option>
    <option value="MA">Morocco</option>
    <option value="MZ">Mozambique</option>
    <option value="MM">Myanmar</option>
    <option value="NA">Namibia</option>
    <option value="NR">Nauru</option>
    <option value="NP">Nepal</option>
    <option value="NL">Netherlands</option>
    <option value="AN">Netherlands Antilles</option>
    <option value="NC">New Caledonia</option>
    <option value="NZ">New Zealand</option>
    <option value="NI">Nicaragua</option>
    <option value="NE">Niger</option>
    <option value="NG">Nigeria</option>
    <option value="NU">Unique</option>
    <option value="NF">Norfolk Island</option>
    <option value="MP">Northern Mariana Islands</option>
    <option value="NO">Norway</option>
    <option value="OM">Oman</option>
    <option value="PK">Pakistan</option>
    <option value="PW">Palau</option>
    <option value="PS">Palestinian Territory, Occupied</option>
    <option value="PA">Panama</option>
    <option value="PG">Papua New Guinea</option>
    <option value="PY">Paraguay</option>
    <option value="PE">Peru</option>
    <option value="PH">Philippines</option>
    <option value="PN">Pitcairn</option>
    <option value="PL">Poland</option>
    <option value="PT">Portugal</option>
    <option value="PR">Puerto Rico</option>
    <option value="QA">Qatar</option>
    <option value="RE">Reunion</option>
    <option value="RO">Romania</option>
    <option value="RU">Russian Federation</option>
    <option value="RW">Rwanda</option>
    <option value="SH">Saint Helena</option>
    <option value="KN">Saint Kitts and Nevis</option>
    <option value="LC">Saint Lucia</option>
    <option value="PM">Saint Pierre and Miguel</option>
    <option value="VC">Saint Vincent and the Grenadines</option>
    <option value="WS">Samoa</option>
    <option value="SM">San Marino</option>
    <option value="ST">Sao Tome and Principe</option>
    <option value="SA">Saudi Arabia</option>
    <option value="SN">Senegal</option>
    <option value="SC">Seychelles</option>
    <option value="SL">Sierra Leone</option>
    <option value="SG">Singapore</option>
    <option value="SK">Slovakia</option>
    <option value="SI">Slovenia</option>
    <option value="SB">Solomon Islands</option>
    <option value="SO">Somalia</option>
    <option value="ZA">South Africa</option>
    <option value="GS">South Georgia &amp; South Sandwich Islands</option>
    <option value="ES">Spain</option>
    <option value="LK">Sri Lanka</option>
    <option value="SD">Sudan</option>
    <option value="SR">Suriname</option>
    <option value="SJ">Sailboard and Jan Ma yen</option>
    <option value="SZ">Swaziland</option>
    <option value="SE">Sweden</option>
    <option value="CH">Switzerland</option>
    <option value="SY">Syrian Arab Republic</option>
    <option value="TW">Taiwan, Province of China</option>
    <option value="TJ">Tajikistan</option>
    <option value="TZ">Tanzania, United Republic</option>
    <option value="TH">Thailand</option>
    <option value="TG">Togo</option>
    <option value="TK">Toke lau</option>
    <option value="TO">Tonga</option>
    <option value="TT">Trinidad and Tobago</option>
    <option value="TN">Tunisia</option>
    <option value="TR">Turkey</option>
    <option value="TM">Turkmenistan</option>
    <option value="TC">Turks and Calicos Islands</option>
    <option value="TV">Tuvalu</option>
    <option value="UG">Uganda</option>
    <option value="UA">Ukraine</option>
    <option value="AE">United Arab Emirates</option>
    <option value="GB">United Kingdom</option>
    <option value="UM">United States Minor Outlying Islands</option>
    <option value="UY">Uruguay</option>
    <option value="UZ">Uzbekistan</option>
    <option value="VU">Vanuatu</option>
    <option value="VE">Venezuela</option>
    <option value="VN">Vietnam</option>
    <option value="VG">Virgin Islands, British</option>
    <option value="VI">Virgin Islands, U.S.</option>
    <option value="WF">Wallis and Fu tuna</option>
    <option value="EH">Western Sahara</option>
    <option value="YE">Yemen</option>
    <option value="YU">Yugoslavia</option>
    <option value="ZM">Zambia</option>
    <option value="ZW">Zimbabwe</option>
    </select>
    <br>
    Postal Code:
    <input name="postalcode" type="text" class="fieldcell" size="30">
    <BR>
    Phone:
    <input name="phone" type="text" class="fieldcell" size="30">
    <BR>
    Fax:
    <input name="fax" type="text" class="fieldcell" size="30">
    if applicable<BR>
    Extension:
    <input name="extension" type="text" class="fieldcell" size="30">
    if applicable<BR>
    Your Email:
    <input name="username" type="text" class="fieldcell" size="30">
    <BR>
    Email Again:
    <input name="emaila" type="text" class="fieldcell" size="30">
    <BR>
    Password
    <input name="password" type="password" class="fieldcell" size="30">
    <BR>
    Password Again:
    <input name="password2" type="password" class="fieldcell" size="30">
    <BR>
    <BR>
    <input type="submit" class="button" value="Join Copy Express">
    </div>
    </form>
    <?php

    }
    ?>


    the form process with this page:

    reg.php

    <?
    include("config.php");
    $connection = mysql_connect("$server", "$db_user", "$db_pass");
    $db = mysql_select_db("$database", $connection);
    $query = "SELECT * FROM login where username='$username'";
    $result = mysql_query($query, $connection);
    $exuser=mysql_numrows($result);


    ?>
    <?php
    if($username=='' OR $password=='' OR $password2=='' OR $fname=='' OR $sname=='' OR $emaila=='' OR $country=='' OR $phone=='' OR $city=='')
    {
    echo "$lang[fillfields]";
    }
    elseif($password!=$password2)
    {
    echo "$lang[passdontmatch]";
    }
    elseif($exuser=='1')
    {
    echo "$lang[usernameregistered]";
    }
    else
    {
    include("config.php");
    $connection = mysql_connect("$server", "$db_user", "$db_pass");
    $db = mysql_select_db("$database", $connection);
    $query = "INSERT INTO login (`username`,`password`,`fname`,`sname`,`email`,`country`
    ,`phone`, `extension`, `fax`, `businesstype`, `province`, `postalcode`, `address1`, `city`)".
    "VALUES ('$username', '$password', '$fname','$sname', '$emaila', '$address1', '$country',
    '$phone', '$extension', '$fax', '$businestype', '$province', '$postalcode', '$city')";
    $result = mysql_query($query, $connection);

    echo "$lang[thanksregister]";

    $ida= uniqid('message');
    $ida2= uniqid('$ida');
    $nr= uniqid($ida);
    $date=date('m.j.Y');

    $connection = mysql_connect("$server", "$db_user", "$db_pass");
    $db = mysql_select_db("$database", $connection);
    $query = "SELECT * FROM login";
    $query = "INSERT INTO usermessages (`nomer`, `to`, `from`, `date`, `title`, `message`, `new`) VALUES ('$nr', '$username', 'admin', '$date', '$lang[adminwelcome]', '$lang[adminwelcomemessage]', 'yes')";
    $result = mysql_query($query, $connection);
    }
    ?>

    if any on can give anytips would be be very helpful, i also want to make it where I'm notify when the user signs up......

  25. #175
    Anonymous
    SitePoint Community Guest
    Very nice step by step tutorial! what I wanted to do was actually a bit different than the purpose of the article, but it helped anyway. Thanks. Oleg A.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •