problem with login
Posted: Thu Jul 08, 2010 8:14 am
hello......
i have a site on a free php, mysql host and i can't seem to make login to work.
i have a db created and a table called admin with one user(1, admin, pass)
when i use:
it work but it bypasses login form by always connecting with the user in table "admin"
but when i use
it always says wrong username or password! what am i doing wrong? could it be because of the free host?
i have a site on a free php, mysql host and i can't seem to make login to work.
i have a db created and a table called admin with one user(1, admin, pass)
when i use:
Code: Select all
[color=#BF0040]<?php
ob_start();
include("ofnibd.php");
mysql_connect("$hostname", "$username", "$password")or die("cannot connect");
mysql_select_db("$database")or die("cannot select DB");
$user=$_POST['admin'];
$parola=$_POST['password'];
$sql="SELECT * FROM admin WHERE user='admin' and parola='pass'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("user");
session_register("parola");
header("location:update_oferta.php");
}
else {
header("location:main_login.php?eroare=eroare");
}
?>[/color]but when i use
Code: Select all
[color=#FF0000]<?php
ob_start();
include("ofnibd.php");
mysql_connect("$hostname", "$username", "$password")or die("cannot connect");
mysql_select_db("$database")or die("cannot select DB");
$user=$_POST['admin'];
$parola=$_POST['password'];
$sql="SELECT * FROM admin WHERE user='$user' and parola='$parola'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("user");
session_register("parola");
header("location:update_oferta.php");
}
else {
header("location:main_login.php?eroare=eroare");
}
?>
[/color]