SkH Posted June 7, 2008 Share Posted June 7, 2008 Hello everyone! I have a small problem with my script: <img src="px.png" width="1" height="1" /> <?php require("stats/required.php"); header("Location: http://www.google.com"); ?> I want the "page" run the required.php (it's a counter), but it don't run, I tried it with a text on the page too but what I got it NO text! So I think it skips everything and just use the header part. Is there any way to fix this script to run the required.php and redirect at the same time? If I call it directly it don't logs either because it's needs a page with 1x1 pic. Any workaround welcome. Thank You very much in advance! Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/ Share on other sites More sharing options...
kbh43dz_u Posted June 7, 2008 Share Posted June 7, 2008 try " include" instead of "require" Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/#findComment-559727 Share on other sites More sharing options...
SkH Posted June 7, 2008 Author Share Posted June 7, 2008 try " include" instead of "require" Don't work. :'( Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/#findComment-559728 Share on other sites More sharing options...
ILYAS415 Posted June 7, 2008 Share Posted June 7, 2008 after you require your script do this instead of header... echo "<meta http-equiv='refresh' content='2; url=http://www.google.com'>"; Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/#findComment-559731 Share on other sites More sharing options...
SkH Posted June 7, 2008 Author Share Posted June 7, 2008 after you require your script do this instead of header... echo "<meta http-equiv='refresh' content='2; url=http://www.google.com'>"; OK, I thought of it too but that takes away the php's function, I have multiple pages like this: (upgraded my script) <img src="px.png" width="1" height="1" /> <?php include("stats/required.php"); $id =$_GET['id']; if ($id == "") {$link = "http://yahoo.com";} //Default Blank if ($id == "1") {$link = "http://ebay.com";} // ebay if ($id == "google") {$link = "http://www.google.com";} // google header('HTTP/1.1 301 Moved Permanently'); // Clean 301 header header("Location: $link"); // Jump to the link ?> Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/#findComment-559733 Share on other sites More sharing options...
ILYAS415 Posted June 7, 2008 Share Posted June 7, 2008 wat do u mean it takes away the php's function? Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/#findComment-559734 Share on other sites More sharing options...
SkH Posted June 7, 2008 Author Share Posted June 7, 2008 wat do u mean it takes away the php's function? Like, I can't store multiple address in a file and use them as this: file.php?id=google Also when I do exit(); after the required code, it logs, but don't execute the header part. Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/#findComment-559736 Share on other sites More sharing options...
ILYAS415 Posted June 7, 2008 Share Posted June 7, 2008 Have you got a demo of the script available? Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/#findComment-559738 Share on other sites More sharing options...
SkH Posted June 7, 2008 Author Share Posted June 7, 2008 Um, well, you want to see the required.php's code? OK: <? if (file_exists("stats/log/blocked/list")) { $mamamu = fopen("stats/log/blocked/list","r"); while(!feof($mamamu)) { $basi = fread($mamamu,5000); } fclose($mamamu); } if (preg_match ("/".$HTTP_SERVER_VARS['REMOTE_ADDR']."/i", $basi)) { } else { $language = "&language=".$HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE']; $host = "&host=".$HTTP_SERVER_VARS['HTTP_HOST']; $ide = preg_replace("/&/","RUSIN40",$HTTP_SERVER_VARS['HTTP_REFERER']); $ref = "&ref=".$ide; //$url = "&url=".$HTTP_SERVER_VARS['phpSelf']; $browser = "&browser=".$HTTP_SERVER_VARS['HTTP_USER_AGENT']; $remadr = "&remadr=".$HTTP_SERVER_VARS['REMOTE_ADDR']; $remhos = "&remhos=".gethostbyaddr($_SERVER['REMOTE_ADDR']); setlocale (LC_TIME, "en_UK"); $year = "&year=".strftime ("%Y"); $month = "&month=".strftime ("%m"); $month_name = "&month_name=".strftime ("%B"); $day_week = "&day_week=".strftime ("%A"); $week = "&week=".strftime ("%W"); $day = "&day=".strftime ("%d"); $hour = "&hour=".strftime ("%H"); $minute = "&minute=".strftime ("%M"); $second = "&second=".strftime ("%S"); $day_of_year = "&day_of_year=".strftime ("%j"); $uri = $HTTP_SERVER_VARS['REQUEST_URI']; $url = stripslashes("http://".$HTTP_SERVER_VARS['SERVER_NAME'].$uri); $ide = preg_replace("/&/","RUSIN40",$url); $url = "&url=".$ide; $unique = $browser.$remadr."\n"; ?> <script language="javascript"> <!--// var cpu = window.navigator.cpuClass; var platform = window.navigator.platform; if (navigator.appname != 'Netscape') {color= "?color="+screen.colorDepth+"&cpu="+cpu+"&platform="+platform;} else {color = "?color="+screen.pixelDepth;} avail = "&avail="+screen.availwidth+"x"+screen.availheight; res = "&res="+screen.width+"x"+screen.height; isize = '" width="0" height="0" border="0" hspace="0" vspace="0"'; img = '<div id="counter" style="position:absolute; left:0px; top:0px; width:1; height:1; z-index:1"><img name="img" src="stats/log.php'+color+'<? echo $language.$host.$ref.$browser.$url.$remadr.$remhos.$year.$month.$month_name.$day_week.$week.$day.$hour.$minute.$second.$day_of_year.$uri;?>'+avail+res+isize+'"></div>'; document.write(img); //--> </script> <? } ?> I'm sure it have some errors in it... but I want to sue this as it's very detailed logging system. Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/#findComment-559740 Share on other sites More sharing options...
SkH Posted June 8, 2008 Author Share Posted June 8, 2008 Ah, finally got it working with echo "<meta http-equiv='refresh' content='0; url=http://www.google.com'>"; So thanks and then again thanks the nothing... Quote Link to comment https://forums.phpfreaks.com/topic/109114-solved-the-requirefile-wont-work-help/#findComment-560296 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.