FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Function Redirect





cr3ativ3
I am trying to put a redirect into a Function but having no luck see here is the function I am trying to redirect I put an echo meta redirect but that didn't have any effect when the function was used.

Code:

function do_delete($file) {
  if ($file == '') return false; /* do nothing for empty file names */
  if (strpos($file, '/') !== false) return false; /* do nothing for file names with a slash in them */
  if (strpos($file, '..') !== false) return false; /* do nothing for file names with ".." in them */
  if ($file{0} == '.') return false; /* do nothing for file names starting with a period */
  if (substr_count($file, '.') != 1) return false; /* do nothing for files without a period, or with two or more periods */
  // now you can delete it
  return unlink("$file");

}


So I was wondering how to get the page to redirect to filemanager.php after it has done this function instead of staying on the function its at.

For example when this function is activated it goes to: filemanager.php?action=delete&what=$file but when it is done on this part of filemanager.php I want it to go directly back to filemanager.php without all the other stuff one then end.

Thanks
Maxus
try
Code:
header("Location: path/url");
AOP Web Development
hello dude you can use javascript instead of header() function that redirect in php.. it think header is not very good.... i will share it to you...


<?
function redirect($str){
if($str!="")
echo"<script>window.location='$str'</script>";
}


?>


how to use it...

<?
$str="member/demo.php";
redirect($str);
?>



that's all, i hope it can help you...


Wink
Stubru Freak
AOP Web Development wrote:
hello dude you can use javascript instead of header() function that redirect in php.. it think header is not very good.... i will share it to you...


<?
function redirect($str){
if($str!="")
echo"<script>window.location='$str'</script>";
}


?>


how to use it...

<?
$str="member/demo.php";
redirect($str);
?>



that's all, i hope it can help you...


Wink


HTTP headers are a lot better then Javascript.
cr3ativ3
Hmmm.. OK thanks I will try these for some reason the last to posts didn't send me an email.. Very Strange..

Thanks.
Related topics
Free Domain & Redirect Services
target = _parent redirect script?
PHP Mail Function
Auto redirect your visitors to a different page
How To : Improve Your PHP Programming
751 Useful Windows XP Files
managing a bilingual site
What u think about my site?
How to write redirection sentence in PHP?
Need help making logout script
Option Redirect
Lan User Redirect Programs?
Redeclared function problem
Non–www and www Redirect – What Method?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.