This topic is locked

simple pdf view

2/10/2008 8:15:10 PM
PHPRunner General questions
B
badgerdid author

I hope sum1 can help with this, i have a table with username, password, and file
All i want is if a customer enters the correct username and password it will show them a pdf report in the file.
I can get the login bit working but cannot work out how to show a file, theres plenty of examples on the web but there all mainly basic logins to view a page, how do i get it to open a file, you enter a username and password in a form and then its passed to another one for checking, this is what i got off the web for that
$host="localhost"; // Host name

$username=""; // Mysql username

$password=""; // Mysql password

$db_name="users"; // Database name

$tbl_name="members"; // Table name
// Connect to server and select databse.

mysql_connect("$host", "$username", "$password")or die("cannot connect");

mysql_select_db("$db_name")or die("cannot select DB");
// Define $myusername and $mypassword

$myusername=$_POST['myusername'];

$mypassword=$_POST['mypassword'];

$
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";

$result=mysql_query($sql);
// Mysql_num_row is counting table row

$count=mysql_num_rows($result);

// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){

// Register $myusername, $mypassword and redirect to file "login_success.php"

session_register("myusername");

session_register("mypassword");

header("location:index.php");

}

else {

header("location:wrong.php");
where and how do i add the stuff in to tell it if username and password are correct, open this file, i.e report.pdf
please help as im new and im struggling here
thanks

dave

J
Jane 2/11/2008

Dave,
this is a PHPRunner related forum. Your question has nothing to do with PHPRunner.