index.php HTML Redirect -- Why?

Here is my index.php for a website I took over. My reading tells me the index.php should be like a MVC controller (all the direction logic for the site). I changed the website name to protect my employer.

<html>
<head>
        <META HTTP-EQUIV="Refresh" CONTENT="0; URL=https://my.companywebsite.com/main/login.php">
        <title>Welcome to Content Management</title>
</head>

</html>

Why is it coded this way? Shouldn’t you use a require statement to invoke the login.php?

I am trying to set up a test environment on my laptop. How do I recode the URL to go to the login.php? I am thinking

        <META HTTP-EQUIV="Refresh" CONTENT="0; URL=main/login.php">

I tried coding the URL as main/login.php and my login.php formatting shows up all skewed. See attachment.


It looks like it’s not running that page as PHP. That’s why the formatting looks skewed.

I see that the index.php doesn’t have PHP tags. The login.php does have PHP tags
[php]

<? //--### //require_once ("../LIBS/secure.php"); //----- for Coporate pages -----// //Global variables include $PATHS, DB HOST, DB UID, DB PWD, DB SCHEMA //MySQL_LIB is various mysql functions if($from_CoPage==1){ //$from_CoPage used when login from Coporate pages include_once("../../LIBS/global_vars.inc"); include_once("../../LIBS/mysql_lib.php"); }else{ $from_CoPage=''; include_once("../LIBS/global_vars.inc"); include_once("../LIBS/mysql_lib.php"); } //--### ?> [/php]

How do I recode my index.php so I can get the login.php to look normal and work properly in my test environment?

Looks like your index page is using short tags.

You might want to read up on that…

http://www.php.net/manual/en/ini.core.php#ini.short-open-tag

I understand the site is using short tags. Do you think the short tags is what is causing me issues in my test environment?

It’s hard to tell you didn’t post the code to the login.php page.

Here’s the code for the login.php. Thanks for all of your help.

[php]

<? //--### //require_once ("../LIBS/secure.php"); //----- for Coporate pages -----// //Global variables include $PATHS, DB HOST, DB UID, DB PWD, DB SCHEMA //MySQL_LIB is various mysql functions if($from_CoPage==1){ //$from_CoPage used when login from Coporate pages include_once("../../LIBS/global_vars.inc"); include_once("../../LIBS/mysql_lib.php"); }else{ $from_CoPage=''; include_once("../LIBS/global_vars.inc"); include_once("../LIBS/mysql_lib.php"); } //--### ?> <? echo "Welcome to ", $page_title ?> <?

//Unused Code
if($AID!=’’) {
$pn_id = $AID;
}
$pass_pnid = 0;
/*
if($log_ops==‘S’){
$SOL_URL = $SOLS_URL;
$PATH_IMG = $PATHS_IMG;
}else{
$SOL_URL = $SOLU_URL;
$PATH_IMG = $PATHU_IMG;
}
echo "PATH_IMG =$PATH_IMG PATHU_IMG=$PATHU_IMG SOLU_URL=$SOLU_URL
";
*/
?>

	<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
	<!--<TR>
		<TD><IMG SRC="< ? echo $PATH_IMG ?>/pixel_clear.gif" WIDTH=1 HEIGHT=25 BORDER="0"></TD>
		
	</TR>--> 
	
	<TR><?/* Homeconstruction.gif */?>
		<TD><IMG SRC="<? echo $PATH_IMG ?>/construction1.gif" BORDER="0"></TD>
		
		<TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
		<TD ID="default">
		<FONT SIZE=2 FACE=ARIAL COLOR="#B0A986"><B>Member Login</B></FONT><BR>
		<IMG SRC="<? echo $PATH_IMG ?>/pixel_clear.gif" WIDTH=1 HEIGHT=15 BORDER="0"><BR>
		<FONT SIZE=1 FACE=VERDANA COLOR=#1A4C8F>email address:</FONT><BR>
		<?
			if ($action1 == "login1") {
				print("<input type=\"text\" name=\"the_mail\" value=\"$the_mail\" size=\"28\"><BR>");
			}else{
                                    //Stripslashes will remove quotes
				$the_mail = stripslashes($HTTP_COOKIE_VARS[SCKCookie]);
				print("<input type=\"text\" name=\"the_mail\" value=\"$the_mail\" size=\"28\"><BR>");
			}
		?>
		<IMG SRC="<? echo $PATH_IMG ?>/pixel_clear.gif" WIDTH=1 HEIGHT=10 BORDER="0"><BR>
		<FONT SIZE=1 FACE=VERDANA COLOR=#1A4C8F>password:</FONT><BR>
		<input type="password" name="the_pass" size="28" onKeypress="checkkey(event);"><BR>
		<IMG SRC="<? echo $PATH_IMG ?>/pixel_clear.gif" WIDTH=1 HEIGHT=5 BORDER="0"><BR>
		<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=200>
		<TR>
			<TD VALIGN=MIDDLE><a href="javascript:Login()"><img src="<? echo $PATH_IMG ?>/btn_login.gif" border="0" alt="submit"></a></TD>
		</TR>
		</TABLE>
		
		</TD>
	</TR>
	</TABLE>
[/php]

Yeah, it’s not processing your short tags. Did you read that link I provided? Did you check your php.ini to make sure you have it turned on in your test environment?

I read that you shouldn’t use the short_open_tag because it is used in a lot of other languages but remains here for backward compatibility.

I set my short_open_tag = On. It looks like it resolved the formatting issue I saw in the login.php.

Thanks for all of your help, I truly appreciate it.

Sponsor our Newsletter | Privacy Policy | Terms of Service