Thread: MYSql Quering
View Single Post
Old 12-05-2002, 09:29 PM   PM User | #10
mat
Regular Coder

 
Join Date: Jul 2002
Posts: 199
Thanks: 0
Thanked 0 Times in 0 Posts
mat is an unknown quantity at this point
Each font is in the database so i take it, each will have a unique ID. Pass this ID to the download script.

<a href="download.php?download=yes&font=ID">Download</a>




<?php
if(!isset($download)){

include "../dbConnect.php";

$sql1 = "SELECT COUNT(password) FROM fontsTable WHERE ID = '$font'";

$numRows = mysql_num_rows($sql1);

if($numRows == 1){

echo"
<form method='post' action='download.php'>
<input type='text" name='passwordInput'>
<input type='hidden' name='font' value='$font'>
<input type='submit' name='submit' value='go'>
</form>
";

}else{

download font?
}

}
?>


<?php
if(!isset($submit){

include "../dbConnect.php";

$sql2 = "SELECT password FROM fontsTable WHERE ID = '$font'";

while ($row = mysql_fetch_array($sql2)){
$correctPass= $row['password'];

if($passwordInput == $correctPass){

yay! download font from DB... don't ask me

}else{

echo"incorrect pass";
( actually you should redirect with a query string '?invalidPass=yes' so that the form comes up again but with an incorrect message. )

}


}

?>




I'm no php brain.. but this may help a little bit I've also never actually downloaded a file from a database so ? i'm sure someone else can point out how

Last edited by mat; 12-05-2002 at 11:17 PM..
mat is offline   Reply With Quote