Jump to content


Photo

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


  • Please log in to reply
4 replies to this topic

#1 davinci

davinci
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 31 May 2006 - 11:52 PM

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:

<?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>

framecontents.php looks like this:

<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>

Can anyone point out the error?


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

Thanks!



#2 samshel

samshel
  • Members
  • PipPipPip
  • Advanced Member
  • 837 posts

Posted 01 June 2006 - 08:33 AM

Try

TARGET="_parent"
Cheers,
SamShel
-----------------------------------------------
--: FUTURE IS LINUX :--
-----------------------------------------------

#3 davinci

davinci
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 01 June 2006 - 12:34 PM

[!--quoteo(post=378989:date=Jun 1 2006, 04:33 AM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Jun 1 2006, 04:33 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Try

TARGET="_parent"
[/quote]


If you meant:
<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>

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

Any more ideas?

#4 samshel

samshel
  • Members
  • PipPipPip
  • Advanced Member
  • 837 posts

Posted 01 June 2006 - 12:54 PM

check the url u r passing

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

it must be framecontents.php
Cheers,
SamShel
-----------------------------------------------
--: FUTURE IS LINUX :--
-----------------------------------------------

#5 davinci

davinci
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 02 June 2006 - 03:22 AM

[!--quoteo(post=379051:date=Jun 1 2006, 08:54 AM:name=samshel)--][div class=\'quotetop\']QUOTE(samshel @ Jun 1 2006, 08:54 AM) View Post[/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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users