Welcome Guest ( Log In | Register)



7 Pages V  « < 3 4 5 6 7 >  
Reply to this topicStart new topic
> Php Simple Login Tutorial, Learn how to make a simple login!
iGuest
post Oct 3 2007, 01:39 PM
Post #41


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



Hello guys!
First of all I have to say I'm still a beginner in php. I've been trying this tutorial to see how is working and everything was OK until I got this: ERROR: User not added to database.

:( ... probably is something I've done wrong ... i just can't figure it out why!

Anyone could care and help me out?
Thx.

-MrNewt
Go to the top of the page
 
+Quote Post
Xavier
post Oct 24 2007, 01:51 PM
Post #42


Newbie
*

Group: Members
Posts: 2
Joined: 24-October 07
Member No.: 51,962



okay, do the email, you simply have to add a mail function to the script,


CODE
$to      = 'nobody@example.com'; //replace with the email of the administrator
$subject = 'the subject'; //change it to better suit ur needs
$message = 'New user signed up'; //replace the message with something else u want
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);


insert this line of code before
CODE
// Redirect to thank you page.


hopefully that should work...

but i have some other issue, when ever it does the login bit, and when i go to see the members page, it does not work. It simply loads the page as if the user has signed into the website but not really.

the session valid user does not have any values attached to it. what could be the problem?
Go to the top of the page
 
+Quote Post
Xavier
post Oct 24 2007, 01:52 PM
Post #43


Newbie
*

Group: Members
Posts: 2
Joined: 24-October 07
Member No.: 51,962



QUOTE(Trap FeedBacker @ Oct 4 2007, 02:39 AM) *
Hello guys!
First of all I have to say I'm still a beginner in php. I've been trying this tutorial to see how is working and everything was OK until I got this: ERROR: User not added to database.

sad.gif ... probably is something I've done wrong ... i just can't figure it out why!

Anyone could care and help me out?
Thx.

-MrNewt



ah whats the problem? what are you doing?
Go to the top of the page
 
+Quote Post
silver_wolves
post Oct 24 2007, 02:28 PM
Post #44


Advanced Member
*******

Group: Members
Posts: 148
Joined: 24-October 07
Member No.: 51,939



im going to try this on my site. but after i get everything setup, i will create an area using this script. its really easy to follow and very good. thanks for this.
Go to the top of the page
 
+Quote Post
iGuest
post Oct 30 2007, 03:45 PM
Post #45


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



I got the first part okay, but then the rest :'(



Please check it out: www.euroherp.com/register.php



Says there is an error on line 56 which is the



"Header("Location: register.php?op=thanks"); " line



-Daniel
Go to the top of the page
 
+Quote Post
pop
post Oct 31 2007, 11:45 AM
Post #46


Advanced Member
*******

Group: Members
Posts: 102
Joined: 13-October 07
Member No.: 51,530



can you explain this code

CODE
if ( $obj = @mysql_fetch_object($r) )
  {
  // Login good, create session variables
  [b]$_SESSION["valid_id"] = $obj->id;[/b]
  $_SESSION["valid_user"] = $_POST["username"];
  $_SESSION["valid_time"] = time();
Go to the top of the page
 
+Quote Post
coldasice
post Dec 22 2007, 02:19 AM
Post #47


Newbie [Level 2]
**

Group: Members
Posts: 34
Joined: 10-December 07
From: Norway
Member No.: 54,556



QUOTE(pop @ Oct 31 2007, 12:45 PM) *
can you explain this code

CODE
if ( $obj = @mysql_fetch_object($r) )
  {
  // Login good, create session variables
  [b]$_SESSION["valid_id"] = $obj->id;[/b]
  $_SESSION["valid_user"] = $_POST["username"];
  $_SESSION["valid_time"] = time();



hm if i got it right

CODE
if ( $obj = @mysql_fetch_object($r) )
  {
  // Login good, create session variables
  [b]$_SESSION["valid_id"] = $obj->id;[/b]
  $_SESSION["valid_user"] = $_POST["username"];
  $_SESSION["valid_time"] = time();


it registres if the login is valid.. then fix so that the sessions register the logins so that when you got to a protected page " also can only be accessed if you have loged in" a basic a login is made with session with a slighly cookies mix wink.gif.. so

$_SESSION["valid_id"] = $obj->id;[/b] // basicly stores the id..
$_SESSION["valid_user"] = $_POST["username"]; / this makes the valid_user to your user name
$_SESSION["valid_time"] = time(); // this input the time mby when you loged in..

am i right if not.. please say so wink.gif

did you understand now =D?

This post has been edited by coldasice: Dec 22 2007, 02:20 AM
Go to the top of the page
 
+Quote Post
iGuest
post Dec 28 2007, 02:23 AM
Post #48


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



Includes
Php Simple Login Tutorial

Make sure that you are not including any files from another directory. I was including dbconfig from /includes/dbConfig.Php and it would not work. I have no idea as I am a total novice to php, but maybe someone else can explain this.
Go to the top of the page
 
+Quote Post
iGuest
post Jan 6 2008, 11:49 PM
Post #49


Trap Double Mocha Member
***************

Group: Members
Posts: 2,360
Joined: 21-September 07
Member No.: 50,369



php code not working
Php Simple Login Tutorial

[CODE]<?
// Replace the variable values below
// with your specific database information.
$host = "localhost";
$user = "UserName";
$pass = "Password";
$db = "dbName";

// This part sets up the connection to the
// database (so you don't need to reopen the connection
// again on the same page).
$ms = mysql_pconnect($host, $user, $pass);
If ( !$ms )
{
Echo "Error connecting to database.\and";
}

// Then you need to make sure the database you want
// is selected.
Mysql_select_db($dbUsers);
?>
[/CODE]
How do I set the variables to my own? EXPLAIN GOOD PLEASE

-ryanreese