How to insert Google Ads in left and right sidebar? - php

I want on my site to insert Google Ads on left and right sidebar, but I don't know how to create sidebars.
This is code from my header.php code that i have currently:
<?php
include "config.php";
?>
<html>
<head><meta name="adtictac-site-verification"
content="1qvt6zbzk026xfomo6gxbxxhjk9t96obv58gpcv3n9ver69s0"><meta
name="clckd" content="273a893ce34e0acd4ba2655313b5f902" />
<title><?php echo $sitename; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#2C60A9" leftmargin="1" topmargin="0" marginwidth="0"
marginheight="0">
<table width="777" border="2" bgcolor="#ffffff" align="center"
cellpadding="0" cellspacing="0" class="border">
<tr>
<td><img src="images/header.jpg" width="777" height="210" alt=""></td>
</tr>
<tr>
<td background="images/bg.jpg"><table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr>
<td width="30%"><img src="images/links.jpg" width="231" height="17"
alt=""></td>
<td width="7%"><A href="index.php"><img src="images/home.jpg" width="54"
height="17" alt="" border="0"></a></td>
<td width="11%"><A href="join.php"><img src="images/register.jpg"
width="83" height="17" alt="" border="0"></a></td>
<td width="7%"><A href="faq.php"><img src="images/faq.jpg" width="54"
height="17" alt="" border="0"></a></td>
<td width="12%"><A href="contactus.php"><img src="images/contact-us.jpg"
width="98" height="17" alt="" border="0"></a></td>
<td width="12%"><A href="advertise.php"><img src="images/advertise.jpg"
width="92" height="17" alt="" border="0"></a></td>
<td width="21%"><A href="login.php"><img src="images/login.jpg"
width="49" height="17" alt="" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td class="bodytext"> </td>
<td> </td>
</tr>
<tr>
<td width="7%"> </td>
<td width="91%" class="bodytext"><p align="justify">
<?php
include "config.php";
$rs=mysql_query("select ID,BannerURL from bannersads where remaining>0 and
approved=1 and adtype=1 order by rand() limit 0,1");
while($arr=mysql_fetch_array($rs)) {
echo "<br><center><a href=$siteurl/tr.php?id=$arr[0] target=_blank><img
src=$arr[1] width=468 height=60 border=0></a><br></center><br>";
$rsu=mysql_query("update bannersads set remaining=remaining-1 where
ID=$arr[0]");
}
?>
So can someone share some tips how to create sidebars where need to create placed like shown in image? I tryed inserting this:
<div class="google">
// Google Code here
</div>
and this CSS:
.google {
margin-left:-250px;
}
but looks like broke my content in my homepage.

.google {
left: 250px;
}
Also create a container and give it width in px, not %.
Let me hope that will solve your problem.

Related

Getting out of page

I have made a navbar in photoshop and converted into code using the Save to web function in Photoshop, now the navbar is getting displayed OK, but when I add other stuff code then it just gets out of the page, its width increases.
My navbar.html
<html>
<head>
<title>Couture Collection</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- Save for Web Slices (Untitled-3) -->
<table id="Table_01" width="1366" height="78" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5">
<img src="images/navbar_01.png" width="1125" height="21" alt=""></td>
<td colspan="2">
<img src="images/navbar_02.png" width="241" height="21" alt=""></td>
</tr>
<tr>
<td>
<img src="images/navbar_03.png" width="180" height="56" alt=""></td>
<td>
<img src="images/navbar_04.png" width="217" height="56" alt=""></td>
<td>
<img src="images/navbar_05.png" width="272" height="56" alt=""></td>
<td>
<img src="images/navbar_06.png" width="207" height="56" alt=""></td>
<td colspan="2">
<img src="images/navbar_07.png" width="414" height="56" alt=""></td>
<td>
<img src="images/navbar_08.png" width="76" height="56" alt=""></td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width="180" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="217" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="272" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="207" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="249" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="165" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="76" height="1" alt=""></td>
</tr>
</table>
<!-- End Save for Web Slices -->
</body>
</html>
1125+241 = 1366 and 180+217+272+207+414+76 = 1366
So if you add another td it will increase your nav and exceed 1366px. Best way should be to use real HTML + CSS to make your navbar instead of generating it with photoshop because it's using fixed width (which is not responsive at all)

Page glitches unless error_reporting is -1?

On my site, if error_reporting is not -1, the page entirely glitches out
I made two pages, both exactly the same except that testblog.php has error_reporting(0);, whereas blog.php has error_reporting(-1);
These are the pages:
http://pirates-online-rewritten.com/blog.php
http://pirates-online-rewritten.com/testblog.php
This is my code (please fix the format someone, I don't know how):
<?php
include "header2.php";
include "connect.php";
error_reporting(-1);
$ID = mysql_real_escape_string(strip_tags(stripslashes($_GET['ID'])));
$getPost = mysql_query("SELECT * FROM Blogs WHERE ID='$ID'");
$gP = mysql_fetch_object($getPost);
?>
<table border="0" cellpadding="0" cellspacing="0" width="626" summary="layout table">
<tr>
<td valign="top" width="626">
<!-- BEGIN CENTER CONTENT -->
<table border="0" cellpadding="0" cellspacing="0" width="626" summary="layout table">
<tr>
<td colspan="3" width="626"><img src="http://www.pirates-online-rewritten.com/images/Title_currentnews.gif" width="626" height="86" border="0" alt="Current News" /></td>
</tr>
<tr valign="top">
<td background="http://www.pirates-online-rewritten.com/images/parch_left.gif">
<img src="http://www.pirates-online-rewritten.com/images/dot.gif" width="57" height="327" border="0" alt="" />
</td>
<td background="http://www.pirates-online-rewritten.com/images/parch_bg.gif">
<?php
echo $gP->Title, $gP->Body;
?>
</td>
<td background="http://www.pirates-online-rewritten.com/images/parch_right.gif">
<img src="http://www.pirates-online-rewritten.com/images/dot.gif" width="58" height="327" border="0" alt="" />
</td>
</tr>
<tr>
<td colspan="3" width="626">
<img src="http://www.pirates-online-rewritten.com/images/parch_bot.gif" alt="parch_bot.jpg" width="626" height="55" border="0" />
</td>
</tr>
<tr>
<!-- SET THE MENU LAYOUT -->
<td>
<img src="http://www.pirates-online-rewritten.com/images/spacer.gif" height="0" width="0"/>
</td>
</tr>
</table>
<!-- END CENTER CONTENT -->
</td>
</tr>
</table>
</div>
<?php
include "footer.php";
?>

php session on undefinded constant

Notice: Use of undefined constant login - assumed 'login' in C:\wamp\www\Online_exam\header.php on line 43
Notice: Use of undefined constant login - assumed 'login' in C:\wamp\www\Online_exam\header.php on line 47
Notice: Use of undefined constant login - assumed 'login' in C:\wamp\www\Online_exam\index.php on line 30
I am new to PHP and learning SESSION, and i am trying to explore on that and i am receiving the above errors. Everything looks correct for me. Please somebody help me.
Index.php
<?php
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Wel come to Online Exam</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="quiz.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
include("header.php");
include("database.php");
extract($_POST);
if(isset($submit))
{
$rs=mysql_query("select * from mst_user where login='$loginid' and pass='$pass'");
if(mysql_num_rows($rs)<1)
{
$found="N";
}
else
{
$_SESSION[login]=$loginid;
}
}
if (isset($_SESSION[login]))
{
echo "<h1 class='style8' align=center>Wel come to Online Exam</h1>";
echo '<table width="28%" border="0" align="center">
<tr>
<td width="7%" height="65" valign="bottom"><img src="image/HLPBUTT2.JPG" width="50" height="50" align="middle"></td>
<td width="93%" valign="bottom" bordercolor="#0000FF"> Subject for Quiz </td>
</tr>
<tr>
<td height="58" valign="bottom"><img src="image/DEGREE.JPG" width="43" height="43" align="absmiddle"></td>
<td valign="bottom"> Result </td>
</tr>
</table>';
exit;
}
?>
<table width="100%" border="0">
<tr>
<td width="70%" height="25"> </td>
<td width="1%" rowspan="2" bgcolor="#CC3300"><span class="style6"></span></td>
<td width="29%" bgcolor="#CC3333"><div align="center" class="style1">User Login </div></td>
</tr>
<tr>
<td height="296" valign="top"><div align="center">
<h1 class="style8">Wel come to Online Quiz</h1>
<span class="style5"><img src="image/paathshala.jpg" width="129" height="100"><span class="style7"><img src="image/HLPBUTT2.JPG" width="50" height="50"><img src="image/BOOKPG.JPG" width="43" height="43"></span> </span>
<param name="movie" value="english theams two brothers.dat">
<param name="quality" value="high">
<param name="movie" value="Drag to a file to choose it.">
<param name="quality" value="high">
<param name="BGCOLOR" value="#FFFFFF">
<p align="left" class="style5"> </p>
<blockquote>
<p align="left" class="style5"><span class="style7">Wel Come to Online
exam. This Site will provide the quiz for various subject of interest.
You need to login for the take the online exam.</span></p>
</blockquote>
</div></td>
<td valign="top"><form name="form1" method="post" action="">
<table width="200" border="0">
<tr>
<td><span class="style2">Login ID </span></td>
<td><input name="loginid" type="text" id="loginid2"></td>
</tr>
<tr>
<td><span class="style2">Password</span></td>
<td><input name="pass" type="password" id="pass2"></td>
</tr>
<tr>
<td colspan="2"><span class="errors">
<?php
if(isset($found))
{
echo "Invalid Username or Password";
}
?>
</span></td>
</tr>
<tr>
<td colspan=2 align=center class="errors">
<input name="submit" type="submit" id="submit" value="Login"> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#CC3300"><div align="center"><span class="style4">New User ? Signup Free</span></div></td>
</tr>
</table>
<div align="center">
<p class="style5"><img src="images/topleft.jpg" width="134" height="128"> </p>
</div>
</form></td>
</tr>
</table>
</body>
</html>
Header.php
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
}
-->
</style>
<table border="0" width="100%" cellspacing="0" cellpadding="0" background="image/topbkg.jpg">
<tr>
<td width="90%" valign="top">
<!--You can modify the text, color, size, number of loops and more on the flash header by editing the text file (fence.txt) included in the zip file.-->
<div align="left"><object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000
codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,2,0
width=500
height=68>
<param name=movie value=image/fence.swf>
<param name=quality value=high>
<param name=BGCOLOR value=#000000>
<param name=SCALE value=showall>
<param name=wmode value=transparent>
<embed src=image/fence.swf
quality=high
pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash
width=500
height=68
bgcolor=#000000
scale= showall>
</embed>
</object></div></td>
<td width="10%">
<img border="0" src="image/topright.jpg" width="203" height="68" align="right"></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#000000" background="img/blackbar.jpg">
<tr>
<td width="100%" align="right"><img border="0" src="image/blackbar.jpg" width="89" height="15"></td>
</tr>
</Table>
<Table width="100%">
<tr>
<td>
<?php "Hi ".$_SESSION[login]; ?>
</td>
<td>
<?php
if(isset($_SESSION[login]))
{
echo "<div align=\"right\"><strong> Home |Signout</strong></div>";
}
else
{
echo " ";
}
?>
</tr>
</table>
session variable should wrap with ' '...
change your session variable like this...
$_SESSION['session_var_name'];
and in your case it should..
$_SESSION['login']
You have to give the session name inside quotes only. Use
$_SESSION['login'] or $_SESSION["login"]
Non-numeric array key constants should be enclosed in quotes, either single or double. Otherwise, php thinks you are referring to a constant name. And since it's undefined, it falls back to guessing you just forgot the quotes...
That's why it works. And that's why the issue appears as a Notice. But in order to do away with it, change $_SESSION[login] to $_SESSION['login'].
Replace $_SESSION[login] into $_SESSION['login'] in all occurance of your code
<?php
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Wel come to Online Exam</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="quiz.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
include("header.php");
include("database.php");
extract($_POST);
if(isset($submit))
{
$rs=mysql_query("select * from mst_user where login='$loginid' and pass='$pass'");
if(mysql_num_rows($rs)<1)
{
$found="N";
}
else
{
$_SESSION['login']=$loginid;
}
}
if (isset($_SESSION['login']))
{
echo "<h1 class='style8' align=center>Wel come to Online Exam</h1>";
echo '<table width="28%" border="0" align="center">
<tr>
<td width="7%" height="65" valign="bottom"><img src="image/HLPBUTT2.JPG" width="50" height="50" align="middle"></td>
<td width="93%" valign="bottom" bordercolor="#0000FF"> Subject for Quiz </td>
</tr>
<tr>
<td height="58" valign="bottom"><img src="image/DEGREE.JPG" width="43" height="43" align="absmiddle"></td>
<td valign="bottom"> Result </td>
</tr>
</table>';
// exit;
}
?>
<table width="100%" border="0">
<tr>
<td width="70%" height="25"> </td>
<td width="1%" rowspan="2" bgcolor="#CC3300"><span class="style6"></span></td>
<td width="29%" bgcolor="#CC3333"><div align="center" class="style1">User Login </div></td>
</tr>
<tr>
<td height="296" valign="top"><div align="center">
<h1 class="style8">Wel come to Online Quiz</h1>
<span class="style5"><img src="image/paathshala.jpg" width="129" height="100"><span class="style7"><img src="image/HLPBUTT2.JPG" width="50" height="50"><img src="image/BOOKPG.JPG" width="43" height="43"></span> </span>
<param name="movie" value="english theams two brothers.dat">
<param name="quality" value="high">
<param name="movie" value="Drag to a file to choose it.">
<param name="quality" value="high">
<param name="BGCOLOR" value="#FFFFFF">
<p align="left" class="style5"> </p>
<blockquote>
<p align="left" class="style5"><span class="style7">Wel Come to Online
exam. This Site will provide the quiz for various subject of interest.
You need to login for the take the online exam.</span></p>
</blockquote>
</div></td>
<td valign="top"><form name="form1" method="post" action="">
<table width="200" border="0">
<tr>
<td><span class="style2">Login ID </span></td>
<td><input name="loginid" type="text" id="loginid2"></td>
</tr>
<tr>
<td><span class="style2">Password</span></td>
<td><input name="pass" type="password" id="pass2"></td>
</tr>
<tr>
<td colspan="2"><span class="errors">
<?php
if(isset($found))
{
echo "Invalid Username or Password";
}
?>
</span></td>
</tr>
<tr>
<td colspan=2 align=center class="errors">
<input name="submit" type="submit" id="submit" value="Login"> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#CC3300"><div align="center"><span class="style4">New User ? Signup Free</span></div></td>
</tr>
</table>
<div align="center">
<p class="style5"><img src="images/topleft.jpg" width="134" height="128"> </p>
</div>
</form></td>
</tr>
</table>
</body>
</html>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
}
-->
</style>
<table border="0" width="100%" cellspacing="0" cellpadding="0" background="image/topbkg.jpg">
<tr>
<td width="90%" valign="top">
<!--You can modify the text, color, size, number of loops and more on the flash header by editing the text file (fence.txt) included in the zip file.-->
<div align="left"><object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000
codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,2,0
width=500
height=68>
<param name=movie value=image/fence.swf>
<param name=quality value=high>
<param name=BGCOLOR value=#000000>
<param name=SCALE value=showall>
<param name=wmode value=transparent>
<embed src=image/fence.swf
quality=high
pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash
width=500
height=68
bgcolor=#000000
scale= showall>
</embed>
</object></div></td>
<td width="10%">
<img border="0" src="image/topright.jpg" width="203" height="68" align="right"></td>
</tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#000000" background="img/blackbar.jpg">
<tr>
<td width="100%" align="right"><img border="0" src="image/blackbar.jpg" width="89" height="15"></td>
</tr>
</Table>
<Table width="100%">
<tr>
<td>
<?php
if(isset($_SESSION['login']))
{
print "Hi ".$_SESSION['login'];
}
?>
</td>
<td>
<?php
if(isset($_SESSION['login']))
{
echo "<div align=\"right\"><strong> Home |Signout</strong></div>";
}
else
{
echo " ";
}
?>
</tr>
</table>

parse error syntax error unexpected end of file in closed [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Can anyone find what is wrong with this code? i have Parse error: syntax error, unexpected end of file in C:\Program Files\EasyPHP-12.1\www\index.php on line 229
wondering if you can help me with this i'm so confused...
<?php include("./ayarlar.php");
if(isset($_GET['uygulama']) && $_GET['uygulama']=="cikis"){
$_SESSION['uyeKontrol']="";
$_SESSION['uyeTanimlama']="";
$_SESSION['uyeAdi']="";
header( 'Location: ./' );
}
?>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<script id="jquery.core" src="uygulamalar/jquery.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="uygulamalar/menu.js"></script>
<link href="tasarim/icon.png" rel="shortcut icon">
<title><?=$sitebaslik?></title>
<style type="text/css">
ul.listemiz{width:985px;list-style:none;float:left; padding:10px 0px 0px 23px;}
ul.listemiz li{width: 220px; height:211px; float: left; background:url(tasarim/list.png);padding:6px 18px 0px 0px;}
</style>
<style type="text/css">
ul.gorsel{width:1100px;list-style:none;float:left; margin:0px 0px 0px 0px;padding:0px 0px 0px 0px;}
ul.gorsel li{width: 230px; height:143px; float: left; background:url(tasarim/tm.png);padding:6px 12px 0px 0px;}
</style>
<link rel="stylesheet" href="Standard/css/global.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"></script>
<script src="Standard/js/slides.min.jquery.js"></script>
<script>
$(function(){
$('#slides').slides({
preload: true,
preloadImage: 'Standard/img/loading.gif',
play: 5000,
pause: 2500,
hoverPause: true
});
});
</script>
</head>
<body style="background-attachment: scroll; background-color:#E6E6E6">
<div class="temel">
<?php include("./site01.php");?>
<div id="sayfaicerigi"><div align="center"><br />
<table border="0" width="980" height="310" cellspacing="0" cellpadding="0">
<tr>
<td width="302" valign="top" align="left">
<?php if(isset($_SESSION['uyeKontrol']) && $_SESSION['uyeKontrol']!=""){?>
<table border="0" width="295" cellspacing="0" cellpadding="0" height="103" background="img/<?=$menu102?>.png">
<tr>
<td valign="top" align="center"></td>
</tr>
<tr>
<td valign="center" align="center" height="40">
<a href="hesabim">
<img border="0" src="img/<?=$menu108?>.png" width="120" height="32"></a>
<img border="0" src="img/<?=$menu109?>.png" width="120" height="32"></td>
</tr>
<tr>
<td valign="top" align="center" height="33">
<font face="Tahoma" color="#FFFFFF" style="font-size: 11pt">Hoş geldin: <?=$_SESSION['uyeAdi']?>
</font>
</td>
</tr>
</table>
<p><img border="0" src="img/EMLK.png" width="295" height="103"></p>
<?}else{?>
<table border="0" width="295" cellspacing="0" cellpadding="0" height="103" background="img/<?=$menu102?>.png">
<tr>
<td valign="top" align="center"></td>
</tr>
<tr>
<td valign="center" align="center" height="40">
<a href="kurumsal-giris">
<img border="0" src="img/<?=$menu104?>.png" width="120" height="32"></a>
<img border="0" src="img/<?=$menu103?>.png" width="120" height="32"></td>
</tr>
<tr>
<td valign="top" align="center" height="33">
<a href="uye">
<img border="0" src="img/uyecik.png" width="244" height="23"></a></td>
</tr>
</table>
<p><img border="0" src="img/EMLK.png" width="295" height="103"></p>
<?php }?>
</td><td width="13"></td>
<td width="665" valign="top" align="left">
<div style="position: absolute; width: 100px; height: 100px; z-index: 501" id="katman2">
<img src="Standard/img/new-ribbon.png" width="112" height="112" alt="New Ribbon" id="ribbon">
<div id="slides">
<div class="slides_container">
<?php
$mansetler = mysql_query("SELECT * FROM emlak order by id desc LIMIT 0,7");
while($manset = mysql_fetch_array($mansetler))
{
$mansetlerCO = mysql_query("SELECT * FROM resimler where emlak='".$manset['id']."'");
if($mansetCO = mysql_fetch_array($mansetlerCO))
{
}
?>
<a href="<?=$manset['id']?>_<?=duzgundur(StrToLower($manset['emlak']))?>.html" title="" >
<div style="position: absolute; width: 595px; height: 60px; top:220px; z-index: 102; background:#C0C0C0; color:#fff; overflow:hidden; z-index:200; opacity:.8; filter:alpha(opacity=80)" id="katman3" ><br> <b><font color="#000000" face="Tahoma" style="font-size: 12pt"><?=substr($manset['emlak'],0,60)?>.. - Fiyat: <?=$manset['fiyat']?> TL</font></b></div>
<img src="<?=$mansetCO['resim']?>" width="600" height="270" alt=""></a>
<?php }?>
</div>
<img src="Standard/img/arrow-prev.png" width="24" height="43" alt="Arrow Prev">
<img src="Standard/img/arrow-next.png" width="24" height="43" alt="Arrow Next">
</div>
<img src="Standard/img/example-frame.png" width="739" height="341" alt="Example Frame" id="frame">
</div>
</td>
</tr>
</table></div>
<table border="0" width="980" height="33" style="border-bottom:1px solid #dcdbdb;">
<tr>
<td valign="center" align="left" width="35">
<img border="0" src="tasarim/icon.png" width="24" height="24"></td>
<td valign="center" align="left" width="293">
<?=$menu3?></td>
<td valign="center" align="left" width="638">
<p align="right"><?=$menu100?> </td>
</tr>
</table>
<table border="0" width="980" height="131" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" align="left" width="980">
<ul class="gorsel">
<?php
$rastgeleler = mysql_query("SELECT * FROM emlak WHERE durum=2 and onay=1 order by id desc LIMIT 8");
while($rastgele = mysql_fetch_array($rastgeleler))
{
?><li>
<table border="0" width="238" height="113" cellspacing="0" cellpadding="0">
<tr>
<td width="14"> </td>
<td width="115">
<a href="<?=$rastgele['id']?>_<?=duzgundur(StrToLower($rastgele['emlak']))?>.html">
<?php
$resimsecici = mysql_query("SELECT * FROM resimler where emlak='".$rastgele['id']."'");
if($resimci = mysql_fetch_array($resimsecici))
{
?><img border="0" src="goruntule?img=<?=$resimci['resim']?>&w=110&h=91"><?}?></a></td>
<td width="109"><font face="Tahoma" size="2"><?=$menu88?> :<?php if($rastgele['durum']==1){?><?=$menu19?><?}else{?><?=$menu20?><?php }?><br>
<?=$menu18?>: <?=$rastgele['fiyat']?> TL<br>
<?=$rastgele['ilce']?>/<?=substr($rastgele['il'],0,3)?>.<br>
<br>
<a href="<?=$rastgele['id']?>_<?=duzgundur(StrToLower($rastgele['emlak']))?>.html">
<img border="0" src="tasarim/<?=$menu97?>.png" width="84" height="18"></a></font></td>
</tr>
</table>
</li> <?}?>
</ul></td>
</tr>
</table>
<table border="0" width="980" height="33" style="border-bottom:1px solid #dcdbdb;">
<tr>
<td valign="center" align="left" width="35">
<img border="0" src="tasarim/icon.png" width="24" height="24"></td>
<td valign="center" align="left" width="272">
<?=$menu2?></td>
<td valign="center" align="left" width="659">
<p align="right"><?=$menu100?> </td>
</tr>
</table>
<table border="0" width="980" height="131" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" align="left" width="980">
<ul class="gorsel">
<?php
$rastgeleler = mysql_query("SELECT * FROM emlak WHERE durum=1 and onay=1 order by id desc LIMIT 4");
while($rastgele = mysql_fetch_array($rastgeleler))
{
?><li>
<table border="0" width="238" height="113" cellspacing="0" cellpadding="0">
<tr>
<td width="14"> </td>
<td width="115">
<a href="<?=$rastgele['id']?>_<?=duzgundur(StrToLower($rastgele['emlak']))?>.html">
<?php
$resimsecicim = mysql_query("SELECT * FROM resimler where emlak='".$rastgele['id']."'");
if($resimcim = mysql_fetch_array($resimsecicim))
{
?><img border="0" src="goruntule?img=<?=$resimcim['resim']?>&w=110&h=91"><?}?></a></td>
<td width="109"><font face="Tahoma" size="2"><?=$menu88?> :<?php if($rastgele['durum']==1){?><?=$menu19?><?}else{?><?=$menu20?><?php }?><br>
<?=$menu18?>: <?=$rastgele['fiyat']?> TL<br>
<?=$rastgele['ilce']?>/<?=substr($rastgele['il'],0,3)?><br>
<br>
<a href="<?=$rastgele['id']?>_<?=duzgundur(StrToLower($rastgele['emlak']))?>.html">
<img border="0" src="tasarim/<?=$menu97?>.png" width="84" height="18"></a></font></td>
</tr>
</table>
</li> <?php }?>
</ul></td>
</tr>
</table>
</div>
<br>
<?php include("./site02.php");?><br><br>
</div>
</body>
</html>
<?php
$_SESSION['gidenemlak']="";
?>
I think the problem is this piece: }?> Which is located somewhere in the middle of the code.
You shouldn't put brackets directly close to the open/close php tag, but separate with space: } ?>
The error is caused because of lacking space between open/close php tag and brackets. You should avoied this:
{?> AND <?}else{?>
Instead, you should have it like this:
{ ?> AND <?php else{ ?>
You are missing some ending curly brackets in your script

PHP Trying to get string from a table cell with regular expressions

I have the following site and I want with regular expressions to get the text between the following tags
<td colspan="2" align="left" valign="top" bgcolor="#FBFAF4"> ..... </td>
I am trying with the following however it returns an empty array of $matches.
preg_match_all("/<td(.*) bgcolor=\"#FBFAF4\"\>(.*)\<\/td>/",$old_filecontents,$matches);
Which is the correct pattern for this?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Exotiq - Ðñïúüíôá</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7"> <link href="Styles.css" rel="stylesheet" type="text/css"> <link href="stylesheets/Styles.css" rel="stylesheet" type="text/css"> <script src="scripts/PopBox.js" type="text/javascript"></script> <script type="text/javascript"> popBoxWaitImage.src = "images/spinner40.gif"; popBoxRevertImage = "images/magminus.gif"; popBoxPopImage = "images/magplus.gif"; </script> <script type="text/javascript"> AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab#version=9,0,28,0', 'width','675','height','445','title','Morpork', 'src','assets/flash/morepork','loop', 'false','quality','high','pluginspage', 'http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash', 'wmode','transparent','movie','assets/flash/morepork'); </script> </head> <body background="images/fonto2.jpg" topmargin="0"> <table width="948" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><table width="948" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="24"> </td> <td height="150" colspan="3"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="900" height="150"> <param name="movie" value="flash/top02.swf"> <param name="quality" value="high"> <param name="wmode" value="transparent"> <embed src="flash/top02.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="900" height="150"></embed></object></td> <td width="24" height="150"> </td> </tr> <tr> <td height="31" colspan="5" valign="middle"> <div align="center"> <script src="menu/xaramenu.js"></script> <script Webstyle4 src="menu/menu_.js"></script> </div></td> </tr> <tr> <td width="24"> </td> <td width="200" valign="top" background="images/GreenFasa.jpg"> <br> <table width="180" border="0" align="center" cellpadding="0" cellspacing="1"> <tr> <td height="25" class="styles"> Makuti<br> <hr> </td> </tr> <tr> <td height="25" class="styles"> Fun Palm<br> <hr> </td> </tr> <tr> <td height="25" class="styles"> Alang-Alang<br> <hr> </td> </tr> <tr> <td height="25" class="styles"> Thatch<br> <hr> </td> </tr> <tr> <td height="25" class="styles"> <strong>Abaca</strong><br> <hr> </td> </tr> <tr> <td height="25" class="styles"> </td> </tr> </table></td> <td colspan="2" align="left" valign="top" bgcolor="#FBFAF4"> <div align="left"> <table width="680" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="600" height="40" class="titles">ÊáôáóêåõÝò - ÏìðñÝëåò - Abaca</td> <td width="50" align="right" valign="middle" class="titles"> <div align="right"><img src="images/uk-flag.jpg" width="30" height="17" border="0"></div></td> </tr> <tr> <td colspan="2" class="body"><p>Ç ïìðñÝëá <strong>Abaca</strong> Ýñ÷åôáé ùò Üîéïò áíôéêáôáóôÜôçò ôçò ïìðñÝëáò Rattan ðïõ åðß 15 ÷ñüíéá óôïëßæåé ôéò åëëçíéêÝò ðáñáëßåò. Ôï <strong>Abaca</strong> åßíáé Ýíá öõóéêü õëéêü ðéï <strong>áíèåêôéêü</strong> êáé ðéï üìïñöï áðü ôï Rattan. <br> Ðáñáäßäåôáé ìå <strong>îýëéíï êïñìü åìðïôéóìïý</strong> Ö8åê.<br> <br> </p> <table width="680" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="340" height="150" valign="middle"> <div align="left"><img src="images/Manufactures/Umbrelas/Abaca/AbacaUmbrela.jpg" width="328" height="500"></div></td> <td width="340" height="150" valign="bottom" class="body"> <table width="340" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="170" height="130"> <div align="center"><img src="images/Manufactures/Umbrelas/Abaca/1_Abaca02_s.jpg" width="152" height="101" class="PopBoxImageSmall" onclick="Pop (this,50,'PopBoxImageLarge');" title="ÌåãÝèõíóç" pbsrc="images/Manufactures/Umbrelas/Abaca/1_Abaca02.jpg" pbCaption="Abaca - ÏìðñÝëá ðáñáëßáò" popBoxCaptionBelow="true" /></div></td> <td width="170" height="130"> <div align="center"><img src="images/Manufactures/Umbrelas/Abaca/2_Abaca03_s.jpg" width="150" height="112" class="PopBoxImageSmall" onclick="Pop (this,50,'PopBoxImageLarge');" title="ÌåãÝèõíóç" pbsrc="images/Manufactures/Umbrelas/Abaca/2_Abaca03.jpg" pbCaption="Abaca - ÏìðñÝëá ðáñáëßáò" popBoxCaptionBelow="true" /></div></td> </tr> <tr> <td width="170" height="130"> <div align="center"><img src="images/Manufactures/Umbrelas/Abaca/3_Abaca01_s.jpg" width="150" height="112" class="PopBoxImageSmall" onclick="Pop (this,50,'PopBoxImageLarge');" title="ÌåãÝèõíóç" pbsrc="images/Manufactures/Umbrelas/Abaca/3_Abaca01.jpg" pbCaption="Abaca - ÏìðñÝëá ðáñáëßáò" popBoxCaptionBelow="true" /></div></td> <td width="170" height="130"> <div align="center"></div></td> </tr> <tr> <td width="170" height="130"> <div align="center"></div></td> <td width="170" height="130"> <div align="center"></div></td> </tr> <tr> <td width="170" height="130"> <div align="center"></div></td> <td width="170" height="130"> <div align="center"></div></td> </tr> </table></td> </tr> <tr> <td width="340" height="50" valign="top"> <p align="center"> </p></td> <td width="340" height="50" valign="top"> <div align="center" class="perigrafes">ÊëéêÜñåôáé ðÜíù óôéò öùôïãñáößåò ãéá ìåãÝèõíóç</div></td> </tr> <tr> <td width="340" valign="bottom"> <div align="center"> </div></td> <td width="340" valign="bottom"> <p align="center"> </p></td> </tr> <tr> <td width="340" valign="top"> <div align="center"></div></td> <td width="340" valign="top"> <p align="center"> </p></td> </tr> <tr> <td height="20" colspan="2" valign="top"> </td> </tr> </table></td> </tr> </table> <font color="#FFFFFF"></font></div></td> <td width="24" height="420"> </td> </tr> <tr> <td width="24"> </td> <td width="200"> </td> <td width="600"> </td> <td width="100"> </td> <td width="24"> </td> </tr> </table></td> </tr> <tr> <td height="22"><table width="900" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#007F3E"> <tr> <td height="25"> <div align="center" class="styles">All rights reserved ® Designed by CONTINENTAL ADVERTISING </div></td> </tr> </table></td> </tr> </table> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-12742174-1"); pageTracker._trackPageview(); } catch(err) {}</script> </body> </html>
Given that the cell you're talking about contains HTML, another table in fact, you can't do traditional termination checking ... or you'll get the content between the cell opening and the first </td> you find. Plus '.' isn't multi-line friendly, so unless your cell opens and terminates on the same line, you'll get no matches.
I'd say don't use regular expressions for this. Try an XML parser.
If you were just getting plain text, that'd be fine, but because you're returning HTML which contains your terminator, you'll need to use a parser with some kind of DOM depth awareness ... ... or find a way to count terminators in regex.

Categories