Software index script help please

Discussion in 'Programming' started by ScottDB, Dec 26, 2009.

  1. #1
    I downloaded a free script and I realy like it but it has no support and I am having problems with the downloads or members site links working. It is a banner exchange and software giveaway script combined.

    I am fairly new to php and not sure what the problem might be. If told where to look and what to fix I can probably handle it.

    When I click on the link for the software in the members pages I get the following for the address after the main site address in the bar. clicks_inc.php?id=39&click=1&url=http://newbiescentralexch.com/freestuff/10_Twitter4Pack.zip . The end of the link is the adress of the download and it is working. It is the information before download url that is not right I imagine. That I asume is the clicks_inc.php page needs to be tweeked or something.

    This is the entire contents of the clicks_inc.php file:
    <?
    include_once "config.php";
    if(isset($_REQUEST["id"]))
    {
    $rst=mysql_fetch_array(mysql_query("Select * from sbwmd_softwares where id=" . $_REQUEST["id"] ));
    if($_REQUEST["click"]==1)
    {
    mysql_query("update sbwmd_softwares set downloads=".($rst["downloads"]+1)." where id=" . $_REQUEST["id"] );
    header("Location:"."".$_REQUEST["url"]);
    }
    if($_REQUEST["click"]==2)
    {
    mysql_query("update sbwmd_softwares set hits_dev_site=".($rst["hits_dev_site"]+1)." where id=" . $_REQUEST["id"] );
    header("Location:"."".$_REQUEST["url"]);
    }
    
    }
    
    ?>
    Code (markup):
    If anyone can help and give me some Ideas on how to test this out further or if you would like I can give a link to download the script. You can visit the site and newbiescentral.com/software . I just uploaded it and have not edited it to much yet.

    Thanks in advance for any help here
     
    Last edited: Dec 26, 2009
    ScottDB, Dec 26, 2009 IP
  2. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Couple of suggestions for you to check.

    1. If id is a string field, you will have to pass it with single quotes as below
    id='" . $_REQUEST["id"] . "'"
    PHP:
    2. From the first SQL, check whether you have non-zero records for matching ID
    (I suspect this is not necessary as the ID exists on the table. However better to check)
     
    NeoCambell, Dec 26, 2009 IP