+ Reply to Thread
Page 5 of 6
FirstFirst ... 3 4 5 6 LastLast
Results 41 to 50 of 52

Thread: Creating login/registration forms with php

  1. #41
    Newbie rahmat is an unknown quantity at this point
    Join Date
    Aug 2009
    Posts
    2

    Re: Creating login/registration forms with php

    good

  2. #42
    Newbie urduworld is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    1

    Re: Creating login/registration forms with php

    very nice bro very nice:
    but here is some problem i 'm using free hosting which is not providing me SQL database. so please can you tell me any script like this but no database require.

    urduworld.110mb.com

  3. #43
    Code Warrior
    /////////|||||\\\\\\\\\
    amrosama is a splendid one to behold amrosama is a splendid one to behold amrosama is a splendid one to behold amrosama is a splendid one to behold amrosama is a splendid one to behold amrosama is a splendid one to behold amrosama is a splendid one to behold amrosama's Avatar
    Join Date
    Aug 2007
    Location
    Pyramids st, Giza, Egypt
    Age
    21
    Posts
    8,182
    Blog Entries
    12

    Re: Creating login/registration forms with php

    you can use regular text files instead of database. its not gonna be easy, because you will have to write your own inserting, searching(quires) functions.
    the files may look like this:
    users.txt
    usernameassword
    test:testpass

  4. #44
    Newbie kartikssj is an unknown quantity at this point
    Join Date
    Sep 2009
    Posts
    1

    Re: Creating login/registration forms with php

    nice!

  5. #45
    Newbie hudbarnett is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    2

    Re: Creating login/registration forms with php

    Hi there

    I am totally new to php and i have setup the database and created a user and password. I have seen in the script where i put the username and databse name but i can't see where the password goes. Can anyone help...
    Code:
    <?php
     session_start
    ();session_destroy();
     
    session_start();
    if(
    $_GET["regname"] && $_GET["regemail"] && $_GET["regpass1"] && $_GET["regpass2"] )
    {
        if(
    $_GET["regpass1"]==$_GET["regpass2"])
        {
        
    $servername="localhost";
        
    $username="root";
        
    $conn=  mysql_connect($servername,$username)or die(mysql_error());
        
    mysql_select_db("test1",$conn);
        
    $sql="insert into users (name,email,password)values('$_GET[regname]','$_GET[regemail]','$_GET[regpass1]')";
        
    $result=mysql_query($sql,$conn) or die(mysql_error());        
        print 
    "<h1>you have registered sucessfully</h1>";
       
        print 
    "<a href='index.php'>go to login page</a>";
        }
        else print 
    "passwords doesnt match";
    }
    else print
    "invaild input data";

    ?>
    Last edited by Orjan; 01-21-2010 at 11:22 AM. Reason: Please use code tags for your code!

  6. #46
    Newbie k1net1cs is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    21

    Re: Creating login/registration forms with php

    @hudbarnett

    I don't really get what you're trying to ask, but I'll try to answer.

    Code:
    $sql="insert into users (name,email,password) values ('$_GET[regname]','$_GET[regemail]','$_GET[regpass1]')"
    According to the SQL syntax above, the data from the registration form is inserted to a table named users, which has fields (or columns) named name, email & password.

    $_GET[regname]'s value goes to the name column.
    $_GET[regemail]'s value goes to the email column.
    $_GET[regpass1]'s value goes to the password column.

    Also, if I may enhance that rough code of yours :

    Code:
    <?php
    session_start
    ();
    session_unset();

    if(isset(
    $_GET["regname"],$_GET["regemail"],$_GET["regpass1"],$_GET["regpass2"]))
    {
      if(
    $_GET["regpass1"] == $_GET["regpass2"])
      {
        
    $servername "localhost";
        
    $username   "root";
        
    $conn       mysql_connect($servername,$username) or die('Could not connect : ' mysql_error());

        
    mysql_select_db("test1");

        
    $sql    "INSERT INTO `users` VALUES ('$_GET[regname]','$_GET[regemail]','$_GET[regpass1]')";
        
    $result mysql_query($sql) or die('Could not insert values : ' mysql_error());

        
    mysql_close();

        print 
    "<h1>You have registered sucessfully.</h1><br><br>";
        print 
    "Go to <a href='index.php'>login page</a>.";
      }
      else
        print 
    "Passwords don't match.";
    }
    else
      print 
    "Invalid input data.";
    ?>
    Of course, these amendments of mine may not be optimal and/or may contain an error or two, but please do correct me if I'm wrong.

  7. #47
    Programming Professional so1i is an unknown quantity at this point so1i's Avatar
    Join Date
    Sep 2009
    Posts
    229

    Re: Creating login/registration forms with php

    Quote Originally Posted by hudbarnett View Post
    Hi there

    I am totally new to php and i have setup the database and created a user and password.
    You put the password for the database in the connection string along with $servername and $username, so it would be in this line:

    Code:
    $conn mysql_connect($servername,$username,$password) or die('Could not connect : ' mysql_error()); 
    Hope that helps!

  8. #48
    Moderator Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan is a splendid one to behold Jaan's Avatar
    Join Date
    Dec 2006
    Location
    Estonia
    Age
    18
    Posts
    2,069
    Blog Entries
    9

    Re: Creating login/registration forms with php

    Well.. I suggest if you have finished your code, remove those "mysql()" errors because they are good information for hackers
    Get A Cheap Top Level Domain, COM and NET domains only for $7.95 - Get Yours Now!
    Trill Hosting - Cheap SSL, Cheap Web Hosting, Register Cheap Domains, Cheap Blog Hosting
    www.trillhosting.com | support@trillhosting.com
    Hosting Plans | Write To Us | Support | Client Area | About Us

    CodeCall Blog | CodeCall Wiki

  9. #49
    Newbie k1net1cs is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    21

    Re: Creating login/registration forms with php

    @so1i
    Ah, so that's what he really meant...
    Nothing screws my head more than hours of Dragon Age, I guess... =b

    @hudbarnett
    Like Jaan said, those die() functions should not contain mysql_error() function anymore if the website is accessible by the public.
    It's still fine if you just want to test things out in your own computer, though.
    Might as well looking up some techniques in input validation, especially using regular expressions (regex).

  10. #50
    Newbie st_holysinner is an unknown quantity at this point
    Join Date
    Feb 2010
    Location
    Philippines
    Posts
    2

    Re: Creating login/registration forms with php

    i downloaded the attached files for this. when i run registration it says Table 'test.users' doesn't exist.. help me pls..

+ Reply to Thread
Page 5 of 6
FirstFirst ... 3 4 5 6 LastLast

Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 guests)

     

Similar Threads

  1. PHP 5 and OOP
    By Jordan in forum PHP Tutorials
    Replies: 11
    Last Post: 09-22-2008, 01:58 AM
  2. PHP 4 end of life announcement
    By Jordan in forum News
    Replies: 4
    Last Post: 08-30-2007, 09:55 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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