help wml to html

Started on the old forum in February 2011 · view the original in the archive · old links redirect here

22 replies · 998 views · started 15 years ago · 1 min read

5 participants
naveed Junior · 17 posts #1

hi guys please help me convert this little script from wml to html i tried but got errors lol 😊 here is it

<?php
error_reporting(0);
include("cnfg.php");
$ms=mysql_connect($host,$login,$pass) or exit;
mysql_select_db($db) or exit;
$res=mysql_query("Select * From `online` Order By time Desc");
$mrp=array("SIE-"=>"Siemens ","MOT-"=>"Motorola "); $n=0; $arr=NULL; $st="";
while ($ar=mysql_fetch_array($res,MYSQL_ASSOC)) {$n++; $ua="";
 $ua2=htmlspecialchars(str_replace('$','$$',trim(strtr($ar["ua"],$mrp))),ENT_QUOTES);
 for ($i=0;$i<strlen($ua2);$i++) {
  if (($ua2[$i]<>"/")&&($ua2[$i]<>" ")) {$ua.=$ua2[$i];} else {break;}
 }
 $arr[]="<b>$n</b>. ".trim($ar["ip"])."; $ua; ".date("H:i:s",$ar["time"])."<br/>";
}
mysql_close($ms);

$cnt=count($arr); $nm=15; $allp=ceil($cnt/$nm);
$p=trim($_GET['p']); if ($p<1) {$p=1;} elseif ($p>$allp) {$p=$allp;}
$begin=$p*$nm-$nm; if ($begin>$cnt-1) {$begin=0;}
$end=$begin+$nm; if ($end>$cnt-1) {$end=$cnt;}
for ($i=$begin;$i<$end;$i++) {$st.=$arr[$i];} $lks="";
if ($p>1) {$v=$p-1; $lks.="<a href=\"users.php?p=$v\">Предыдущие</a><br/>\r\n";}
if ($allp>$p) {$v=$p+1; $lks.="<a href=\"users.php?p=$v\">Следующие</a><br/>\r\n";}
if ($lks<>NULL) {$lks.="- - -<br/>";}

header("Content-Type: text/vnd.wap.wml; charset=Utf-8");
echo ("<?xml version=\"1.0\" encoding=\"Utf-8\"?><!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml_1.2.xml\"><wml><head><meta forua=\"true\" http-equiv=\"Cache-Control\" content=\"no-cache\"/></head><card title=\"OnLine\">
<p align=\"left\"><small>
$st
- - -<br/>$lks
<anchor>Назад<prev/></anchor>
</small></p>
</card></wml>");
?>
naveed Junior · 17 posts #3

Lol 😊 can you do it for me pls.. ?

arnage Lead · 811 posts #4

Try...

<?php
error_reporting(0);
include("cnfg.php");
$ms=mysql_connect($host,$login,$pass) or exit;
mysql_select_db($db) or exit;
$res=mysql_query("Select * From `online` Order By time Desc");
$mrp=array("SIE-"=>"Siemens ","MOT-"=>"Motorola "); $n=0; $arr=NULL; $st="";
while ($ar=mysql_fetch_array($res,MYSQL_ASSOC)) {$n++; $ua="";
 $ua2=htmlspecialchars(str_replace('$','$$',trim(strtr($ar["ua"],$mrp))),ENT_QUOTES);
 for ($i=0;$i<strlen($ua2);$i++) {
  if (($ua2[$i]<>"/")&&($ua2[$i]<>" ")) {$ua.=$ua2[$i];} else {break;}
 }
 $arr[]="<b>$n</b>. ".trim($ar["ip"])."; $ua; ".date("H:i:s",$ar["time"])."<br/>";
}
mysql_close($ms);

$cnt=count($arr); $nm=15; $allp=ceil($cnt/$nm);
$p=trim($_GET['p']); if ($p<1) {$p=1;} elseif ($p>$allp) {$p=$allp;}
$begin=$p*$nm-$nm; if ($begin>$cnt-1) {$begin=0;}
$end=$begin+$nm; if ($end>$cnt-1) {$end=$cnt;}
for ($i=$begin;$i<$end;$i++) {$st.=$arr[$i];} $lks="";
if ($p>1) {$v=$p-1; $lks.="<a href=\"users.php?p=$v\">Предыдущие</a><br/>\r\n";}
if ($allp>$p) {$v=$p+1; $lks.="<a href=\"users.php?p=$v\">Следующие</a><br/>\r\n";}
if ($lks<>NULL) {$lks.="- - -<br/>";}

header('Content-type: application/vnd.wap.xhtml+xml');
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" >
<head>
<meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=utf-8"/>
</head>
<body>
<p style="text-align:left;font-size:small;">
'.$st.'
- - -<br/>'.$lks.'
<a href="./">Назад</a>
</p>
</body></html>';
?>
<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
arnage Lead · 811 posts #6

U're welcome.

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
arnage Lead · 811 posts #8

uuups, my mistake. I apologize. 🙂

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
ozziemale31 Lead · 861 posts #9

its how i learnt in the good old days of black nd white screens and pages were basic and the most popular script was neocult cgi people like neo and sub would giv me tips and id have to figure it out from there its what made me a good coder over the years

External image (may be gone) External image (may be gone)

External image (may be gone)

*****

**Dont Ask Me Dumb Questions.Or you'l get a Dumb Answer.. Want A Profesional Logo or Theme For Your wap site Pm Me.If I Have The Time Ill Make It For Free ***

arnage Lead · 811 posts #10

I hope that Naveed is reading this... Should other like too.

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
naveed Junior · 17 posts #11

arnages wrote: I hope that Naveed is reading this... Should other like too.

well i guess u r right but anyways thanks a ton for help. cheers!!!

naveed Junior · 17 posts #12

now pls help me add country flag to this script as it shows ip and browsers only

frostymarvelous Senior · 266 posts #13

Get the IP2country database, some country flag icons from iconarchive, some thinking and you are done.

Perfection comes at a cost

I accept liberty!

naveed Junior · 17 posts #14

the first two things i almost did pls do the last one for me lol😊

frostymarvelous Senior · 266 posts #15

Dude, the first two have already been made for you. Just make the third. Lol.

Lemme give you a hint. Wherever you got The database, there is a tutorial for using it.

You can rename your flags to a match the output from the database, then output an image using

External image (may be gone)

Where $country is the output from the database which should match the respective flag.

Perfection comes at a cost

I accept liberty!

naveed Junior · 17 posts #16

Please mate let me go step by step i am totally unfamilier with coding please bear with me, Flags i do have but Can you please link to ip2country database i tried to search this forum but could not find one

naveed Junior · 17 posts #18

Thanks for that. Now i have both pls help me with coding i am truely new to this

frostymarvelous Senior · 266 posts #19

You're truly incorrigible. Next you'll be telling me to help you install. Unless you are willing to pay for some work, I'm not available.

Perfection comes at a cost

I accept liberty!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close