Php Simple Login Tutorial - Learn how to make a simple login!

Pages: 1, 2, 3, 4, 5, 6, 7
free web hosting
Open Discussion > CONTRIBUTE > Tutorials

Php Simple Login Tutorial - Learn how to make a simple login!

iGuest
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

Reply

Xavier
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?

 

 

 


Reply

Xavier
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?

Reply

silver_wolves
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.

Reply

iGuest
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

Reply

pop
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();

Reply

coldasice
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?

Reply

iGuest
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.

Reply

iGuest
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

Reply

iGuest
Reply to Code query
Php Simple Login Tutorial

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

-Shridhar

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Pages: 1, 2, 3, 4, 5, 6, 7
Recent Queries:-
  1. simple login form, code - 0.46 hr back. (1)
  2. php tutorial login - 2.05 hr back. (1)
  3. how to make a php member system - 2.08 hr back. (1)
  4. php mysql simple database conect read write - 2.87 hr back. (1)
  5. login.php tutorials - 3.96 hr back. (1)
  6. simple login area php - 4.74 hr back. (1)
  7. how to create a simple login page - 4.94 hr back. (1)
  8. pear login tutorial - 4.93 hr back. (3)
  9. how to make a login system in php - 5.39 hr back. (1)
  10. php simple login script with cookies - 7.09 hr back. (1)
  11. php tutorial login page - 9.01 hr back. (1)
  12. php login tutorial - 2.36 hr back. (4)
  13. how to make a username and password using visual basic - 9.17 hr back. (1)
  14. php example dbconfig.php - 9.73 hr back. (1)
Similar Topics

Keywords : php, simple, login, learn, make, simple, login

  1. To Automatically Run Command When Login / Logoff
    (3)
  2. Simple Php Login And Registration System
    (15)
    Hello. This is my first web tutorial ever. This is basically a simple register and login script.
    Yes, I know it’s a bit rubbish but I’m quite new to PHP/MySQL. Here’s the register form. This can
    be any file extension you like. I’d recommend calling it register.html . CODE
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html
    xmlns="http://www.w3.org/1999/xhtml"> <head> <meta
    http-equiv="Content-Type" content="text/ht....
  3. Automatic Login
    in WinXP (5)
    Ever wanted to just turn on our computer and when you get back it's already on the desktop?
    (Rather then having to login at the welcome screen) Now some computer have this feature by default,
    but what if it gets broken, try this. On an Administrator account goto start >> Run, and type
    "control userpasswords2" (without the quotes) Uncheck the box that "Users must enter a Username and
    Password to use this computer", then press Ok. You will be prompted to enter a default user and
    their pasword, then next time you restart the computer it will automaticaly login to that....
  4. Simple Login In Visual Basic 6
    user interaction example trough login programm (6)
    First of all, I am NOT a programmer, this is something my friend taught me. It describes basic
    interaction with the user, while showing basic functionality of this simple programm. So, without
    further ado, we're off to the tutorial: First of all, start your visual basic, when prompted
    for new project, select Standard Exe . Next, we need to open code window, so we can start typing
    the program. This can be done in two ways, one is double clicking on the form, or selecting Code
    from View menu. If you double clicked on the form, you will see following text: CODE ....
  5. How To Put A Phpbb Login Box On Your Main Site.
    Code and .php included!!! (18)
    I have included my coded file with this... Ok here is the code. CODE // //Create login area,
    replace the phpBB2 in /phpBB2/login.php with your forum's //directory // <form
    action="/phpBB2/login.php" method="post" target="_top"> <table
    width="25%" cellspacing="2" cellpadding="2" border="0"
    align="center">  <tr> <td align="left"
    class="nav"><a href="/phpBB2/index.php" class="nav">Prank Place
    Forum Index</a></td>....
  6. Php/mysql Login/register
    Tutorial for login with databases. (2)
    Start register code. Register.php CODE <form method=post
    action=register.php?action=register  name=s> <table>
    <tr><td>Username:</td><td><input type=text
    name=user></td></tr>
    <tr><td>Email:</td><td><input type=text
    name=email></td></tr>
    <tr><td>Pass:</td><td><input type=password
    name=pass></td></tr> <tr><td>Verify
    Pass:</td><td><input ....
  7. Complete Login And Registration System
    doesn't use mysql! (9)
    kLogin 0.1 QUOTE(readme.txt) Readme file to kLogin 0.1 To use the internet explorer fix:
    download the latest IE7 ZIP file
    (http://sourceforge.net/project/showfiles.php?group_id=109983&package_id=119707) Extract the ie7
    zip file to the root directory of your web server. Example, if you are using a unix/linux server,
    it's on "public_html/" or "home/public_html" Open kLogin.php file with your editor and edit the
    $info_text or $info_txt variable. Then, extract the kLogin.php file in to the root
    directory of your web server also. Just run kShoutBo....
  8. Multiple Admin Login (php)
    This is a script that doesnt requre SQL (3)
    first off make a login.html page Code: QUOTE Admin Login Username: Password:
    then make a check.php page Code: QUOTE $admin1 = "admin1"; //
    first admin username $adm_pass1 = "password1"; // first admin password $admin2 =
    "admin2"; // second admin username $adm_pass2 = "password2"; // second admin password
    if(($username == $admin1 && $password == $adm_pass1) || ($username ==
    $admin2 && $password == $adm_pass2)){ echo "Congratulations " . $_POST . " ....
  9. Complete Login System
    With PHP + MYSQL (57)
    Its an complete login sistem made and tested by me and I think itwill be very usefull for people who
    are tryn to learn PHP. First, let's make register.php: CODE <?
    include("conn.php"); // create a file with all the database connections
    if($do_register){ // if the submit button were clicked if((!$name)
    || (!$email) || (!$age) || (!$login) ||
    (!$password) || (!$password2)){ print "You can't let
    any fields in blank....

    1. Looking for php, simple, login, learn, make, simple, login

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for php, simple, login, learn, make, simple, login

*MORE FROM TRAP17.COM*
advertisement



Php Simple Login Tutorial - Learn how to make a simple login!



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE