login mysql
#1
Posted 15 July 2010 - 12:48 PM
how do you make a login and use an already made mysql table
i have a script that makes tables in mysql but would like another script the same tables in that same mysql database
Mom - "Of course you can" *Hands over Standard Supermarket meat pie*
Again...
Child - "Shall I eat it, Shall I eat it"
Mom - "No it's disgusting!" *Throws Standard Supermarket meat pie out of childs hand*
#2
Posted 15 July 2010 - 01:09 PM

Please do not PM me for support (unless its a private matter). Instead, post in the appropriate forum and help will be provided accordingly.
Helpful links: Terms of Service | Privacy Policy | Wiki - Tutorials & Help | VlexoFree Support |
#3
Posted 15 July 2010 - 10:29 PM
With great power comes great responsibility
Please do not PM me for support. Instead, post in the appropriate forum and help will be provided accordingly.
Helpful links: Terms of Service | Privacy Policy | Wiki - Tutorials & Description | VlexoFree Support
#4
Posted 16 July 2010 - 05:32 AM
Mom - "Of course you can" *Hands over Standard Supermarket meat pie*
Again...
Child - "Shall I eat it, Shall I eat it"
Mom - "No it's disgusting!" *Throws Standard Supermarket meat pie out of childs hand*
#5
Posted 16 July 2010 - 11:16 AM
Edited by System Sneaker, 16 July 2010 - 11:16 AM.
With great power comes great responsibility
Please do not PM me for support. Instead, post in the appropriate forum and help will be provided accordingly.
Helpful links: Terms of Service | Privacy Policy | Wiki - Tutorials & Description | VlexoFree Support
#6
Posted 19 July 2010 - 07:28 PM
#7
Posted 15 December 2010 - 11:08 AM
$db_host = 'host site'; $db_user = 'user name'; $db_pass = 'password'; $db_name = 'database name'; // Connect to the MySQL database and save the link identifier (false if unsuccessfull). $db_connection = mysql_connect($db_host, $db_user, $db_pass); // Select the database, explicitly specifying the above link identifier. mysql_select_db($db_name, $db_connection); // Capture the user name depending on your needs. $username = // Fill in here. // Build the query. $query = "SELECT * FROM `" . 'table name' . "` WHERE `" . 'user name column heading' . "` = '" . $username . "'"; // Perform the query. $result = mysql_query($query); // Check for success with $result. // The following lines will return the stored password so that you can perform a check. $row = mysql_fetch_assoc($result); $row['password field name']; // Process the login...
Untested, but it should work haha.
#8
Posted 15 December 2010 - 03:34 PM
bossier330, on 15 December 2010 - 11:08 AM, said:
$db_host = 'host site'; $db_user = 'user name'; $db_pass = 'password'; $db_name = 'database name'; // Connect to the MySQL database and save the link identifier (false if unsuccessfull). $db_connection = mysql_connect($db_host, $db_user, $db_pass); // Select the database, explicitly specifying the above link identifier. mysql_select_db($db_name, $db_connection); // Capture the user name depending on your needs. $username = // Fill in here. // Build the query. $query = "SELECT * FROM `" . 'table name' . "` WHERE `" . 'user name column heading' . "` = '" . $username . "'"; // Perform the query. $result = mysql_query($query); // Check for success with $result. // The following lines will return the stored password so that you can perform a check. $row = mysql_fetch_assoc($result); $row['password field name']; // Process the login...
Untested, but it should work haha.
It wouldn't work.
Because you're not calling the actual form, which you can do two ways. A simple if statement or via isset(), which you didn't do at all.
include "config.php"; //Include your configs from a file, not differently on each page
if(isset($_POST['submitbutton'])){
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
$GettingUser = mysql_query("SELECT * FROM `table` WHERE `Username`='$username' && `Password`='$password'") or die(mysql_error());
$HasUser = mysql_fetch_assoc($GettingUser);
if(!$username && !$password){ die("<script>alert('Fill in all fields');history.back('');</script>"); }
if(mysql_num_rows($GettingUser) == 0){ die("<script>alert('Account doesn't exist');history.back('');</script>"); }
//This is where it is successful.
$_SESSION['user'] = $username;
//From hereon out if the login was successful you can note if the user is logged in by using the $_SESSION['user'] variable, but you must add session_start(); and session_end(); if those are right, lmao I can't remember to the top and bottom of your page.
}
That is the correct way.
Kiro R.
VlexoFree Support Team
Please do not PM me for support. Instead, post in the appropriate forum and help will be provided accordingly.
Helpful links: Terms of Service | Privacy Policy | Wiki - Tutorials & Description | VlexoFree Support |
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












