Jump to content

[SOLVED] echo in iframe


chanfuterboy

Recommended Posts

hi,

 

as i wrote the script is working fine in a stand alone page, as i included (..) to a page that use a Iframe, the page does not picup.

If i remove the if...else statement it work fine in iframe. What can be the problem?

 

<?php

include('dbconfig.php');

$rs = mysql_query("select * from chat where recv_ip='' and to_id='$_SESSION[userid]'");
$newpm = mysql_num_rows($rs);
$rt = mysql_query("select * from invites where resv_ip='' and frndid='$_SESSION[userid]'");
$newfr = mysql_num_rows($rt);

?>
<?php
if(!$_SESSION['userid'])
{
echo '<html>
<head>
<link rel="stylesheet" type="text/css" href="styles/ministyle.css"/>
<script type="text/javascript" src="./scripts/tabcontainer.js"></script>
<script type="text/javascript" src="./scripts/inc_lib.js"></script>
<script type="text/javascript" src="./scripts/scripts.js"></script>
<?php echo $base; ?>';


}else
{
echo '<html>
		<head>
		<link rel="stylesheet" type="text/css" href="styles/ministyle.css"/>
		<script type="text/javascript" src="./scripts/tabcontainer.js"></script>
		<script type="text/javascript" src="./scripts/inc_lib.js"></script>
		<script type="text/javascript" src="./scripts/scripts.js"></script>
		<?php echo $base; ?>';

echo'</head><body><p align="right">
		<img src="http://www.awortinkos.com/realgame/styles/pm.png"><b>
		<font color="#FFFFFF">PM '. $newpm .'</font></b>
		<img src="http://www.awortinkos.com/realgame/styles/invite.png"> <b>
		<font color="#FFFFFF" face="Verdana" size="2">friends '. $newfr .'</font></b></p>';
}

?>

Link to comment
https://forums.phpfreaks.com/topic/171221-solved-echo-in-iframe/
Share on other sites

Just doing it once because I'm lazy:

 

 

echo <html>

<head>

<link rel="stylesheet" type="text/css" href="styles/ministyle.css"/>

<script type="text/javascript" src="./scripts/tabcontainer.js"></script>

<script type="text/javascript" src="./scripts/inc_lib.js"></script>

<script type="text/javascript" src="./scripts/scripts.js"></script>

<?php echo $base; ?>';

 

 

Should be:

 

echo '<html>

<head>

<link rel="stylesheet" type="text/css" href="styles/ministyle.css"/>

<script type="text/javascript" src="./scripts/tabcontainer.js"></script>

<script type="text/javascript" src="./scripts/inc_lib.js"></script>

<script type="text/javascript" src="./scripts/scripts.js"></script>

<?php echo $base; ?>';

 

 

Then it should be:

 

 

echo '<html>

<head>

<link rel="stylesheet" type="text/css" href="styles/ministyle.css"/>

<script type="text/javascript" src="./scripts/tabcontainer.js"></script>

<script type="text/javascript" src="./scripts/inc_lib.js"></script>

<script type="text/javascript" src="./scripts/scripts.js"></script>'.

$base;

 

 

 

By the way, when you only want the number of rows and not the actual content, instead of doing:

 

 

$q = mysql_query("SELECT * FROM...");

$num_rows = mysql_num_rows($q);

 

 

You should do:

 

 

$q = mysql_query("SELECT COUNT(some_column) FROM ....")

$num_rows = mysql_result($q, 0);

 

 

 

Then again, you could be using the actual content in $base.

Archived

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

×
×
  • Create New...

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.