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