Welcome Guest ( Log In | Register)



7 Pages V  < 1 2 3 4 > »   
Reply to this topicStart new topic
> Php Simple Login Tutorial, Learn how to make a simple login!
hhPHP
post Mar 20 2005, 04:51 AM
Post #11


Newbie
*

Group: Members
Posts: 1
Joined: 20-March 05
Member No.: 4,731



Wow, good guide, this is some good stuff, keep up the goodness, you get a reputation point...
Go to the top of the page
 
+Quote Post
snlildude87
post Mar 20 2005, 05:15 AM
Post #12


Moderator
***************

Group: Members
Posts: 2,325
Joined: 8-March 05
From: Mawson, Antarctica
Member No.: 4,254



Welcome to trap17, hhPHP.
Go to the top of the page
 
+Quote Post
elevenmil
post Mar 30 2005, 01:07 AM
Post #13


Super Member
*********

Group: Members
Posts: 441
Joined: 22-March 05
Member No.: 4,795



As many of you just might know, I'm tryin to get this log in and register stuff down, but I keep running into problems... For your tutorial I keep getting this message everytime I open my .php files in my browser.


CODE
Fatal error: Call to undefined function: mildawg_dbconfig() in /home/mildawg/public_html/dbConfig.php on line 20


any thoughts? Thanks for the help.
Go to the top of the page
 
+Quote Post
HmmZ
post Mar 30 2005, 05:16 AM
Post #14


Super Member
*********

Group: Members
Posts: 362
Joined: 2-March 05
From: The Netherlands
Member No.: 4,097



Hmm,

the error says theres a problem on line 20...
CODE
// Then you need to make sure the database you want
// is selected.
mysql_select_db($db);
?>


try the following:
CODE
mysql_select_db("$db",$ms);


if that doesnt work you can try to take off the apostrophes, if the problem still persists please reply again

P.S. please don't forget that Trap17 uses your cPanel username in db usernames and dbs, e.g. cpanelusername_dbusername and yourcpanelusername_dbname.
Go to the top of the page
 
+Quote Post
cragllo
post Mar 31 2005, 08:34 AM
Post #15


Sorry for not being active, Uni :(
*********

Group: Members
Posts: 933
Joined: 24-August 04
From: South Wales, UK
Member No.: 892



I have not tried this YET, but i read through the code, in register.php

where is the information inserted into the db?
CODE
 // Create query
$q = "SELECT * FROM `dbUsers` "
 ."WHERE `username`='".$_POST["username"]."' "
 ."AND `password`=PASSWORD('".$_POST["password"]."') "
 ."LIMIT 1";

I see taht bit, but that just selects data out of the db dosent it?
Correct me if im wrong, just learning... smile.gif
Go to the top of the page
 
+Quote Post
elevenmil
post Mar 31 2005, 08:55 AM
Post #16


Super Member
*********

Group: Members
Posts: 441
Joined: 22-March 05
Member No.: 4,795



Hmmz, I adjusted my code and the error went away, but when I went to try it out and register, yep, I hit another roadblock...it says...

CODE
Error: User not added to database.



...frustrating...

what do you make of this?
Go to the top of the page
 
+Quote Post
elevenmil
post Mar 31 2005, 09:14 AM
Post #17


Super Member
*********

Group: Members
Posts: 441
Joined: 22-March 05
Member No.: 4,795



Sorry about the double post...but its 4 AM and I'm goin to bed but I saw somethin else...in addition to my previous post whenever I registered to check what would happen and it said user not added to database...I went to my phpMyAdmin and looked at my table....and my username WAS added...this just adds to my confusion

Any help?
Go to the top of the page
 
+Quote Post
HmmZ
post Mar 31 2005, 01:19 PM
Post #18


Super Member
*********

Group: Members
Posts: 362
Joined: 2-March 05
From: The Netherlands
Member No.: 4,097



I think I see the problem, its checking a wrong query, try the following (old code first to see where you can find it)

CODE
// Fields are clear, add user to database
//  Setup query
$q = "INSERT INTO `dbUsers` (`username`,`password`,`email`) "
 ."VALUES ('".$_POST["username"]."', "
 ."PASSWORD('".$_POST["password"]."'), "
 ."'".$_POST["email"]."')";
//  Run query
$r = mysql_query($q);

// Make sure query inserted user successfully
if ( !mysql_insert_id() )
 {
 die("Error: User not added to database.");
 }


replace if(!mysql_insert_id()) with this:
CODE
if(!$r)


let me know if that fixes your problem
Go to the top of the page
 
+Quote Post
elevenmil
post Mar 31 2005, 06:43 PM
Post #19


Super Member
*********

Group: Members
Posts: 441
Joined: 22-March 05
Member No.: 4,795



I inserted your code, but nothing changed, still got the error user not added to database thingy....

What else can you suggest? Thanks...I'll keep messin around with it
Go to the top of the page