Jump to content

Archived

This topic is now archived and is closed to further replies.

davinci

php files within php files... and using $_GET

Recommended Posts

Hi,

I tried putting together some code so that when someone visits a link off my site it opens the visited site with a frame on top of the page that has my little header.

For example: someone clicks on [a href=\"http://mysite.com/visit.php?=http://othersite.com\" target=\"_blank\"]http://mysite.com/visit.php?=http://othersite.com[/a]

My Problem: When I click the image of the little "x" in my frame in order to close the frame and show the site without a frame, instead of removing the frame, it removes the visited site instead and brings me to mysite.com/framecontents.php.

I believe the code that needs to be modified can be viewed below in framecontents.php


visit.php looks like this:

[code]
<?php

include 'library/config.php';
include 'library/opendb.php';

$query = "UPDATE plugs SET clicks = (clicks + 1) WHERE url = '$url'";

mysql_query($query) or die('Error, insert query failed');

?>



<title><?=$_GET[title]?> - Brought to you by MySite.com</title>
<frameset rows='100,*' border=0 frameborder=0 framespacing=0>
<frame scrolling=no noresize src='framecontents.php'>
<frame scrolling=yes frameborder=0 src='<?=$_GET[url]?>'>
</frameset>
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>[/code]

framecontents.php looks like this:

[code]
<html>
<head>
<title>CJ Link Out V1.0</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body topmargin="0" leftmargin="0">
<TABLE border="0" cellspacing="0" cellpadding="0" width="100%" height="75">  <TR>
  <TD>
    <TABLE border="0" cellspacing="2" cellpadding="1" width="100%">
      <TR>
      <TD width="1%" nowrap>
            <TD width="1%" valign="center">
        <A HREF="<?=$_GET['url']?>" TARGET="_top"><IMG SRC="close.gif" WIDTH="12" HEIGHT="11" BORDER="0" ALT="Remove Frame"></A>
            </TD>
            <TD width="99%" valign="center">
        <B><? echo ucfirst($show); ?></B>
            
<A HREF="index.php" TARGET="_top"><IMG SRC="neon.gif" class="nob"></a>

</TD>
     </TD>
     <TD width="99%" nowrap>
       <div align="right"><A HREF="index.php" TARGET="_top">Back to MySite.com        </A></div>
     </TD>
     </TR>
    </TABLE>    
  </TD>
  </TR>
</TABLE>[/code]

Can anyone point out the error?


I'm assuming its something wrong with this... Doesn't seem to be pulling the url...
[code]
<A HREF="<?=$_GET['url']?>" TARGET="_top"><IMG SRC="close.gif" WIDTH="12" HEIGHT="11" BORDER="0" ALT="Remove Frame"></A>[/code]

Thanks!

Share this post


Link to post
Share on other sites
[!--quoteo(post=378989:date=Jun 1 2006, 04:33 AM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Jun 1 2006, 04:33 AM) [snapback]378989[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Try

TARGET="_parent"
[/quote]


If you meant:
[code]
<TD width="1%" valign="center">
        <A HREF="<?=$_GET['url']?>" TARGET="_parent"><IMG SRC="close.gif" WIDTH="12" HEIGHT="11" BORDER="0" ALT="Remove

Frame"></A>
[/code]

Still doesn't work. When I click the button, it loads up framecontents.php, instead of othersite.com.

Any more ideas?

Share this post


Link to post
Share on other sites
check the url u r passing

<?=$_GET['url']?>

it must be framecontents.php

Share this post


Link to post
Share on other sites
[!--quoteo(post=379051:date=Jun 1 2006, 08:54 AM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Jun 1 2006, 08:54 AM) [snapback]379051[/snapback][/div][div class=\'quotemain\'][!--quotec--]
check the url u r passing

<?=$_GET['url']?>

it must be framecontents.php
[/quote]

The url in the browser is [a href=\"http://mysite.com/visit.php?url=http://othersite.com\" target=\"_blank\"]http://mysite.com/visit.php?url=http://othersite.com[/a]

When I click the button it takes me to framecontents.php which is my frame but where I want it to go is to [a href=\"http://othersite.com\" target=\"_blank\"]http://othersite.com[/a]...

I'm a newbie but it seems as if its trying to pull the from the framecontents.php.

Also, when I check the HTML source after clicking the close frame button, instead of the pulled 'url' value it is blank.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.