help me in php code(redirect link to other wap site)

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Tue Apr 24, 2007 6:17 am    Post subject: help me in php code(redirect link to other wap site) Reply with quote

i use wapbuddy ,,the language is PHP...

i want to write when user go to xxx.com/livescore
it will auto direct to wap.livescore.com

but hot to write???

inside xxx.com/livescore just have this index.php
Code:
<?
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"http://www.wapforum.org/DTD/wml_1.1.xml\">";

include("../wapbuddy_settings.php");
if (!isset($page)) {$page = 0;}
$total = 0;

if(!($dp = opendir("./"))) die ("Cannot open ./");
$file_array = array();
while ($file = readdir ($dp))
   {
   if(substr($file,0,1) != '.' and $file != "index.php")
      {
      $file_array[] =  $file;
      }
   }
$file_count = count ($file_array);
sort ($file_array);
?>
<wml>
<card id="card1" title="<? echo $conf["site_name"] ?>">
   <p mode="nowrap">
      <do type="option" label="Home"><go href="../index.php"/></do>
      <? echo "<a href=\"../index.php\">Home</a><br/><br/>"; ?>
      <?
      
      if ($file_count > 0)
         {
         $first_record = $page * $conf["items_per_page"];
         $last_record = $first_record + $conf["items_per_page"];
         
         while (list($fileIndexValue, $file_name) = each ($file_array))
            {
            
            if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
               {
         
               echo "<a href=\"$file_name\">$file_name</a> (". round(filesize($file_name)/1024,1) . "kb)<br/>";
               $total = $total + filesize($file_name);
               }
            }
         
         if (($file_count > 0) AND ($page != 0))
            {
            // previous button
            $prev_page = $page -1;
            echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">Prev</a><br/>";
            }
         
         
         if (($file_count > 0) AND ($last_record < $file_count))
            {
            // next button
            $next_page = $page + 1;
            echo "<br/><a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next</a><br/>";
            }
         echo "<br/>Directory:<br/>$file_count ";
         if ($file_count == 1)
            {echo "file";}
         else
            {echo "files";}
            
         echo " (" . round($total/1024,1) . "kb)";
         echo "<br/><a href=\"../index.php\">Home</a>";
         }
      closedir($dp);
      ?>
      
   </p>
</card>
</wml>

_________________
Back to top View user's profile Send private message Visit poster's website
AbyssUnderground
-


Joined: 31 Dec 2004
Posts: 3855

PostPosted: Tue Apr 24, 2007 7:45 am    Post subject: Reply with quote

Code:
<?php header("Location: http://wap.whatever.com"); ?>


This doesn't include user checking however.
_________________
Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk
Back to top View user's profile Send private message Visit poster's website
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Tue Apr 24, 2007 10:13 am    Post subject: Reply with quote

ok....thank you very much
_________________
Back to top View user's profile Send private message Visit poster's website
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Tue Apr 24, 2007 4:04 pm    Post subject: Reply with quote

Code:
<?php
header("Location: http://wap.site.com");
die();
?>


You should use die() after redirecting a user using a header.
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Tue Apr 24, 2007 4:34 pm    Post subject: Reply with quote

Actually, exit is the function you use, according to the PHP docs.
http://us.php.net/header
Back to top View user's profile Send private message Visit poster's website
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Tue Apr 24, 2007 9:41 pm    Post subject: Reply with quote

TRUSTAbyss wrote:
Actually, exit is the function you use, according to the PHP docs.
http://us.php.net/header


php.net wrote:
Note: The die() function is an alias for exit().
Back to top View user's profile Send private message
chewzzqq
-


Joined: 28 Sep 2005
Posts: 198

PostPosted: Wed Apr 25, 2007 5:23 am    Post subject: Reply with quote

thx very much.........all
_________________
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group