Need Help For Fix Affiliate Link...

Discussion in 'PHP' started by marki8, Apr 14, 2008.

  1. #1
    i have problem at my affiliate script :

    index.php?id=34343

    change to

    index.php?id=0

    so this script don't have stats for user id=34343 but have stats at admin id=0

    please someone help me....

    i spend 2 weeks to find whats wrong this script... but not found yet


    
    if(mysql_errno()){ 
    
      $_SESSION[Error] = "The Database link has not been setup.";
    
      header("Location: message.php");
    
      exit;
    
    }
    
    $id = 0;
    $_SESSION[ReferredUser] = $id;
    
    
    
    
    if(isset($_REQUEST[ID])){
      if_exists_db($Stats, $StatsName);
      if_exists_db($MemberDetails, $MemberDetailsName);
      
      $SQL="Select id From MemberDetails Where Code='$_REQUEST[ID]'";
      $res = @ mysql_query($SQL);
      
      //Get the number of hits for this user from this address
      if(@ (mysql_num_rows($res)>0)){
        $row= @ mysql_fetch_row($res);
        $id = $row[0];
      }
    }
    
    $SQL="Select Hits From Stats Where IPAddress='$_SERVER[REMOTE_ADDR]' And id=$id And SignedUp=0;";
    $res = @ mysql_query($SQL);
      
    if(mysql_errno()){
      domysql_error($SQL, __FILE__);
    } else {
      //Get the number of hits for this user from this address
      if(@ (mysql_num_rows($res)>0)){
        $row= @ mysql_fetch_row($res);
        $Hits = $row[0];
      } else {
        $Hits=0;
      }
      
      if(mysql_errno()){
        domysql_error($SQL, __FILE__);
      } else {
        $Hits++;
      
        //Create the SQL command
        if($Hits==1){
          $SQL = "Insert Into Stats (IPAddress, id, Hits, SignedUp, SignedUpID) Values ('$_SERVER[REMOTE_ADDR]', $id, $Hits, 0, 0)";
        } else {
          $SQL = "Update Stats Set Hits=$Hits Where IPAddress='$_SERVER[REMOTE_ADDR]' And id = $id And SignedUp=0";
        }
        @ mysql_query($SQL, $conn);
        
        if(mysql_errno()){
          domysql_error($SQL, __FILE__);
    	} else {
    	  $_SESSION[ReferredUser]=$id;
    	}
      }
    }  
    
    
    header("Location: $FireSaleHomePage?ID=$id");
    ?>
    
    
    Code (markup):

    thanks mates
     
    marki8, Apr 14, 2008 IP
  2. marki8

    marki8 Well-Known Member

    Messages:
    977
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    135
    #2
    lol no want to help me...

    so how much if i want hire someone to make this job done?

    please pm me or just post your rate... i have small budget
     
    marki8, Apr 30, 2008 IP
  3. Altari

    Altari Peon

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I'd be happy to try to help for no charge, but I genuinely have no idea what the problem is.
     
    Altari, Apr 30, 2008 IP
  4. Panzer

    Panzer Active Member

    Messages:
    381
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Thats horribly insecure :( .

    I believe the error is your setting $id , but calling upon $ID . PHP is case sensitive. You need to start using proper syntax as well.. that might cause some of your troubles. ($fromdb['good'] instead of $fromdb[bad] )
     
    Panzer, Apr 30, 2008 IP
  5. marki8

    marki8 Well-Known Member

    Messages:
    977
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    135
    #5
    ok thanks

    the problem is... my user affiliate link will change to admin affiliate

    here to make it clear

    index.php?id=34343 <---- this my user affiliate link....

    after someone click that affiliate link it will change to index.php?id=0 <--- 0 for admin id

    the stats click not show to my user affiliate panel... but it show at admin stats click panel
     
    marki8, Apr 30, 2008 IP
  6. graham23s

    graham23s Well-Known Member

    Messages:
    188
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #6
    if you pm me ill look at the script page for ya.

    Graham
     
    graham23s, Apr 30, 2008 IP