page redirection based on user
Hey Jason
Am trying to get this to redirect to a specific page if its specifically a user and another page if it isnt that user. The code isnt working as it takes all users to the news_results page regardless if they have UserID 6 or not.
<?php require_once('../Connections/DBConnection.php'); ?>
<?php require_once('../webassist/mysqli/rsobj.php'); ?>
<?php
$Users = new WA_MySQLi_RS("Users",$DBConnection,1);
$Users->setQuery("SELECT UserID FROM pcms2_users");
$Users->execute();
?>
<html>
<title></title>
<body>
<?php
if ("".($Users->getColumnVal("UserID")) ."" == "6") { // Show If
?><script type="text/javascript">
window.location.replace("product_contents_results.php");
</script>
<?php
} // ("".($Users->getColumnVal("UserID")) ."" == "6")
?>
<?php
if ("".($Users->getColumnVal("UserID")) ."" != "6") { // Show If
?><script type="text/javascript">
window.location.replace("news_results.php");
</script>
<?php
} // ("".($Users->getColumnVal("UserID")) ."" != "6")
?>
</body>
</html>
There is probably a more elegant solution that you may be able to point me in the right direction for?
Cheers
Jamie