Hi,
     I m using php and msaccess for developing my website.when click on the pdf 
link it should ask for login information and if it correct then the pdf should 
open. it is working fine in my local machine but once i upload ,then the pdf 
file is not opening. can anyone help me in this.
 
this is the code for the pdf link
<a href="login.php?pdfname=pdfs/page4.pdf" target="_blank">
 
login.php
 
<?php
session_start();
session_register("pdf");
$pdf=$_GET['pdfname'];
if($userid && $password)
{
import_request_variables("P","login");
$id=$loginuserid;
$pwd=$loginpassword;
$odbc = odbc_connect ('LoginInformation', 'enirvan', 'enirvan') or die('Could   
 Not Connect to ODBC Database!'); 
 if(!function_exists('odbc_fetch_array')) 
{ 
  function odbc_fetch_array($result1, $rownumber=-1) 
  { 
      if (PHP_VERSION > '4.1') 
      { 
          if ($rownumber < 0) 
          { 
              odbc_fetch_into($result1, $rs); 
          } 
          else 
          { 
              odbc_fetch_into($result1, $rs, $rownumber); 
          } 
      } 
      else 
      { 
          odbc_fetch_into($result1, $rownumber, $rs); 
      } 
       
      $rs_assoc = Array(); 
   
      foreach ($rs as $key => $value) 
      { 
          $rs_assoc[odbc_field_name($result1, $key+1)] = $value; 
      } 
       return $rs_assoc; 
  } 
}
 $result = odbc_exec($odbc,"select * from customers where user='$id' and 
password='$pwd'");
while($row = odbc_fetch_array($result)) 
{ 
$valid_user = $userid;
session_register("valid_user");
}
}
?>
<html>
<body>
<?php
if(session_is_registered("valid_user"))
{
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td><div align=\"center\"><a href=\"logout.php\">Log out</a></div></td>";
echo "</tr>";
echo "</table>";
session_register("pdf");
$pdf=$_GET['pdfname'];
?>
<?php
session_register("pdf");
$pdf=$_GET['pdfname'];
echo "<script language=\"JavaScript\">";
echo ' window.open("'.$pdf.'","","resizable=1,width=700,height=600,status=1")';
echo "</script>";
?>
<?php
}
else
{
if (isset($userid))
{
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td><div align=\"center\">Could not log you in</div></td>";
echo "</tr>";
echo "</table>";
}
else
{
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td><div align=\"center\">You are not logged in</div></td>";
echo "</tr>";
echo "</table>";
}

echo "<form method=post name=login action=\"login.php?pdfname=$pdf\">";
echo "<table align=\"center\">";
echo "<tr><td>Userid:</td>";
echo "<td><input type=text name=userid></td></tr>";
echo "<tr><td>Password:</td>";
echo "<td><input type=password name=password></td></tr>";
echo "<tr><td colspan=2 align=center>";
echo "<input type=submit value=\"Log in\"></td></tr>";
echo "</table></form>";
}
?>
<br>
<?php
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td><div align=\"center\">Not a Registered user? <a href=\"register.htm\" 
target=\"_blank\"> Click Here</a></div></td>";
echo "</tr>";
echo "</table>";
?>
</body>
</html>


Send instant messages to your online friends http://au.messenger.yahoo.com 

[Non-text portions of this message have been removed]



The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to