4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: universal on March 27, 2005, 05:56:59 PM

Title: [MOD] WAP page to download files.
Post by: universal on March 27, 2005, 05:56:59 PM
Today I have made my first mod for 4images gallery  :wink:
I`m using it for a special category for mobile phones, there are a lot of *.mid files, and users can get it by writing its ID in my WAP page. So... there it goes.

Need to edit one file, and create one.
1. Make a dir something like "wap" at your server.
2. Put file named index.php into dir, with this text (edit settings first  :wink: ):
Code: [Select]
<?
//Some settings
$url = 'http://url.to.your.page'; //where installed 4images, without traling slash
$title = 'wap page'; //title for wap card
$no_id = 'ID not found'; //msg when no id found
$enter_id = 'Enteri ID'; //msg when user comes
$button = 'show'; //text for button
$footer = 'footer'; //footer text
$dbhost = "localhost"; //host of database
$dbuser = "root"; //database user
$dbpass = ""; //database pass
$dbname = ""; //and database ;]

//dont need to change after this
header("Content-type: text/wml");
echo("<?xml version=\"1.0\" encoding=\"windows-1257\"?>\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
?>
<wml>
<card title="<? echo $title ?>">
<center>
<form method="post">
<?php 
$id 
$_REQUEST['id'];
if(
$id!=""){
$db mysql_connect("$dbhost""$dbuser""$dbpass") or die ("Error");
@
mysql_select_db("$dbname"$db) or die ("DB not found");
$result mysql_query("SELECT image_id, image_media_file, cat_id, image_name FROM 4images_images where image_id=$id");
$row mysql_fetch_array($result);
$image_id $row["image_id"];
$cat_id $row["cat_id"];
$image_name $row["image_name"];
if (
$image_id!=""){
$image_media_file $row["image_media_file"];
?>

<a href="<? echo $url;?>/data/media/<? echo $cat_id;echo "/";echo $image_media_file; ?>"><? echo $image_name;?></a><br />
<?php }
else { echo 
$no_id; } }
else { echo 
$enter_id; }
?>

<br />
<input name="id" type="text" id="id" size="6" /><br />
<input name="submit" type="submit" value="<? echo $button ?>" />
</form>
<br />
<small>&reg; <? echo $footer ?></small>
</center>
</card>
</wml>

3. Edit details.html and add this where you like:
Code: [Select]
      <tr>
        <td><b>ID for WAP</b></td>
        <td>{image_id}</td>
      </tr>

4. Point your mobile to this page and try it.

By changing this "/data/media/" to "/data/thumbnails/" you can show only small pictures, but i`m using this script for mobile melodies in *.mid format, so it works  :wink:
Sorry for my english.

Good luck ;]
Title: Re: [MOD] WAP page to download files.
Post by: b.o.fan on April 06, 2005, 07:46:09 PM
crazy. but i does´nt go on my system.
http://wap.wartenaufden15.de

why??

my index.php

Code: [Select]
<?
//Some settings
$url = 'http://wartenaufden15.de'; //where installed 4images, without traling slash
$title = 'wap.wartenaufden15.de'; //title for wap card
$no_id = 'ID nicht gefunden'; //msg when no id found
$enter_id = 'Gib die ID ein'; //msg when user comes
$button = 'Anzeigen'; //text for button
$footer = '(c) 2005 by wartenaufden15.de'; //footer text
$dbhost = "localhost"; //host of database
$dbuser = "DBxxxxxx"; //database user
$dbpass = "xxxxxxx"; //database pass
$dbname = "DBxxxxxx"; //and database ;]

//dont need to change after this
header("Content-type: text/vnd.wap.wml");
echo("Content-type: text/vnd.wap.wml\n");
echo("<?xml version=\"1.0\" encoding=\"windows-1257\"\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
?>
<wml>
<card title="<? echo $title ?>">
<center>
<form method="post">
<?php
$id 
$_REQUEST['id'];
if(
$id!=""){
$db mysql_connect("$dbhost""$dbuser""$dbpass") or die ("Error");
@
mysql_select_db("$dbname"$db) or die ("DB not found");
$result mysql_query("SELECT image_id, image_media_file, cat_id, image_name FROM 4images_images where image_id=$id");
$row mysql_fetch_array($result);
$image_id $row["image_id"];
$cat_id $row["cat_id"];
$image_name $row["image_name"];
if (
$image_id!=""){
$image_media_file $row["image_media_file"];
?>

<a href="<? echo $url;?>/data/thumbnails/<? echo $cat_id;echo "/";echo $image_media_file; ?>"><? echo $image_name;?></a><br />
<?php }
else { echo 
$no_id; } }
else { echo 
$enter_id; }
?>

<br />
<input name="id" type="text" id="id" size="6" /><br />
<input name="submit" type="submit" value="<? echo $button ?>" />
</form>
<br />
<small>&reg; <? echo $footer ?></small>
</center>
</card>
</wml>
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 07, 2005, 05:07:55 AM
Because you have editted the code:
Code: [Select]
//dont need to change after this
header("Content-type: text/wml");

this you replaced with this:

Code: [Select]
//dont need to change after this
header("Content-type: text/vnd.wap.wml");
echo("Content-type: text/vnd.wap.wml\n");

So you get parsing error, try to do like in my example ;)
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 07, 2005, 08:39:13 AM
how it looks, it`s in lithuanian :)
Title: Re: [MOD] WAP page to download files.
Post by: b.o.fan on April 07, 2005, 05:06:35 PM
oki. my index.php.
in my http://www.wartenaufden15.de/wap or the subdomain http://wap.wartenaufden15.de

my index.php
Code: [Select]
<?
//Some settings
$url = 'http://wartenaufden15.de'; //where installed 4images, without traling slash
$title = 'wap.wartenaufden15.de'; //title for wap card
$no_id = 'ID nicht gefunden'; //msg when no id found
$enter_id = 'Gib die ID ein'; //msg when user comes
$button = 'Anzeigen'; //text for button
$footer = '(c) 2005 by wartenaufden15.de'; //footer text
$dbhost = "localhost"; //host of database
$dbuser = "DB16XXXX"; //database user
$dbpass = "XXXXXXXX"; //database pass
$dbname = "DB16XXXX"; //and database ;]

//dont need to change after this
header("Content-type: text/vnd.wap.wml");
echo("Content-type: text/vnd.wap.wml\n");
echo("<?xml version=\"1.0\" encoding=\"windows-1257\"\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
?>
<wml>
<card title="<? echo $title ?>">
<center>
<form method="post">
<?php
$id 
$_REQUEST['id'];
if(
$id!=""){
$db mysql_connect("$dbhost""$dbuser""$dbpass") or die ("Error");
@
mysql_select_db("$dbname"$db) or die ("DB not found");
$result mysql_query("SELECT image_id, image_media_file, cat_id, image_name FROM 4images_images where image_id=$id");
$row mysql_fetch_array($result);
$image_id $row["image_id"];
$cat_id $row["cat_id"];
$image_name $row["image_name"];
if (
$image_id!=""){
$image_media_file $row["image_media_file"];
?>

<a href="<?php echo $url;?>/data/thumbnails/<?php echo $cat_id;echo "/";echo $image_media_file?>"><?php echo $image_name;?></a><br />
<?php }
else { echo 
$no_id; } }
else { echo 
$enter_id; }
?>

<br />
<input name="id" type="text" id="id" size="6" /><br />
<input name="submit" type="submit" value="<?php echo $button ?>" />
</form>
<br />
<small>&reg; <? echo $footer ?></small>
</center>
</card>
</wml>
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 07, 2005, 06:04:23 PM
try this...  :wink:
Code: [Select]
<?
//Some settings
$url = 'http://wartenaufden15.de'; //where installed 4images, without traling slash
$title = 'wap.wartenaufden15.de'; //title for wap card
$no_id = 'ID nicht gefunden'; //msg when no id found
$enter_id = 'Gib die ID ein'; //msg when user comes
$button = 'Anzeigen'; //text for button
$footer = '(c) 2005 by wartenaufden15.de'; //footer text
$dbhost = "localhost"; //host of database
$dbuser = "DB16XXXX"; //database user
$dbpass = "XXXXXXXX"; //database pass
$dbname = "DB16XXXX"; //and database ;]

//dont need to change after this
header("Content-type: text/wml");
echo("<?xml version=\"1.0\" encoding=\"windows-1257\"?>\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
?>
<wml>
<card title="<? echo $title ?>">
<center>
<form method="post">
<?php
$id 
$_REQUEST['id'];
if(
$id!=""){
$db mysql_connect("$dbhost""$dbuser""$dbpass") or die ("Error");
@
mysql_select_db("$dbname"$db) or die ("DB not found");
$result mysql_query("SELECT image_id, image_media_file, cat_id, image_name FROM 4images_images where image_id=$id");
$row mysql_fetch_array($result);
$image_id $row["image_id"];
$cat_id $row["cat_id"];
$image_name $row["image_name"];
if (
$image_id!=""){
$image_media_file $row["image_media_file"];
?>

<a href="<?php echo $url;?>/data/thumbnails/<?php echo $cat_id;echo "/";echo $image_media_file?>"><?php echo $image_name;?></a><br />
<?php }
else { echo 
$no_id; } }
else { echo 
$enter_id; }
?>

<br />
<input name="id" type="text" id="id" size="6" /><br />
<input name="submit" type="submit" value="<?php echo $button ?>" />
</form>
<br />
<small>&reg; <? echo $footer ?></small>
</center>
</card>
</wml>
Title: Re: [MOD] WAP page to download files.
Post by: b.o.fan on April 07, 2005, 06:15:38 PM
oki.
than look @ the wap page.
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 07, 2005, 06:21:41 PM
working  :wink:
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 10, 2005, 11:57:25 AM
mine says unknown file format when i goto it on my fone. Does anyone else have this error, or can you help me ?
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 10, 2005, 12:04:31 PM
what phone you browse with?
wml format is supported by many mobile phones.
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 10, 2005, 12:20:25 PM
so the /wap/index has to be .php ? i cant think of anything other reason why it doesnt work. can you ?
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 10, 2005, 01:54:14 PM
the file must be index.php
 this:
Code: [Select]
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");

shows browser what type of document is this, so it must work.
Title: Re: [MOD] WAP page to download files.
Post by: LBL on April 10, 2005, 07:59:20 PM
Today I have made my first mod for 4images gallery  :wink:
I`m using it for a special category for mobile phones, there are a lot of *.mid files, and users can get it by writing its ID in my WAP page. So... there it goes.

Need to edit one file, and create one.
1. Make a dir something like "wap" at your server.
2. Put file named index.php into dir, with this text (edit settings first  :wink: ):
Code: [Select]
<?
//Some settings
$url = 'http://url.to.your.page'; //where installed 4images, without traling slash
$title = 'wap page'; //title for wap card
$no_id = 'ID not found'; //msg when no id found
$enter_id = 'Enteri ID'; //msg when user comes
$button = 'show'; //text for button
$footer = 'footer'; //footer text
$dbhost = "localhost"; //host of database
$dbuser = "root"; //database user
$dbpass = ""; //database pass
$dbname = ""; //and database ;]

//dont need to change after this
header("Content-type: text/wml");
echo("<?xml version=\"1.0\" encoding=\"windows-1257\"?>\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
?>
<wml>
<card title="<? echo $title ?>">
<center>
<form method="post">
<?php 
$id 
$_REQUEST['id'];
if(
$id!=""){
$db mysql_connect("$dbhost""$dbuser""$dbpass") or die ("Error");
@
mysql_select_db("$dbname"$db) or die ("DB not found");
$result mysql_query("SELECT image_id, image_media_file, cat_id, image_name FROM 4images_images where image_id=$id");
$row mysql_fetch_array($result);
$image_id $row["image_id"];
$cat_id $row["cat_id"];
$image_name $row["image_name"];
if (
$image_id!=""){
$image_media_file $row["image_media_file"];
?>

<a href="<? echo $url;?>/data/media/<? echo $cat_id;echo "/";echo $image_media_file; ?>"><? echo $image_name;?></a><br />
<?php }
else { echo 
$no_id; } }
else { echo 
$enter_id; }
?>

<br />
<input name="id" type="text" id="id" size="6" /><br />
<input name="submit" type="submit" value="<? echo $button ?>" />
</form>
<br />
<small>&reg; <? echo $footer ?></small>
</center>
</card>
</wml>

3. Edit details.html and add this where you like:
Code: [Select]
      <tr>
        <td><b>ID for WAP</b></td>
        <td>{image_id}</td>
      </tr>

4. Point your mobile to this page and try it.

By changing this "/data/media/" to "/data/thumbnails/" you can show only small pictures, but i`m using this script for mobile melodies in *.mid format, so it works  :wink:
Sorry for my english.

Good luck ;]

can you show please what is every part? you know, like where the footer text is etc...
thx!
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 10, 2005, 08:14:33 PM
Everything there is very simple ;]


These is only settings, needed by script later
Quote
<?
//Some settings
$url = 'http://url.to.your.page'; //where installed 4images, without traling slash
$title = 'wap page'; //title for wap card
$no_id = 'ID not found'; //msg when no id found
$enter_id = 'Enteri ID'; //msg when user comes
$button = 'show'; //text for button
$footer = 'footer'; //footer text
$dbhost = "localhost"; //host of database
$dbuser = "root"; //database user
$dbpass = ""; //database pass
$dbname = ""; //and database ;]

Page header:
Quote
//dont need to change after this
header("Content-type: text/wml");
echo("<?xml version=\"1.0\" encoding=\"windows-1257\"?>\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
?>

Begining of the page:
Quote
<wml>
<card title="<? echo $title ?>"> <-- echo title name from settings ;]
<center>
<form method="post">
<?php
$id = $_REQUEST['id'];  <-- gets user posted values from form
if($id!=""){
$db = mysql_connect("$dbhost", "$dbuser", "$dbpass") or die ("Error"); <-- connects to the database, and gets all information
@mysql_select_db("$dbname", $db) or die ("DB not found");
$result = mysql_query("SELECT image_id, image_media_file, cat_id, image_name FROM 4images_images where image_id=$id");
$row = mysql_fetch_array($result);
$image_id = $row["image_id"];
$cat_id = $row["cat_id"];
$image_name = $row["image_name"];
if ($image_id!=""){
$image_media_file = $row["image_media_file"];
?>

prints a link to media file:
<a href="<? echo $url;?>/data/media/<? echo $cat_id;echo "/";echo $image_media_file; ?>"><? echo $image_name;?></a><br />
<?php }
else { echo $no_id; } } <-- if no id given
else { echo $enter_id; } <-- enter ID  
?>
<br />
<input name="id" type="text" id="id" size="6" /><br />
<input name="submit" type="submit" value="<? echo $button ?>" /> <-- button name from settings
</form>
<br />
<small>&reg; <? echo $footer ?></small> <-- footer from settings
</center>
</card>
</wml>
Title: Re: [MOD] WAP page to download files.
Post by: LBL on April 10, 2005, 09:59:26 PM
yeah, it is simple but i don't know what every one of these means....
i mean, if you can show an example of how the page should look like with those settings.

Quote
<?
$title = 'wap page'; //title for wap card
$no_id = 'ID not found'; //msg when no id found
$enter_id = 'Enteri ID'; //msg when user comes
$button = 'show'; //text for button
$footer = 'footer'; //footer text
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 11, 2005, 04:38:09 AM
you see, if you define some parameters here:

Code: [Select]
<?
$something = 'some text';
?>

later you can print it in the script any where, byt typing this:

Code: [Select]
<?
echo $something;
?>
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 12, 2005, 12:37:52 PM
now mine is showing the code. any thoughts ?
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 12, 2005, 02:23:05 PM
some phones shows the code, others say file type unrecognised.
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 12, 2005, 02:45:22 PM
ok, ive tried it on a wap emulator and it works, maybe phones in australia dont support it ? this is really annoying me, i have no idea what the problem is.
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 16, 2005, 03:00:41 PM
does anyone ?
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 16, 2005, 03:07:53 PM
On monday I will test this site with few phone models. But now I have no time, sorry.
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 16, 2005, 03:38:18 PM
thats fine, thanks. my url is www.yanos.net/wap incase you would like to look at that.
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 16, 2005, 06:48:37 PM
can you describe what the problem is? what u can see and what no.
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 18, 2005, 01:20:09 PM
sorry the server is down at the moment, it will be back up tomrorow, ill do it then. sorry again, but thanks for helping.
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 18, 2005, 01:22:39 PM
no problem. the only problem I saw in your page was bad mysql db password given ;]
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 21, 2005, 01:13:57 PM
when i goto the page, it says file format unknown, other phones do that also. Your right about the sql bd password, i couldnt remember what i made it, but that shouldnt effect the 'file format unknown' error shoudl it ?
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 21, 2005, 01:19:19 PM
Hmm, so the problem might be in the header

Make sure that this is in the place:

Code: [Select]
//dont need to change after this
header("Content-type: text/wml");
echo("<?xml version=\"1.0\" encoding=\"windows-1257\"?>\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
Title: Re: [MOD] WAP page to download files.
Post by: ryann on April 24, 2005, 01:47:47 PM
ok, ive tried the page on 3 different phone models...

Nokia 3200: Displays 'File type invalid' error
Nokia 6200: Displays the source code
Motorola V3: The page works, but I didnt get to push the 'submit' button, so im not sure if that works or not... should.

And the header is correct too, i never changed it.

Any ideas ? at all ?


Title: Re: [MOD] WAP page to download files.
Post by: universal on April 24, 2005, 03:01:22 PM
Yes I have one Idea ;)

Replace this:
Code: [Select]
header("Content-type: text/wml");
echo("<?xml version=\"1.0\" encoding=\"windows-1257\"?>\n");
echo("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
." \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");

With this:
Code: [Select]
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">';


Must work :)
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 24, 2005, 03:09:03 PM
Quote
Motorola V3: The page works, but I didnt get to push the 'submit' button, so im not sure if that works or not... should.

Change:
Code: [Select]
<form method="post">

To:
Code: [Select]
<form method="post" action="index.php">
Title: Re: [MOD] WAP page to download files.
Post by: universal on April 25, 2005, 03:14:24 PM
Well. I have tested wap page on several phones. And I think that I fixed everything :)
So...
The biggest bug was <center> tag, so we must to replace it with <p> tag:

Find
Code: [Select]
<center>
replace with:
Code: [Select]
<p align="center">
find:
Code: [Select]
</center>
replace with:
Code: [Select]
</p>


and to ensure working use this:
Code: [Select]
Header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml_1.2.xml\">";


So it works?
Title: Re: [MOD] WAP page to download files.
Post by: luk on April 28, 2005, 11:26:18 PM
Quote
Message # 1013612:
Date: 10/01/02 18:00
By: Johnny Profile
Subject: wml + php solution...

Hi All!

I found an interesting diference between my solution and this article.
Almost everything is the same, but when i'm using the
header (Content-Type: text/vnd.wap.wml); function, my phone says "Response unknown" or "No response, try again"
I have Nokia 6510 mobile.
So I don't use the header function and everything works well :)

Here is my sample code what I use.

<?php
echo "<?xml version\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>

<wml>
<card id="main" title="First Wap page">
<p>Here is a php number:
<?php $i=1; echo $1;
<br/>
</p>
</card>
</wml>

Thats all.
Bye.

http://www.phpbuilder.com/annotate/message.php3?id=1013612

I have Nokia6100 and i get the same error with some WML scripts.I can't imagine what the problem is.If anyone can help me(us) please post it here al their experience ( knowledge ) about this problem.

WAP Chats :

MobiiliChat 1.07
Code: [Select]
http://www.mobiilichat.com/forum/mobiilichat_v1.07.zip
W@Pchat Ver.1.2
Code: [Select]
http://www.earthweb.biz/myscript.php?file=wapchat.zip
GumSlone WAP Chat2 and 1.05
Code: [Select]
http://gumslone.com/scripts/wap_chat_v2.zip
http://gumslone.com/scripts/GS_WAP_CHAT_V1.0.5.zip


I have install it in my PC Apache + PHP + MySQL with WML support.All in one package : XAMPP for WINDOWS

Quote
http://www.apachefriends.org/en/xampp-windows.html

All 3 WML scripts works with WINWAP 3.2
Quote
http://www.winwap.com/products_2_1.php


BUT IN MY NOKIA6100 just MobiiliChat works 100%.The rest 2 scripts didn't work ,and i get "File Format Unknow" ERROR.

Look the 3 WML script header functions :

MobiiliChat 1.07
Quote
header("Content-type: text/vnd.wap.wml; charset=ISO-8859-1");



W@Pchat Ver.1.2
Quote
header("Content-type: text/vnd.wap.wml");



GumSlone WAP Chat2 and 1.05
Quote
header("Content-type:text/vnd.wap.wml;charset=UTF-8");


It might be possible to be this header problem? MobiiliChat 1.07 works 100% for me, bust rest 2 NOT WORK !



Title: Re: [MOD] WAP page to download files.
Post by: universal on April 29, 2005, 05:13:25 AM
Have you tried this header?

Code: [Select]
Header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml_1.2.xml\">";

I`m working with wap pages and it`s usability. I have tested this page with 7 diferent phones.
Wml code is very tricky one. Because everything MUST be valid.
Title: Re: [MOD] WAP page to download files.
Post by: Ufetto on May 08, 2005, 11:26:46 PM
Hi Guys.

I have tested this mod on my site but it doesn't work :(
My wap site is: http://www.funzone.it/4wap .

On the phone I see the web page but when I click on the botton i can't see the file.   :roll:

My index.php code is:

Code: [Select]
<?
//Some settings
$url = 'http://www.funzone.it'; //where installed 4images, without traling slash
$title = 'FunZone 4Wap'; //title for wap card
$no_id = 'ID non trovato'; //msg when no id found
$enter_id = 'Inserisci ID'; //msg when user comes
$button = 'Mostra'; //text for button
$footer = 'FunZone.it'; //footer text
$dbhost = "localhost"; //host of database
$dbuser = "XXX"; //database user
$dbpass = "XXX"; //database pass
$dbname = "XXX"; //and database ;]

//dont need to change after this
Header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml_1.2.xml\">";
?>

<wml>
<card title="<? echo $title ?>">
<p align="center">
<form method="post" action="index.php">
<?php 
$id 
$_REQUEST['id'];
if(
$id!=""){
$db mysql_connect("$dbhost""$dbuser""$dbpass") or die ("Error");
@
mysql_select_db("$dbname"$db) or die ("DB not found");
$result mysql_query("SELECT image_id, image_media_file, cat_id, image_name FROM 4images_images where image_id=$id");
$row mysql_fetch_array($result);
$image_id $row["image_id"];
$cat_id $row["cat_id"];
$image_name $row["image_name"];
if (
$image_id!=""){
$image_media_file $row["image_media_file"];
?>

<a href="<? echo $url;?>/data/media/<? echo $cat_id;echo "/";echo $image_media_file; ?>"><? echo $image_name;?></a><br />
<?php }
else { echo 
$no_id; } }
else { echo 
$enter_id; }
?>

<br />
<input name="id" type="text" id="id" size="6" /><br />
<input name="submit" type="submit" value="<? echo $button ?>" />
</form>
<br />
<small>&reg; <? echo $footer ?></small>
</p>
</card>
</wml>

Thanks all for Help and sorry for my bad english.  :wink:
Title: Re: [MOD] WAP page to download files.
Post by: universal on May 09, 2005, 05:34:18 AM
It`s dificult to make an universal wap page... then we need to do a phone recognition...
try this code, I hope it`ll help:

Code: [Select]
<?
//Some settings
$url = 'http://www.pramoga.net'; //where installed 4images
$title = 'wap.pramoga.net'; //title for wap card
$no_id = 'ID not found'; //msg when no id found
$enter_id = 'ID'; //msg when user comes
$button = ' find &gt;'; //text for button
$footer = 'Pramoga.net'; //footer text
$dbhost = "localhost";
$dbuser = "dbuser";
$dbpass = "dbpass";
$dbname = "pramoga_pramoga";
//dont need to change after this
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card title="<? echo $title ?>">
<p>
<br />
<?
$id = $_REQUEST['id'];
if($id!=""){
$db = mysql_connect("$dbhost", "$dbuser", "$dbpass") or die ("Error");
@mysql_select_db("$dbname", $db) or die ("DB not found");
$result = mysql_query("SELECT image_id, image_media_file, cat_id, image_name FROM 4images_images where image_id=$id");
$row = mysql_fetch_array($result);
$image_id = $row["image_id"];
$cat_id = $row["cat_id"];
$image_name = $row["image_name"];
if ($image_id!=""){
$image_media_file = $row["image_media_file"];
?>
Spausk nuoroda, kad parsisiusti:
<a href="<? echo $url;?>/data/media/<? echo $cat_id;echo "/";echo $image_media_file; ?>"><? echo $image_name;?></a><br />
<? }
else { echo $no_id,"<br />"; }
}
else { echo $enter_id,"<br />"; }
?>
<br />
<input name="id" /><br />
<a href="index.php?id=$(id)"><? echo $button ?></a>
</p>
</card>
</wml>
Title: Re: [MOD] WAP page to download files.
Post by: Ufetto on May 10, 2005, 04:16:30 PM
Thanks!   :wink:

Now it works great!  8)
Title: Re: [MOD] WAP page to download files.
Post by: sanju on June 29, 2005, 01:34:03 AM
brilliant the wap page is working for me too just another request for the wap page thing..

Actually i was thinking is it possible to make Wap page  to download images from 4images installed site for only registered members at the site or certain member Group...
i have seen theres a mod for wap download i really found it useful.. but it would gr8 if only registered members can download thrugh wap... or certain member group only who can download from the wap page...
and something like limited download for guest in a day...

i have added this in Request forum but looks like noone gave a look to it.. :(

http://www.4homepages.de/forum/index.php?topic=8571.0
Title: Re: [MOD] WAP page to download files.
Post by: universal on June 30, 2005, 02:44:13 PM
You see... my php is kind a simple and small :)
I`m programing when I got idea and I know how to make a working script.
User login in wap pages is something like a template system, but for wap. Or we just need somehow take session script from all system...
The first Idee about wap templates i like more, but if we are going through wap, we must to disable flash, mp3, video etc.
So the question will be how to disable these only for the wap page :)