IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
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
no avatar
Hail Caesar!
*********************
Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



Post #41 post Oct 3 2007, 01:39 PM
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
no avatar
Newbie
*
Group: Members
Posts: 2
Joined: 24-October 07
Member No.: 51,962



Post #42 post Oct 24 2007, 01:51 PM
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
no avatar
Newbie
*
Group: Members
Posts: 2
Joined: 24-October 07
Member No.: 51,962



Post #43 post Oct 24 2007, 01:52 PM
QUOTE(Trap FeedBacker @ Oct 4 2007, 02:39 AM) [snapback]352947[/snapback]
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
no avatar
Advanced Member
*******
Group: Members
Posts: 148
Joined: 24-October 07
Member No.: 51,939



Post #44 post Oct 24 2007, 02:28 PM
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
no avatar
Hail Caesar!
*********************
Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



Post #45 post Oct 30 2007, 03:45 PM
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
no avatar
Advanced Member
*******
Group: Members
Posts: 101
Joined: 13-October 07
Member No.: 51,530



Post #46 post Oct 31 2007, 11:45 AM
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
no avatar
Newbie [Level 2]
**
Group: Members
Posts: 34
Joined: 10-December 07
From: Norway
Member No.: 54,556



Post #47 post Dec 22 2007, 02:19 AM
QUOTE(pop @ Oct 31 2007, 12:45 PM) [snapback]354813[/snapback]
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
no avatar
Hail Caesar!
*********************
Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



Post #48 post Dec 28 2007, 02:23 AM
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
no avatar
Hail Caesar!
*********************
Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



Post #49 post Jan 6 2008, 11:49 PM
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
Go to the top of the page
+Quote Post
iGuest
no avatar
Hail Caesar!
*********************
Group: Members
Posts: 5,876
Joined: 21-September 07
Member No.: 50,369



Post #50 post Jan 7 2008, 04:30 AM
Reply to Code query
Php Simple Login Tutorial

Mysql_select_db($dbUsers); <- Make this lowercase.

-Shridhar
Go to the top of the page
+Quote Post

7 Pages V  « < 3 4 5 6 7 >
Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   0 Albus Dumbledore 1,133 18th June 2006 - 08:28 AM
Last post by: Albus Dumbledore
No New Posts   9 noxit 871 30th July 2004 - 02:57 PM
Last post by: templest
No new   32 ultrasmad 3,931 14th February 2005 - 11:01 AM
Last post by: Someone
No new   16 ultrasmad 3,094 21st May 2005 - 10:04 AM
Last post by: alexia
No New Posts   3 ultrasmad 781 30th July 2004 - 03:27 PM
Last post by: templest
No New Posts   12 BooZker 936 8th July 2006 - 07:50 AM
Last post by: BooZker
No new   34 Bash 9,070 23rd February 2007 - 05:13 AM
Last post by: btdesign
No New Posts   2 zachtk8702 497 13th August 2004 - 04:26 PM
Last post by: zachtk8702
No New Posts   2 threepach 692 19th February 2008 - 08:30 PM
Last post by: threepach
No New Posts   0 etycto 300 2nd September 2007 - 09:43 PM
Last post by: etycto