Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HELP!: Creating New User Tables For Login Sites With PHP

    Ok... this is my first thing I have done on this CodingForums site.

    So here's the deal. As a learning project I have to create a web site that serves as an open chat room. For the chat room I will probably just use a simple IRC client. That would be easy but I have a few things that aren't making this such a breeze:

    1. I need to write a full login, logout, email password, and sign up scripts
    2. All of the work has to be manually written with Notepad (or an alternative text editor). No easy programs that do all of the hard work for you.

    Here is the site: http://goboone.net/~mcovalt/ and in this zip is entire root of the ftp server I am on: http://goboone.net/~mcovalt/stuff.zip. The place I am stuck at is the PHP. The HTML and CSS came pretty naturally but this PHP thing is giving me hell. What I need to do now is create the PHP script that creates a new user in the MySQL table securely. Any help would be greatly appreciated.

    ***A couple of notes:***
    1. I am totally new to Web Dev. Haven't looked at code in my life prior to this project.
    2. If you want to login to the site the only user is: "bt" and the password is "test".
    3. If I forgot to mention anything, just let me know and I will try to respond as quickly as possible.
    4. I'm not going to be the fastest responder... I have to juggle school, work, and a social life
    5. Thanks!!!!!

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Not to give you a cold shoulder, so to speak, but I doubt that anyone is going to do this for you. We also have to juggle school, work, and, in some cases, a social life.

    If you want to do this, take a shot at it, and post when you have a question or problem with a specific task. (ie creating a table in the DB or validating the username/password)

    Also, the PHP manual (php.net/manual) is a big help.

    HTH
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey, thanks for the quick reply. I do have a fairly specific question. How do I add new log-in users through php? If it is not an easy thing to do then I can just figure it out. Thanks for the link to the PHP tutorial. Its just that PHP is such an emmense language that I thought that I would never figure out how to do the required task.

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Just an example:
    PHP Code:
    mysql_query("INSERT INTO `users` (`id`, `username`, `password`) VALUES(NULL, '{$username}', '{$password}'");
    $affected mysql_affected_rows();
    if(
    $affected == 1)
    {
        echo 
    'User inserted';
    }
    else
    {
        echo 
    'Failed to insert user';

    You need to filter the user input(see mysql_real_escape_string()), set your id column to auto_increment, etc.

  • #5
    Regular Coder Deacon Frost's Avatar
    Join Date
    Feb 2008
    Location
    Between the Lines
    Posts
    279
    Thanks
    31
    Thanked 4 Times in 4 Posts
    I was looking back the other day, and I noticed how much I've learned to know what I know at such a level. (Not expert, but fairly knowledged).

    Well, I noticed that PHP is actually a very easy straight-forward language.

    Once you learn to read it, and understand each function, it's just like a foreign language. You don't need to know the words, you just have to learn to associate things with the specific word. And you'll begin to understand it.

    In PHP, you associate what happens in accordance with each part of the code and isolate it.

    I'm presuming it's like that with other languages, you really just have to learn how/when to use them, instead of actually knowing it, you'll begin to familiarize with it.


    So it's not that it's emmense, it's that you just don't understand it yet.

  • #6
    New Coder
    Join Date
    Dec 2005
    Posts
    35
    Thanks
    1
    Thanked 1 Time in 1 Post
    For a few points on where to get started I would suggest googleing 'php login script' i know when i was looking into it when i first started there were a few sites that really taught me a lot, not just about how to make a login script but about PHP because a login script will need nearly every aspect of PHP, escept FOR and WHILE loops, as well as maybe arrays.

    PHP.net is a great resource. Dont be discouraged, look at peoples example script, and break it down to learn what each part does.

  • #7
    New to the CF scene
    Join Date
    Mar 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for all the help everyone. I am almost done with the site!


  •  

    Posting Permissions

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