Forum Moderators: coopster

Message Too Old, No Replies

Security problem PHP

         

petenyce106

2:16 pm on Feb 20, 2004 (gmt 0)

10+ Year Member



I have a popup window that displays a login. once the user is validated the it shows them the page. now how can i get it so if the user copys and pasted the link it will bring them to the login popup window or to a aauthroziation page?

heres the code

<html>

<head>
<title>Referral History Look Up</title>

</head>

<body bgcolor="006666">
<?php
if ($_POST['Facid']!= "") $Facid = $_POST['Facid'];
if ($Facid!= "") {
@ $db = mysql_pconnect('localhost', 'e', 'pass');

if (!$db) {
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
$listing_query = "select * from ehpadmin.Facility where Facid = '".$Facid."'";
$listing_result = mysql_query($listing_query) or die("Error in return query<br>".mysql_error());
$num_rows = mysql_num_rows($listing_result);
if ($num_rows == 0) {
echo '<font color="white"><b>Please try again</b></font></br></br>';
print "Practice ID invalid.</br></br>";
echo '<a href ="poup.html"><font color="white">Back</font></a>';

} else {
?>
<script language="JavaScript">
window.location = "reports_1st_quarter.htm";
</script>
<?php
}
} else {?>
<form method="POST">
<p align="left"><b><font color="#FFFFFF">Enter Practice Id</font></b></p>
<p align="left">
<input type="text" name="Facid" size="20">
<input type="submit" value="Go">
</p>
</form>

<?php }?>
<p align="center">&nbsp;</p>
</body>

</html>

jatar_k

4:39 pm on Feb 20, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld petenyce106,

You need something to test against. Do you set a cookie or load info into a session? How do you know they are logged in?

I use sessions for this. I can then test to see if the session is present and has appropriate values set, else I bounce them to the login screen.