Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-14-2008, 09:59 PM   PM User | #1
mcovalt
New to the CF scene

 
Join Date: Mar 2008
Location: At Home
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
mcovalt is an unknown quantity at this point
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!!!!!
mcovalt is offline   Reply With Quote
Old 03-14-2008, 10:42 PM   PM User | #2
whizard
Senior Coder

 
whizard's Avatar
 
Join Date: Jan 2005
Location: Philadelphia, PA, USA
Posts: 1,457
Thanks: 10
Thanked 37 Times in 37 Posts
whizard will become famous soon enoughwhizard will become famous soon enough
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
__________________
If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.
Step 1: Learn. Step 2: Search. Step 3: Post here.
whizard is offline   Reply With Quote
Old 03-15-2008, 04:09 AM   PM User | #3
mcovalt
New to the CF scene

 
Join Date: Mar 2008
Location: At Home
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
mcovalt is an unknown quantity at this point
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.
__________________
--Matt Covalt
--The fifteen year old PSP Hacker from around ASU... Home of the three time championship Mountaineers
mcovalt is offline   Reply With Quote
Old 03-15-2008, 04:17 AM   PM User | #4
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,602
Thanks: 2
Thanked 398 Times in 391 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
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.
Inigoesdr is offline   Reply With Quote
Old 03-15-2008, 08:59 AM   PM User | #5
Deacon Frost
Regular Coder

 
Deacon Frost's Avatar
 
Join Date: Feb 2008
Location: Between the Lines
Posts: 279
Thanks: 31
Thanked 4 Times in 4 Posts
Deacon Frost is on a distinguished road
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.
Deacon Frost is offline   Reply With Quote
Old 03-15-2008, 02:17 PM   PM User | #6
InsaneRhino
New Coder

 
Join Date: Dec 2005
Posts: 35
Thanks: 1
Thanked 1 Time in 1 Post
InsaneRhino is an unknown quantity at this point
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.
InsaneRhino is offline   Reply With Quote
Old 03-29-2008, 05:00 PM   PM User | #7
mcovalt
New to the CF scene

 
Join Date: Mar 2008
Location: At Home
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
mcovalt is an unknown quantity at this point
Thanks for all the help everyone. I am almost done with the site!
__________________
--Matt Covalt
--The fifteen year old PSP Hacker from around ASU... Home of the three time championship Mountaineers
mcovalt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:19 AM.


Advertisement
Log in to turn off these ads.