Login script (probably a simple error)
Posted on
16th Feb 2014 07:03 pm by
admin
dbConfig.php
Code: <?
// Replace the variable values below
// with your specific database information.
$host = "localhost";
$user = "username";
$pass = "password";
$db = "annarbo1_Archives";
// 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.n";
}
// Then you need to make sure the database you want
// is selected.
mysql_select_db($db);
?>
login.php
Code: <?php
// dBase file
include "dbConfig.php";
session_start();
if ($_GET["op"] == "login")
{
if (!$_POST["username"] || !$_POST["password"])
{
die("You need to provide a username and password.");
}
// Create query
$q = "SELECT * FROM `people` "
."WHERE `username`='".$_POST["username"]."' "
."AND `password`=PASSWORD('".$_POST["password"]."') "
."LIMIT 1";
// Run query
$r = mysql_query($q);
if ( $obj = @mysql_fetch_object($r) )
{
// Login good, create session variables
$_SESSION["valid_user"] = $_POST["username"];
// Redirect to member page
Header("Location: index.php");
}
else
{
// Login not successful
die("Sorry, could not log you in. Wrong login information.");
}
}
?>
when I run this online i get this error:
"Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home4/annarbo1/public_html/login.php:2) in /home4/annarbo1/public_html/login.php on line 4"
I have yet to figure out what's wrong
No comments posted yet
Your Answer:
Login to answer
115
28
Other forums
storing video files into mysql in php
hi
i have my video files in my folder ,
i have to store the path of the videos into db an
AUTONUMBER PROBLEM
Hello Everyone,
My name is Jones and i am new to this forum and to oracle. I am using ora
How to insert random unique values in 2 columns ?
I have table with 2 columns
Create Table code_for_code (
first_code varchar2(10) uni
Sales orders ans reservations not taken into account on MPS / MRP
Hello,
I am implementing the MPS / MRP and I have the following problem:
I ha
MYSQL gen help
This is my Mysql gen. can anyone tell me why this echos
MID(networkset.networkid, 3, 3) AS &q
Just cannot get 'area' to submit to db using same php code as already used
Basically all i have done is just modified some code and added an area section.
The form is allre
PHP4 to PHP5 Conversion
Hi Everyone,
I am working on a site that is built up on PHP4 and each page is being started f
How to disable direct access to a file
Suppose I've 2 Files. 1.php & 2.php
I don't want anybody to access 2.php directly fr
Is there a function ... auto send IP
Is there some function that can be sent to a ddns service that returns the ip address of a ddns forw
this code is not working????
it says this error.. Warning: Division by zero in ..
the variables are correct, so why is th