SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Oct 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    NEED a bit of help from PHP expert (should be easy)

    I posted this on the vBulletin forums as well, hopefully someone can help me here. I would appreciate any help.

    Hi guys,

    I've set up a script on our forums to track all outgoing clicks. Right now, any url that is posted on our forums automatically goes through a goto.php file, which logs where the user is going, and automatically redirects them there.

    What I'd *LIKE* to have is something similar to Hotmail, where the window that opens up for the user has a small frame at the top, which says "You are visiting a site outside of XYZ, click here to return to XYZ, etc. and the url they're going to would open in the lower frame.

    The following is the code from the goto.php file. I'd appreciate if someone could point me in the right direction on how to get this done. I have *NO CLUE* about php, so I'd need to know exactly what to add/remove?

    Thanks in advance!

    Code:
    <?php
    // Necessary Variables:
    
    $COUNT_FILE = "/home/bigforum/public_html/data/datac0.txt";
    	// En: Absolute path and name to count data file.
    	// Fr: Chemin absolu (complet) et Nom du fichier compteur.
    
    // End  Necessary Variables section
    /******************************************************************************/
    
    function error ($error_message) {
    	echo $error_message."<BR>";
    	exit;
    }
    
    $url = urldecode($QUERY_STRING);
    
    if (! file_exists($COUNT_FILE))
    	error("Can't find file, check '\$COUNT_FILE' var...");
    
    if ((! $url) || (! preg_match("/http:/", $url))) error ("Invalid url, you chould add url ex: <A HREF=\"http://$SERVER_NAME$PHP_SELF?http://www.ftls.org/\">http://$SERVER_NAME$PHP_SELF?http://www.ftls.org/</A>");
    
    $file_arry = file($COUNT_FILE); //or error("Can not open \$COUNT_FILE");
            
    while (list($key, $val) = each($file_arry)) {
    	if ($val != "") {
    		list($file_url, $nb) = preg_split("/\t|\n/", $val);
    		if ($file_url == $url) { 
    			$nb++; $file_arry[$key] = "$file_url\t$nb\n"; $find = 1;
    		}
    	}
    }
    
    $file = join ("", $file_arry);
    if (! $find) $file .= "$url\t1\n";
    
    $fp = fopen("$COUNT_FILE", "w"); //or error("Can not open \$COUNT_FILE");
    flock($fp, 1);
    fputs($fp, $file);                                                     
    flock($fp, 3);
    fclose($fp);
    header("Location: $url");
    
    ?>

  2. #2
    SitePoint Zealot theFinn's Avatar
    Join Date
    Oct 2000
    Location
    Edmonton
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I would suggest is that you redirect them to, insted of their intended targe, an 'intermediary' page.

    Basicly a PHP script that displays the header in 1 frame, and the body of the page the person wants to visit in another (like Hotmail does)

    Basicly you just need to create a little PHP page that will generate the frame source, so your goto.php page would eaither do this or the page the goto.php sends the browser to would do this..

    I hope this rambling helped you...heh
    - theFinn
    Creator and Project Manager, phpBB
    http://www.theFinn.net
    http://www.tarotclass.com

  3. #3
    SitePoint Member
    Join Date
    Oct 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    theFinn,

    Thanks for the response. I actually got it figured out, thanks to help from the Vbulletin forum. The solution was actually quite easy.

    Here's what any outgoing link from our forums looks like now:

    http://www.bigbigforums.com/goto.php...ee_samples.asp

    Alex

  4. #4
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Becareful of the legal ramifications of your chosen method. Nowhere do you have a link to close that farme, in essence you are hijcaking others sites' and displaying within your frameset. Most small sites prolly won't care, but I guarantee someone like amazon or yahoo, is not going to be too thrilled with your setup, that is if anyone links to them from your forums.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  5. #5
    SitePoint Member
    Join Date
    Oct 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    freddydoesphp,

    We're going to add a "remove this frame" link over the next few days, but we haven't had a single problem yet with merchants being inside a frame (99% of links from the main http://www.bigbigsavings.com website are inside a frame). We'll see how it goes, thanks for the reminder.

    Alex

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't forget the users of your site, are not the ones who are gonna be pissed, they prolly don't even realize its going on. But if the website owner whose site is being stuck within your frame finds out, thats when the potential problems can occur. I know if I found out you were using my site for free advertising without my permission I would be pissed.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    SitePoint Member
    Join Date
    Oct 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    freddydoesphp,

    It actually works the OTHER way. We always get companies trying to post on our forums to GET free advertising. We don't advertise for any of the companies that are posted about in our forums. Plus, this way users know that they're outside of bigbigsavings.com and won't be asking us for help on sites that are posted in the forum (happens often).

    Alex

  8. #8
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well there is no need to argue this anymore, I just know if it wasn't such a big deal, noone would be using frame-busting scripts, and about.com wouldn't have 50 disclaimers in their top frame.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  9. #9
    SitePoint Member
    Join Date
    Oct 2001
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    makes sense

    Alex


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
  •