Jump to content
View in the app

A better way to browse. Learn more.

The Uniform Server Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Login System...

Featured Replies

Ok I have been trying to make a login system, but it never works. Honestly Im about to give us... It's driving me insane. So now I ask can you guys help me.

 

Well first I better explain what needs to be involved in the system, because it's going to be esential for my site, it needs this login system so you can login and out very easily, and also it cant be stored in cookies you know what I mean.

 

Anyway so where do I start off with? :)

Start of with making the database and tables needed. Also the information you will be collecting form users during registration and then we move on to programming.

  • Author

Got all that figure out. at this point only need:

Username:

Password:

Retype Password:

Email:

Retype email:

Visual Confirmation:

 

You know where you have to type in the numbers that appear like an image thing, what ever they are called.

I also want it, so it sends an email for an activation of the account.

Oh the table is called user.

You know where you have to type in the numbers that appear like an image thing, what ever they are called.

they are called captchas (completely automated turring test to tell computers and humans apart)

Those do not go in the database. They are randomly generated by PHP and tested to see if the user input is the same as the input generated. :)

 

Are you done with the databse?

 

BTW: We will leave the varification option and do that last just so we do not mess everything up :D

  • Author

Well i think it's done for now. It is possible to store in when they last visited right? Also when they registered as well? Apart from that I think that's it.

Yes, it is possible to do that :)

 

Just put it in the user table :)

 

PS: I wish i had time to write it for you but i will just be joking if i said i did. Also, i am using modem connection where i am so, my time on the net is limited because i am tieing down the phone line. :)

 

Here is what we will do, we will start with the login and logout and then the others...

 

I will start on the code for you and then attach it. I will also put comments there to help you understand :D

 

Also, the first scripts will just be the login and logout, no registration or anything. Try and attch the .sql file as a .txt file so i can know what table and co. you are set to use.

  • Author

No, no. It's fine that you help that way. It will help me learn to get this right. Honestly, I am always lost when it comes to keeping logged in etc...

  • Author

would that just be the user table in this case?

  • Author

ok here is the attached file.

_user.txt

  • 10 months later...

This is a "login" script thatwill work for anyone to "log in". ;D

 

Note: This is not a register script, this is a login script.

 

The $SESSION['login'] = true; means that they're logged in. Okay? Okay.

That also means it requires a session_start(); in the script. So place this where it's needed.

 

I will include something that you need to do yourself, for example, the forms and also the database queries.

 

/* Start of script */

// login.php

/*

Created by: Falc

 

15 February 2006

Language: PHP

License: Do what ever you like. However, I'd like to to keep my nickname(creator) in. If not, no big deal I suppose but I would like just that in return for posting this. Thanks.

*/

session_start();

 

if ($_POST['password'] == NULL && $_POST['username'] == NULL) {

// If the user has not posted anything in the user column.

/* Display the form here, send it to login.php (this file)

and also the field names need to be 'username' and 'password */

}

else{

// if the user has entered something

 

$query = "SELECT password FROM table where username = '".$POST['username']."'";

$result = mysql_query($query);

$sqlpass = mysql_fetch_array($result);

 

/* the SQL code will obviously need to be changed to suit the table

layout but it should be enough. */

 

if ($POST['password'] == $sqlpass['password']) {

// If the posted password is the same as stored in the database

 

$SESSION['login'] = true;

 

echo "You are now logged in, yay.";

}

else {

// If this isn't true, however

 

echo "I'm sorry but the password or the username you entered is incorrect.";

}

 

}

 

/* End of script */

Known Languages:
adv-XHTML, int-PHP, int-SQL, int-CSS, beg-Python

Currently reading: Take off in Japanese, How to play popular piano in 10 easy lessons, The Magicians' Guild
Currently learning: Python, Piano, Japanese
Current project: Relaxing
Currently playing: FalcHedgehog.gif

The script should work fine provided that the MySQL database/tables are correctly created.

http://forum.uniformserver.com/index.php?a...DE=02&f=21&t=38

This is an example table with adding 1 users inside of it.

 

Theres 2 SQL scripts for this...

Creating the table:

CREATE TABLE table

(

username varchar(30),

password char,

id int(15) AUTO_INCREMENT PRIMARY KEY

);

 

Adding the users:

INSERT INTO table (username, password)

VALUES ("foo", "bar");

Known Languages:
adv-XHTML, int-PHP, int-SQL, int-CSS, beg-Python

Currently reading: Take off in Japanese, How to play popular piano in 10 easy lessons, The Magicians' Guild
Currently learning: Python, Piano, Japanese
Current project: Relaxing
Currently playing: FalcHedgehog.gif

:) Right now i am too busy so sorry... can't help. I bearly have time for myself.... just school and work.. and i do not even get to watch TV :)

 

ahhhhhhhhhhh... :)

  • 5 months later...
  • 7 months later...

I just went with Simpleauth for this type of thing and custom built my PHP around it. I even added md5 encryption! It was so easy to change a line here or there it just had the perfect basics for anyone who has an idea of mySQL and PHP.

  • 1 month later...
  • Author

HuH thanks for the help there :lol: Believe it or not I was just looking for something like this :angry:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.