Page 1 of 1

Strange PHP code problem, across frames

Posted: Wed Mar 02, 2005 3:30 pm
by beeblebrox
I'm trying to develop a login/verification script (well, set of scripts, anyway). Right now, I have a login form in one page that, when submitted, calls the PHP page. The PHP page validates the user, checks permissions, and then displays a menu, based on the permissions of the account.

That works great.

Putting this code into frames breaks my PHP for some reason - it doesn't translate as PHP, but as partial PHP and partial HTML.

Has anyone ever run into this before?

Here's the login code:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<meta name="generator" content="Adobe GoLive">
		<title>uroSpec test login page</title>
	</head>
<link rel="StyleSheet" href="urospec-style.css" type="text/css" title="whatever">
	<body bgcolor="#ffffff">
		<form id="FormName" action="urospec.php" method="post" name="loginForm" target="top_bar">
			<label>Login: </label><input type="text" name="login" size="24" tabindex="1">
			<BR><label>Password: </label><input type="password" name="pw" size="24" tabindex="2"> <input type="submit" name="submitButtonName" value="Log In" tabindex="3"></p>
		</form>
		<p></p>
	</body>

</html>
This is the PHP script:

Code: Select all

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<meta name="generator" content="Adobe GoLive">
		<title>Urology Specialists of Coastal Georgia</title>
	</head>
		<link rel="StyleSheet" href="urospec-style.css" type="text/css" title="whatever">
	<body>

<?  

import_request_variables("P", "i_");

$hostname = "localhost"; 
$username = "&#1111;b]edited out&#1111;/b]";
$password = "&#1111;b]edited out&#1111;/b]"; 

mysql_connect($hostname, $username, $password) OR DIE("DB connection unavailable");
mysql_select_db('urospec_data');

function show($func, $image)
	&#123;
	echo '<A HREF="'.$func.'"><IMG SRC="images/'.$image.'" border="0"></A><BR>';
	&#125;

function addUser()
	&#123;
	echo "Add user.<BR>";
	&#125;

function addBlog()
	&#123;
	echo "Add Blog menu.<BR>";
	&#125;

function adminMenu()
	&#123;
	echo "Admin menu.<BR>";
	show ('viewData', 'dataimg.jpg');
	show ('addUser', 'adduser.jpg');
	show ('addBlog', 'addblog.jpg');
	&#125;
	
function userMenu()
	&#123;
	echo "User menu.<BR>";
	&#125;
	
function viewData()
	&#123;
	echo "Viewdata menu.<BR>";
	&#125;
	

function verifyUser($i_login, $i_pw)
	&#123;
		$loginquery = 'select * from users where u_name = "'.$i_login.'"';
		$loginresult = mysql_query($loginquery) OR DIE(mysql_error());

		while ($login = mysql_fetch_row($loginresult))
			&#123;
			if ($i_login == $login&#1111;0]) &#123;
				if ($i_pw == $login&#1111;1]) &#123;
					if ($login&#1111;2] == "admin") &#123;
						adminMenu();
						&#125;
					&#125;
				&#125;
			if ($i_login == $login&#1111;0]) &#123;
				if ($i_pw == $login&#1111;1]) &#123;
					if ($login&#1111;2] == "user") &#123;
						userMenu();
						&#125;
					&#125;
				&#125;
			if ($i_login == $login&#1111;0]) &#123;
				if ($i_pw == $login&#1111;1]) &#123;
					if ($login&#1111;2] == "patient") &#123;
						viewData();
						&#125;
					&#125;
				&#125;
			&#125;
	&#125;

// catchAction();

verifyUser($i_login, $i_pw);

?>



	</body>
</html>
Yes, there are "blank" functions in there right now. They are not the issue. The problem is that the PHP script works fine without frames; it is only when I try to implement frames that the problem occurs.

Can anyone help?