SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Help!

  1. #1
    SitePoint Member
    Join Date
    Feb 2000
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Help, I'm having problems with a php script called inlink that I'm trying to get working. I mean I've got it working, but I'm having problems at adding a banner ad at the top of my template pages: Here is the problem: Well, When I go to http://www.free-screen-saver.com/inl...ottemplate.php which is a template file I get all the code I need, but when I go to the script that reads the template at http://www.free-screen-saver.com/inlink the ssi's won't execute and I don't understand why...Here is the code to the http://www.free-screen-saver.com/inlink/index.php file. Sorry to do this, but I think it's neccessary to see what I need to change to get it to work:

    Code:
     <?php
    //Read in config file
    $configfile = "admin/setup.php";
    require($configfile);
    
    if (!$inlinkvisit) {
      setcookie("inlinkvisit", "1");
      $cookieset = "1";
    }
    if ($action == "logout") {
    setcookie("ilkadp" , "");
    }
    // rate a link
    if ($action == "rate") {
    // check if already voted
    $voteda = explode(" ", $voted);
    for ($votedan = 0; $votedan < count($voteda); ++$votedan) {
    if ($voteda[$votedan] == $id) {
    $novote = "1";
    }
    }  //end checking
    if ($novote != "1") {
    setcookie("voted", $voted . " $id");
    }
    
    if ($novote != "1") {
      $query = mysql_query("select * from links where linkid='$id'");
      if ($row = mysql_fetch_array($query)) {
        $rating = $row["rating"];
        $votes = $row["votes"];
        }
      $totalrate = ($rating * $votes) + $rate;
      $votes++;
      $rating = $totalrate / $votes;
      mysql_query("update links set rating='$rating', votes='$votes' where linkid='$id'");
      } 
    }
    
    if (($cat == "") || ($cat == "0")) {
    $fd = fopen($ROOTTEMP, "r");
    $temp = fread($fd, filesize($ROOTTEMP));
    fclose($fd);
    } elseif (file_exists("$FILEDIR$cat.txt")) {
    $fd = fopen("$FILEDIR$cat.txt", "r");
    $temp = fread($fd, filesize("$FILEDIR$cat.txt"));
    fclose($fd);
    } else {
    $fd = fopen($MAINTEMP, "r");
    $temp = fread($fd, filesize($MAINTEMP));
    fclose($fd);
    }
    
    //counter
    $stat = mysql_query("select * from stats where id='1'");
    if ($statrow = mysql_fetch_array($stat)) {
      $last_visited = $statrow["date"];
      }
    if ($cookieset == "1") {
      mysql_query("update stats set hits=hits+1");
      mysql_query("update stats set hitstoday=hitstoday+1");
      }
    if ($last_visited != date("ymd")) {
      mysql_query("update stats set hitstoday='1'");
      }
    // define variables
    $catq = "select * from cat where sub='$cat' order by name";
    $linkq = "select * from links where catid='$cat' order by $order";
    
    
    
    require($STATIC);
    require($FUNCTIONS);
    
    navbar();
    getstats();
    pagenav();
    printcat();
    printlink();
    image($V);
    
    //insert header footer
    
    if (ereg("<%INSERT_HEADER%>", $temp)) {
    $fd = fopen($HEADER, "r");
    $header = fread($fd, filesize($HEADER));
    fclose($fd);
    $temp = ereg_replace("<%INSERT_HEADER%>", $header, $temp);
    }
    if (ereg("<%INSERT_FOOTER%>", $temp)) {
    $fd = fopen($FOOTER, "r");
    $footer = fread($fd, filesize($FOOTER));
    fclose($fd);
    $temp = ereg_replace("<%INSERT_FOOTER%>", $footer, $temp);
    }
    
    $temp = ereg_replace("<%INSERT_NAVBAR_HERE%>", $navbar, $temp);
    $temp = ereg_replace("<%INSERT_SEARCH_FORM%>", $search, $temp);
    $temp = ereg_replace("<%INSERT_RESULT_CATS%>", $cats, $temp);
    $temp = ereg_replace("<%INSERT_RESULT_LINKS%>", $links, $temp);
    $temp = ereg_replace("<%INSERT_RESULT_NAV%>", $nav, $temp);
    $temp = ereg_replace("<%INSERT_FOOTER_LINKS%>", $botlinks, $temp);
    $temp = ereg_replace("<%INSERT_VERSION%>", $img, $temp);
    $temp = ereg_replace("<%INSERT_TOTAL_LINKS%>", $total_links, $temp);
    $temp = ereg_replace("<%INSERT_TOTAL_CATS%>", $total_cats, $temp);
    $temp = ereg_replace("<%INSERT_HITS_TODAY%>", $hits_today, $temp);
    $temp = ereg_replace("<%INSERT_HITS_TOTAL%>", $hits_total, $temp);
    //output HTML
    
    print $temp;
    ?>

    Sorry again about posting the code and all, but I felt it was necessary. Oh yeah, I got the script from http://www.intechnic.com/inlink if you want to see what I'm working with.

    Sincerly,

    Michael Mellinger
    Last edited by mellinger; Apr 19, 2001 at 16:39.

  2. #2
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is that you are trying to combine SSIs with PHP - and that doesn't work. Instead I suggest using the PHP include() function in place of your SSI calls. Simply rename the page with the SSIs to something.php, then replace all SSI calls with this:
    PHP Code:
    <?php
    include("path/to/include.php");
    ?>
    This will work for other files that you would normally include via SSIs such as text files / html files - however it won't work for CGI scripts that you include with SSI. A workaround for using the output of CGI scripts is to use include and specify a full URL to the script (complete with the http:// bit) - that should include the output of the script, provided your server has support for including external URLs turned on.

  3. #3
    SitePoint Member
    Join Date
    Feb 2000
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have that already included it the template file (it's near the top) and it still doesn't include it when it reads it. I know there are ssi's further down that page, but I never got around to changing those.


Bookmarks

Posting Permissions

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