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
Preloading images
Posting this question here because I am not sure where this should belong.I am building an asp.net a
Parse error: syntax error, unexpected T_ELSEIF in /home/......html/item.php on l
I do not know what is wrong with this. Hope some one can help. I do nto want to post the entire site
Require select-option functionality in Module Pool Programming
Hi Gurus,
I am doing a development by Module Pool on Warehouse Management. For that devel
what business processes?
Hi,
A general question. What business processes (like OTC - Order to Cach, P2P, R2R etc)
Sort a two dimensional array.
Hi. I've set up a two dimensional array that reads as follows:
Code: $modifiedData = array(
array empty
Hiya peeps,
Ok here is the codes.
order.php
Code:
Hi, explode and strstr.
Hi, I seem to be confused about the strstr function, eg. i have a string like:
"a.b.c.d.e.f&
help with contest script
I would like to code a contest script to my site but i don't know how. Could someone just give me pu
Showing selected item at top of list
Hi,
I've got a list of names which i am fetching from database like this:
$qry = db_query
Code Review - SQL and Insertion Attacks (Warning: Not for Newbs)
Hey guys,
Its been a while, I know. Use to love coming here to answer peoples questions, but