Visualizzazione risultati 1 fino 4 di 4

Discussione: Script wap convert web

  1. #1
    L'avatar di Tigrru
    Tigrru non è connesso Utente giovane
    Data registrazione
    20-08-2007
    Messaggi
    45

    Red face Script wap convert web

    Come poso usare un script wap anche in web?
    Questo e il script wap :
    Codice PHP:
    <?php

    include 'config.php';

    ////////////////INSERT HITS INTO DATABASE////////////////

    if ($cat=="") {
    $date = DATE("Y,m,d,h,i,s");
    $sql = mysql_query("SELECT * FROM tigrrurules_toplist where id = '$id' ");
    while(
    $row = mysql_fetch_array($sql)){
    $id = $row['id'];
    $out = $row['incoming'] + 1;
    $total = $row['total'] + 1;

    }
    mysql_query("UPDATE tigrrurules_toplist SET incoming='$out', total='$total', lastin='$date' WHERE id='$id' ")
    or die(
    mysql_error());
    header("Location: $PHP_SELF?cat=show");
    }


    ////////////////DELETE SITES WITH NO HITS FOR X DAYS////////////////

    if ($purgedays>0){
    $purgeseconds = $purgedays * 86400;
    $olddate = strftime("%Y-%m-%d %H:%M:%S", time() - $purgeseconds);

    $getid = mysql_query("SELECT * FROM tigrrurules_toplist where lastin < '$olddate' and total='0'");

    while(
    $get = mysql_fetch_array($getid)){
    $lastin = $get['lastin'];
    $total = $get['total'];
    $name = $get['name'];
    $id = $get['id'];
    $sendto = $get['mail'];
    $subject = "L.O.W. top\n";
    $message = "toplist, $mymail\n\nAs you did not send us any hits for the last $purgedays days, \nyour site, '$name', has been removed from the wapshare topsite.\nYou may register your site details again if you wish.\nYou need to send at least 1 hit every $purgedays days to keep your site active.";
    mail($sendto, $subject, $message);
    }
    $sql = "delete from
    tigrrurules_toplist where lastin < '
    $olddate' and total='0'";
    $result = mysql_query($sql) or die("Failed: $sql");
    }

    ////////////////RESET COUNTERS////////////////

    $time = DATE("Y,m,d,$hour,00,00");

    if (
    $reset_days>30){
    $reset_seconds = $reset_days * 86400;
    $olddate = strftime("%Y-%m-%d", time() - $reset_seconds);

    $get_time = mysql_query("SELECT * FROM tigrrurules_clock where time < '$olddate'");

    while(
    $get = mysql_fetch_array($get_time)){

    mysql_query("UPDATE tigrrurules_clock SET time='$time'")
    or die(
    mysql_error());

    $sql = "UPDATE tigrrurules_toplist SET incoming='0', out='0', total='0'";
    $result = mysql_query($sql) or die("Failed: $sql");
    } }

    ////////////////HEADER INFO////////////////

    header("Cache-Control: no-cache, must-revalidate");
    header("Pragma: no-cache");
    header("Content-type: text/vnd.wap.wml;");
    echo
    '<?xml version="1.0" encoding="utf-8"?>';
    print
    '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">'.
    '<wml>
    <head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>'
    ;

    ////////////SEE THE CATEGORIES////////////

    if ($cat==1) $category=$category1;
    if (
    $cat==2) $category=$category2;
    if (
    $cat==3) $category=$category3;
    if (
    $cat==4) $category=$category4;
    if (
    $cat==5) $category=$category5;
    if (
    $cat==6) $category=$category6;
    if (
    $cat==7) $category=$category7;
    if (
    $cat==8) $category=$category8;
    if (
    $cat==9) $category=$category9;
    if (
    $cat==10) $category=$category10;
    if (
    $cat==11) $category=$category11;

    if (
    $cat=="show") {

    echo
    "<card id=\"lowtop\" title=\"Wap Top\"><p align=\"center\">";
    $New_Time = time() + (8 * 60 * 60);
    $show_date=date("D dS F, Y",$New_Time);
    echo
    "<small>$show_date</small><br/>";
    echo
    "<b>Sponsors</b><br/>";

    echo
    "<small>";
    echo
    "<a href=\"ads.php?LOW=new\">» Porno sites</a><br/>";
    echo
    "<a href=\"ads.php?LOW=top\">» Top Adult</a><br/>";
    echo
    "<br/>";

    $cat_total1 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '1' "),0);
    $cat_total2 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '2' "),0);
    $cat_total3 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '3' "),0);
    $cat_total4 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '4' "),0);
    $cat_total5 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '5' "),0);
    $cat_total6 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '6' "),0);
    $cat_total7 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '7' "),0);
    $cat_total8 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '8' "),0);
    $cat_total9 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM WHERE cat = '9' "),0);
    $cat_total10 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '10' "),0);
    $cat_total11 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '11' "),0);

    echo
    "<a href=\"$PHP_SELF?cat=1\">» $category1 ($cat_total1)</a> <br/>";
    echo
    "<a href=\"$PHP_SELF?cat=2\">» $category2 ($cat_total2)</a><br />";
    echo
    "<a href=\"$PHP_SELF?cat=3\">» $category3 ($cat_total3)</a><br />";
    echo
    "<a href=\"$PHP_SELF?cat=4\">» $category4 ($cat_total4)</a><br />";
    echo
    "<a href=\"$PHP_SELF?cat=5\">» $category5 ($cat_total5)</a><br />";
    echo
    "<a href=\"$PHP_SELF?cat=6\">» $category6 ($cat_total6)</a><br />";
    echo
    "<a href=\"$PHP_SELF?cat=7\">» $category7 ($cat_total7)</a><br />";
    echo
    "<a href=\"$PHP_SELF?cat=8\">» $category8 ($cat_total8)</a><br />";
    echo
    "<a href=\"$PHP_SELF?cat=9\">» $category9 ($cat_total9)</a><br />";
    echo
    "<a href=\"$PHP_SELF?cat=10\">» $category10 ($cat_total10)</a><br />";
    echo
    "<a href=\"$PHP_SELF?cat=11\">» $category11 ($cat_total11)</a><br />";

    $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist"),0);
    echo
    "</small>";

    echo
    "</p><p align=\"center\">";
    echo
    "<small>Generate more traffic to your site</small><br/>";
    echo
    "<small>";
    echo
    "<a href=\"submit.php\">Add your Site</a><br />";
    echo
    "<a href=\"edit.php\">Login/Edit</a><br />";
    echo
    "</small>";
    echo
    "<br/><small><b>$total_results</b> sites registered with<br/>Top Wap</small><br/><br/>";
    echo
    "<small>Counters reset every 30 days</small><br/>";
    echo
    "</p></card></wml>";
    }

    ////////////VIEW THE CATEGORIES////////////
    else {

    $from = (($page * $max_results) - $max_results);

    echo
    "<card id=\"lowtop\" title=\"$category\"><p align=\"left\">";
    echo
    "<small>$category</small><br/>";

    if(!isset(
    $_GET['page'])){
    $page = 1;
    } else {
    $page = $_GET['page'];
    }

    $max_results = 10;
    $from = (($page * $max_results) - $max_results);

    $sql = mysql_query("SELECT * FROM tigrrurules_toplist WHERE cat = '$cat' ORDER BY total desc LIMIT $from, $max_results");

    while(
    $row = mysql_fetch_array($sql)){
    $go = $row['name'];
    $incom = $row['incoming'];
    $out = $row['out'];
    $id = $row['id'];

    $from=$from+1;

    echo
    "<small>$from.</small> <a href=\"viewsite.php?id=".$id."\"><small>$go</small></a><small> ($incom/$out)</small><br />" ;

    }

    $total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tigrrurules_toplist WHERE cat = '$cat' "),0);

    $total_pages = ceil($total_results / $max_results);


    if(
    $page < $total_pages){
    $next = ($page + 1);
    echo
    "<br /><a href=\"".$_SERVER['PHP_SELF']."?page=$next&amp;cat=$cat\"><small>Next/<small></a>";
    }
    if(
    $page > 1){
    $prev = ($page - 1);
    echo
    "<br /><a href=\"".$_SERVER['PHP_SELF']."?page=$prev&amp;cat=$cat\"><small>Prev</small></a>";
    }

    $i = 1; $i <= $total_pages; $i++ ;


    echo
    "</p><p align=\"left\">";
    echo
    "<small>$total_results sites in this category</small><br/>";

    echo
    "<a href=\"http://tigrru.altervista.org/topwap\"><small>Home</small></a><br />
    </p></card></wml>"
    ;
    }
    ?>
    [DS] Usa i tag di codice quando ne riporti ampi stralci, si legge meglio... e non esce un post kilometrico
    Ultima modifica di dementialsite : 14-09-2008 alle ore 11.47.17

  2. #2
    L'avatar di dementialsite
    dementialsite non è connesso Super Moderatore
    Data registrazione
    19-10-2004
    Residenza
    fuori Padova
    Messaggi
    5,046

    Predefinito

    Controlla bene le righe dove vengono stampati i valori sul file finale (iniziano con echo o con print). Devi sostituire il testo stampato (che è il codice WML) con il codice equivalente in HTML. Devi inoltre eliminare le righe che iniziano con header (o almeno quella che dichiara che il file finale sarà un WML).

    Stammi bene...
    Ultima modifica di dementialsite : 14-09-2008 alle ore 11.50.32
    Le questioni tecniche hanno risposte migliori nel forum pubblico, non trovi?

    When you don't know your next step... improvise

    ALTERVISTA WANTS YOU!
    Vuoi diventare moderatore su AlterVista? Scopri come...

  3. #3
    L'avatar di Tigrru
    Tigrru non è connesso Utente giovane
    Data registrazione
    20-08-2007
    Messaggi
    45

    Smile Esempio?

    Alora devo sostituire gli tag, fatemi un esempio per capire :)

  4. #4
    L'avatar di dementialsite
    dementialsite non è connesso Super Moderatore
    Data registrazione
    19-10-2004
    Residenza
    fuori Padova
    Messaggi
    5,046

    Predefinito

    Purtroppo non conosco molto bene le equivalenze, ti ho spiegato solo la tecnica generale...

    Per darti un esempio, in WML il corpo della pagina inizia con il tag <card>. Su HTML dovrai ovviamente sostituirlo con <body>.
    Prova a vedere se attraverso una guida di WML riesci a valutare quali sono le conversioni corrette...

    Stammi bene...
    Le questioni tecniche hanno risposte migliori nel forum pubblico, non trovi?

    When you don't know your next step... improvise

    ALTERVISTA WANTS YOU!
    Vuoi diventare moderatore su AlterVista? Scopri come...

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •