Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Unificare una landing page in HTML ad uno script in PHP

    Ciao a tutti, possiedo una landing page in HTML, ed ho pensato di utilizzare uno script trovato per il web in PHP...non sono molto esperto nei due settori, ho cercato un po' in giro ma non ho trovato granchè.

    Lo script consiste nel sistema di Referring, se porti un tot. numero di persone tramite il tuo ref. link, allora si sbloccherà un contenuto. Il documento index.php ha in sè dell'HTML standard, molto povero nei contenuti. Vi allego uno screen:

    http://i.imgur.com/UXSxpcS.png

    Ecco, io vorrei modificare questo HTML con quello che posseggo, ma provando del semplice taglia-incolla, ovviamente non è uscito bene.

    Vi allego anche lo script in PHP:

    Codice PHP:
    <?php
    header
    ("Refresh: 120;");
    ?>
    <?
    include "dbcon/config.php";
    if(isset(
    $_COOKIE['ref_link'])){
        
    $ref $_COOKIE['ref_link'];
    }else{
        
    $ref rand(1,9).date('Y').date('m').date('d').date('h').date('i').date('s');
        
    $ref rand_uniqid($ref);
        
    setcookie("ref_link",$ref9999999999);  
        
        
    $insert "insert into cookie_ref(REF_val) values('".$ref."');";
        @
    mysql_query($insert);
        
    }
    $error ''//used for checking if ip has been re used
    if(isset($_GET['ref'])){
        
    $getip "select * from cookie_ref_ips where IP_address = '".getRealIpAddr()."' and REF_val = '".$_GET['ref']."'";
        
    $getip_query = @mysql_query($getip);
        if(@
    mysql_num_rows($getip_query) < 1){
        
    $update "update cookie_ref set REF_hits = REF_hits + 1 where REF_val = '".$_GET['ref']."'";
        @
    mysql_query($update);
        
        
    $insertip "insert into cookie_ref_ips(IP_address,REF_val) values('".getRealIpAddr()."','".$_GET['ref']."')";
        @
    mysql_query($insertip);
        }else{
            
    $error "<h1>You already used this refferal link!</h1>";
        }
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="style.css" />
    <title>refer template</title>
    </head>
    <body>

    <div id="wrap">

    <div id="header">
    <h1>[url="#"]Refer a Friend [/url]</h1>
    </div>

    <div id="menu">
    <ul>[*][url="#"]link 1[/url][*][url="#"]link2[/url][*][url="#"]link3[/url][*][url="#"]link4[/url][/list]
    </div>

    <div id="content">
      <h2>header for this section</h2>
      <h2>
      
      <?
      
    echo $error;
      
    $select "select * from cookie_ref where REF_val = '".$ref."';";
      
    $selectQuery = @mysql_query($select);
      
    $selectArray = @mysql_fetch_array($selectQuery);
      
    $hits $selectArray['REF_hits'];
      echo 
    "Total Hits for this Referal: ".$hits;
      
    ?>
      </h2>
      <?
      
    if($hits 10){
        
    ?>
        <div style="background:#33CC33;" id="winner">
        <h3>Great You got more than 10</h3>
        

     
        You got more than 10 referers here is your prize
        </p>
        </div>
        <?  
      
    }
      
    ?>
      

      <div style="width:100%;" id="inner-content">
      

     Your referal Link is</p>
      

    [url]http://link.net/?ref=[/url]<? echo $ref?></p>
      

    blah blah blah blah</p>
      </div>
    </div>
    <div id="sidebar">
      <h3>Menu Navigation</h3>
    <ul>[*][url="#"]somthing[/url][*]something else[*]another thing[url="#"][/url][/list]

    <h3>Useful Resources</h3>
    <ul>[*][url="#"]one[/url][*]two[*]three[url="#"][/url][/list]

    </div>

    <div style="clear: both;"> </div>

    <div id="columns">

    <div id="column1">
    <h3>Latest Articles</h3>
    <ul>[*][url="#"]box1[/url][url="#"][/url][/list]
    </div>

    <div id="column2">
    <h3>Subscribe</h3>


     box2
    </p>
    </div>

    <div id="column3">
    <h3>Friends</h3>
    <ul>[*][url="#"]box 3[/url][url="#"][/url][/list]
    </div>

    <div style="clear: both;"> </div>

    </div>

    <div id="footer">


    &copy; Copyright 2010 your site name[url="#"][/url]</p>
    </div>

    </div>

    </body>
    </html>
    <?
    function rand_uniqid($in$to_num false$pad_up false$passKey null)
    {
        
    $index "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        if (
    $passKey !== null) {
            
    // Although this function's purpose is to just make the
            // ID short - and not so much secure,
            // you can optionally supply a password to make it harder
            // to calculate the corresponding numeric ID

            
    for ($n 0$n<strlen($index); $n++) {
                
    $i[] = substr$index,$n ,1);
            }

            
    $passhash hash('sha256',$passKey);
            
    $passhash = (strlen($passhash) < strlen($index))
                ? 
    hash('sha512',$passKey)
                : 
    $passhash;

            for (
    $n=0$n strlen($index); $n++) {
                
    $p[] =  substr($passhash$n ,1);
            }

            
    array_multisort($p,  SORT_DESC$i);
            
    $index implode($i);
        }

        
    $base  strlen($index);

        if (
    $to_num) {
            
    // Digital number  <<--  alphabet letter code
            
    $in  strrev($in);
            
    $out 0;
            
    $len strlen($in) - 1;
            for (
    $t 0$t <= $len$t++) {
                
    $bcpow bcpow($base$len $t);
                
    $out   $out strpos($indexsubstr($in$t1)) * $bcpow;
            }

            if (
    is_numeric($pad_up)) {
                
    $pad_up--;
                if (
    $pad_up 0) {
                    
    $out -= pow($base$pad_up);
                }
            }
            
    $out sprintf('%F'$out);
            
    $out substr($out0strpos($out'.'));
        } else {
            
    // Digital number  -->>  alphabet letter code
            
    if (is_numeric($pad_up)) {
                
    $pad_up--;
                if (
    $pad_up 0) {
                    
    $in += pow($base$pad_up);
                }
            }

            
    $out "";
            for (
    $t floor(log($in$base)); $t >= 0$t--) {
                
    $bcp bcpow($base$t);
                
    $a   floor($in $bcp) % $base;
                
    $out $out substr($index$a1);
                
    $in  $in - ($a $bcp);
            }
            
    $out strrev($out); // reverse
        
    }

        return 
    $out;
    }
    function 
    getRealIpAddr()
    {
        if (!empty(
    $_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet
        
    {
          
    $ip=$_SERVER['HTTP_CLIENT_IP'];
        }
        elseif (!empty(
    $_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy
        
    {
          
    $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
        }
        else
        {
          
    $ip=$_SERVER['REMOTE_ADDR'];
        }
        return 
    $ip;
    }
    ?>
    P.s. volevo chiudere il codice PHP in uno spoiler, ma non trovo il tasto perciò scusatemi se occupa molto spazio.

    Grazie a tutti per l'aiuto in anticipo!

  2. #2
    Up!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.