lucky-8
11-16-2007, 07:22 AM
<lots of HtML Code>
<?php
$user=$_POST['name'];
$pass=$_POST['pass'];
$obj=new db();
$obj->connect("root","","scp");
$query="select * from client_info where client_login_name_email='$user' and
client_password like '$pass' ";
$result=$obj->query($query);
//echo $result;
if($obj->numrow($result)==1)
{
$display="<a href=cust_reg.php>Enter New Customer Report</a> | ";
$display.="<a href=#>View Existing Customer Reports</a></align>";
echo $display;
}
else
{
echo "Access Denied";
}
?>
<the above is again followed by html code>
I have 3 questions in mind....
1. Is this the correct style of coding or should i put in all kinds of querieng in one php class file and calling those methods only from a php file, is it ok to have php in between the html like this.
2.Once the user is authenticated from the database i want the browser to load another page how do i do that, i mean what code should i rite in the if.......... or should this be done rite on top before the headers are sent.
3. Using SQL injection i should be able to crack this password by entering
something' OR 'x=x but it doesnt crack......why is that?
<?php
$user=$_POST['name'];
$pass=$_POST['pass'];
$obj=new db();
$obj->connect("root","","scp");
$query="select * from client_info where client_login_name_email='$user' and
client_password like '$pass' ";
$result=$obj->query($query);
//echo $result;
if($obj->numrow($result)==1)
{
$display="<a href=cust_reg.php>Enter New Customer Report</a> | ";
$display.="<a href=#>View Existing Customer Reports</a></align>";
echo $display;
}
else
{
echo "Access Denied";
}
?>
<the above is again followed by html code>
I have 3 questions in mind....
1. Is this the correct style of coding or should i put in all kinds of querieng in one php class file and calling those methods only from a php file, is it ok to have php in between the html like this.
2.Once the user is authenticated from the database i want the browser to load another page how do i do that, i mean what code should i rite in the if.......... or should this be done rite on top before the headers are sent.
3. Using SQL injection i should be able to crack this password by entering
something' OR 'x=x but it doesnt crack......why is that?