Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    Gainsborough
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Prev - Next Image

    Hi Guys

    Got a quick query i need some support with. I have a database of over 1000 images and each has a pop up. http://www.freepspwallpapers.co.uk/popup.php?imgid=136 What i am looking for on the pop up is to have two buttons "Previous PSP Wallpaper and Next PSP Wallpaper"

    The previous Wallpaper woudl go to http://www.freepspwallpapers.co.uk/popup.php?imgid=135

    The Next Wallpaper would go to http://www.freepspwallpapers.co.uk/popup.php?imgid=137

    Can you help. Code is below?

    Peter

    PHP Code:
    <?php
    // Connect to the database.
    require('dbconnect.php');

    // Select what we want.
    $sql 'SELECT * FROM `wallpapers` WHERE `wallpaperid` = '.$_GET['imgid'].'';
    $query mysql_query($sql);

    $row mysql_fetch_assoc($query);
    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>Free <?php echo ($row['wallpapername']); ?> PSP Wallpapers</TITLE>
    </HEAD>

    <BODY>
    <table width="100%">
        <tr>
        <td height="300" width="500">
    <script type="text/javascript"><!--
    google_ad_client = "pub-4821343836407925";
    google_ad_width = 468;
    google_ad_height = 60;
    google_ad_format = "468x60_as";
    google_ad_type = "text";
    //2007-03-20: Wallpapers, WWE, downloads, psp, PS3
    google_ad_channel = "8546238988+5366573013+5099331499+2237340824+1321726847";
    google_color_border = "FFFFFF";
    google_color_bg = "FFFFFF";
    google_color_link = "609FFF";
    google_color_text = "000000";
    google_color_url = "FFCCCC";
    //-->
    </script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
          <img src="<?php echo ($row['wallpaperimage']); ?>" alt="Free <?php echo ($row['wallpapername']); ?> PSP Wallpapers" title="Free <?php echo ($row['wallpapername']); ?> PSP Wallpapers" /> 
          More <a href="http://www.freepspwallpapers.co.uk"> PSP Wallpapers </a><br>
          <font size="1">
          <?php

    function tla_ads() {

        
    // Number of seconds before connection to XML times out
        // (This can be left the way it is)
        
    $CONNECTION_TIMEOUT 10;

        
    // Local file to store XML
        // This file MUST be writable by web server
        // You should create a blank file and CHMOD it to 666
        
    $LOCAL_XML_FILENAME "local_90831.xml";

        if( !
    file_exists($LOCAL_XML_FILENAME) ) die("Text Link Ads script error: $LOCAL_XML_FILENAME does not exist. Please create a blank file named $LOCAL_XML_FILENAME.");
        if( !
    is_writable($LOCAL_XML_FILENAME) ) die("Text Link Ads script error: $LOCAL_XML_FILENAME is not writable. Please set write permissions on $LOCAL_XML_FILENAME.");

        if( 
    filemtime($LOCAL_XML_FILENAME) < (time() - 3600) || filesize($LOCAL_XML_FILENAME) < 20) {
            
    $request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
            
    $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
            
    tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=A1K071ITTIUOBZBBNDWS&referer=" urlencode($request_uri) .  "&user_agent=" urlencode($user_agent), $LOCAL_XML_FILENAME$CONNECTION_TIMEOUT);
        }

        
    $xml tla_getLocalXML($LOCAL_XML_FILENAME);

        
    $arr_xml tla_decodeXML($xml);

        if ( 
    is_array($arr_xml) ) {
            echo 
    "\n<ul style=\"list-style: none; margin: 0; width: 100%; border: 1px solid #000000; border-spacing: 0px; background-color: #FFCCCC; padding: 0; overflow: hidden;\">\n";
            for (
    $i 0$i count($arr_xml['URL']); $i++) {
                echo 
    "<li style=\"padding: 0; margin: 0; clear: none; float: left; display: inline; width: 100%;\"><span style=\"width: 100%; color: #000000; display: block; padding: 3px; font-size: 12px; margin: 0;\">".$arr_xml['BeforeText'][$i]." <a style=\"font-size: 12px; color: #000000;\" href=\"".$arr_xml['URL'][$i]."\">".$arr_xml['Text'][$i]."</a> ".$arr_xml['AfterText'][$i]."</span></li>\n";
            }
            echo 
    "</ul>";
        }

    }

    function 
    tla_updateLocalXML($url$file$time_out)
    {
        if(
    $handle fopen($file"a")){
                
    fwrite($handle"\n");
                
    fclose($handle);
        }
        if(
    $xml file_get_contents_tla($url$time_out)) {
            
    $xml substr($xmlstrpos($xml,'<?'));

            if (
    $handle fopen($file"w")) {
                
    fwrite($handle$xml);
                
    fclose($handle);
            }
        }
    }

    function 
    tla_getLocalXML($file)
    {
        
    $contents "";
        if(
    $handle fopen($file"r")){
            
    $contents fread($handlefilesize($file)+1);
            
    fclose($handle);
        }
        return 
    $contents;
    }

    function 
    file_get_contents_tla($url$time_out)
    {
        
    $result "";
        
    $url parse_url($url);

        if (
    $handle = @fsockopen ($url["host"], 80)) {
            if(
    function_exists("socket_set_timeout")) {
                
    socket_set_timeout($handle,$time_out,0);
            } else if(
    function_exists("stream_set_timeout")) {
                
    stream_set_timeout($handle,$time_out,0);
            }

            
    fwrite ($handle"GET $url[path]?$url[query] HTTP/1.0\r\nHost: $url[host]\r\nConnection: Close\r\n\r\n");
            while (!
    feof($handle)) {
                
    $result .= @fread($handle40960);
            }
            
    fclose($handle);
        }

        return 
    $result;
    }

    function 
    tla_decodeXML($xmlstg)
    {

        if( !
    function_exists('html_entity_decode') ){
            function 
    html_entity_decode($string)
            {
               
    // replace numeric entities
               
    $string preg_replace('~&#x([0-9a-f]+);~ei''chr(hexdec("\1"))'$string);
               
    $string preg_replace('~&#([0-9]+);~e''chr(\1)'$string);
               
    // replace literal entities
               
    $trans_tbl get_html_translation_table(HTML_ENTITIES);
               
    $trans_tbl array_flip($trans_tbl);
               return 
    strtr($string$trans_tbl);
            }
        }

        
    $out "";
        
    $retarr "";

        
    preg_match_all ("/<(.*?)>(.*?)</"$xmlstg$outPREG_SET_ORDER);
        
    $search_ar = array('<''>''"');
        
    $replace_ar = array('<''>''"');
        
    $n 0;
        while (isset(
    $out[$n]))
        {
            
    $retarr[$out[$n][1]][] = str_replace($search_ar$replace_ar,html_entity_decode(strip_tags($out[$n][0])));
            
    $n++;
        }
        return 
    $retarr;
    }

    tla_ads();

    ?>
          </font> </td>
        </tr>
    </table>
    </BODY>
    </HTML>
    --
    Peter Potter
    PSP Wallpapers

  • #2
    Regular Coder
    Join Date
    Jun 2006
    Location
    Gainsborough
    Posts
    102
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi All

    I resloved the problem for this. See below.

    More <a href="http://www.freepspwallpapers.co.uk">PSP
    Wallpapers</a> <a href="http://www.freepspwallpapers.co.uk/popup.php?imgid=<?php echo ($prev); ?>">Previous
    PSP Wallpaper</a> | <a href="http://www.freepspwallpapers.co.uk/popup.php?imgid=<?php echo ($next); ?>">Next
    PSP Wallpaper</a></font>
    --
    Peter Potter
    PSP Wallpapers


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •