redirection

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
zuzupus
Forum Commoner
Posts: 70
Joined: Thu Jul 17, 2003 4:54 am

redirection

Post by zuzupus »

hi,

i want to get rid of these names in array as these names r coming from table t_user and there is boolean field name intern='t' for these users

if (isset($HTTP_POST_VARS['account'])){
$accounts = array("aa", "bb", "cc", "dd", "ee", "ff", "jj");
if (in_array($HTTP_POST_VARS['account'],$accounts)) {
header("Location:index.phtml");
}
else {
header("Location:index1.phtml");
}
}

i just dont want to mention these names is it possible to redirect the page without using hardcoded names

hope this is clear for everybody

regards
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

I'm not clear on what you are trying to do - you don't want to hardcode the $accounts array but create it dynamically from information from a database?

Mac
zuzupus
Forum Commoner
Posts: 70
Joined: Thu Jul 17, 2003 4:54 am

Post by zuzupus »

$sql = "SELECT name FROM t_user WHERE intern='t' "
$res = mysql_query($sql);
while ($row = mysql_fetch_row($res)) {
$accounts[] = $row[0];
}


now it works fine thanks for your info

regards
zuzupus
Forum Commoner
Posts: 70
Joined: Thu Jul 17, 2003 4:54 am

Post by zuzupus »

sorry mac for trouble

if (in_array($HTTP_POST_VARS['account'],$accounts)) {
header("Location:index.phtml");//having 3 frames for internal users
}
else {
header("Location:index1.phtml");//having 2 frames for external users
}

as this index1.phtml (2 frames)i used to redirect for external users is it possible that in index.phtml itself i show internal users for 3 frames and for externals 2 frames without writing diff. index1.phtml


regards

Code: Select all

//so when internal users login they will get this page and once_query_array
written in lib.php
<? $dir = './'; require($dir.'lib.php'); get_session(); ?>
<? if (!$session->login) send_location_die('login.phtml?error=true');
   list($user) = once_query_array("SELECT  user FROM t_user WHERE intern='t'");
   if ($user) { 
    $loc = "log.phtml";
    }
?>


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<frameset framespacing="0" frameborder="0" border="0" rows="85%,15%">
              <FRAMESET cols="20%,80%*">
              <frame src="pane.phtml" name="pane" scrolling="auto" />
              <frame src="blank.phtml" name="content" scrolling="auto" />
              </FRAMESET>
<frame src="<?PHP echo $loc; ?>" name="log" scrolling="auto" />
 </frameset>
   <noframes>
     <body>
            &nbsp;
        </body>
 </noframes>
</html>

//index1.phtml for external users //

<? $dir = './'; require($dir.'lib.php'); get_session(); ?>
<? if (!$session->login) send_location_die('login.phtml?error=true'); ?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<frameset framespacing="0" frameborder="0" border="0" cols="220,*">
<frame src="pane.phtml" name="pane" scrolling="auto" />
<frame src="blank.phtml" name="content" />
</frameset>
<noframes>
<body>
&nbsp;
</body>
</noframes>
</html>

hope this clear
Post Reply