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

03-14-2008, 10:59 PM
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!!!!!

03-14-2008, 11:42 PM
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.


03-15-2008, 05:09 AM
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.

03-15-2008, 05:17 AM
Just an example:

mysql_query("INSERT INTO `users` (`id`, `username`, `password`) VALUES(NULL, '{$username}', '{$password}'");
$affected = mysql_affected_rows();
if($affected == 1)
echo 'User inserted';
echo 'Failed to insert user';
You need to filter the user input(see mysql_real_escape_string() (http://php.net/mysql_real_escape_string)), set your id column to auto_increment, etc.

Deacon Frost
03-15-2008, 09:59 AM
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.

03-15-2008, 03:17 PM
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.

03-29-2008, 06:00 PM
Thanks for all the help everyone. I am almost done with the site!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum