Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6096725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:57:39+00:00 2026-05-23T12:57:39+00:00

I have never coded php before and I really need this very simple script.

  • 0

I have never coded php before and I really need this very simple script.

so let me explain what I need.
user comes to my website via affiliate link so when they finished redirecting
the url will look like this

http://website.com/lp/index.html?sub=1&customer_id=1039be6e23b4420c3e1063dc44a04d

now I have a download link on my website
On download click
check for duplicate ip address from database. if not duplicate
capture sub=”” & customer_id=”” from the address bar.
save to database with IP Address (this for tracking)

and redirect immediately to the download link

if the ip is not duplicated

 http://dl.website.com/download/downloadpop.aspx?id={Customer_id}

if it’s duplicated

http://dl.website.com/download/downloadpop.aspx?id=beenbefore

Thank you so much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:57:40+00:00Added an answer on May 23, 2026 at 12:57 pm

    This is rather broad, and impossible to answer properly without knowing any details about your database structure, but here’s how the basics of this would work:

    <?php
    
    $sub = $_GET['sub'];
    $customer_id = $_GET['customer_id'];
    $ip = $_SERVER['REMOTE_ADDR'];
    
    $db = mysql_connect(...) or die(mysql_error());
    
    $quoted_sub = mysql_real_escape_string($sub);
    $quoted_customer_id = mysql_real_escape_string($customer_id);
    $quoted_ip = mysql_real_escape_string($ip);
    
    $sql = "SELECT count(*) AS cnt FROM yourtable WHERE ip_address = '$quoted_id'";
    $result = msyql_query($sql) or die(mysql_error());
    $row = mysql_fetch_assoc($result);
    if ($row['cnt'] == 0) {
        $enc = urlencode($customer_id);
        ... IP isn't in the database, so do the insert stuff ...
        header(" http://dl.website.com/download/downloadpop.aspx?id=$enc");
    } else {
        header("Location: http://dl.website.com/download/downloadpop.aspx?id=beenbefore");
    }
    
    exit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have never programmed anything in php before and haven't touched html in 10
This question is coded in pseudo-PHP, but I really don't mind what language I
I have never hand-coded object creation code for SQL Server and foreign key decleration
Never thought I'd have this problem :) The following snippet of code works in
I have never worked with web services and rails, and obviously this is something
I have never seen a way to do this nicely, i would be interested
I have never really found the design view in Visual Studio useful when developing
I have a really odd error: [04-Jun-2010 15:55:32] PHP Catchable fatal error: Object of
I've never seen anything like this. File structure: somefolder/base.php includes/stuff.php includes/constants.php base.php: <?php require(../includes/stuff.php);
Hey I have coded CakePHP for a number of things but never ran into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.