Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

syntax error, kako rijesiti

[es] :: PHP :: syntax error, kako rijesiti

[ Pregleda: 2593 | Odgovora: 12 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Sandin

Član broj: 173998
Poruke: 48
92.241.158.*



Profil

icon syntax error, kako rijesiti27.09.2008. u 16:53 - pre 189 meseci
Parse error: syntax error, unexpected '?' in /home/xxxxx/public_html/sivo/details.php on line 8

Citat:

<?


if (!eregi("index.php", $_SERVER["PHP_SELF"])) {
die ("You can't access this file directly...");
}

eval ("<form action=\""<?php echo $_SERVER['PHP_SELF']; ?>"\" method=\"post\">");


$index = 1;


include("header.php");
global $link,$prefix,$map,$site_path;
echo"<br>";


evo dio koda ne znam dje sam pogrijesio nikako mi nece nema sta nisampokuso :S

No keyboard attached. Press F1 to continue!
 
Odgovor na temu

Jezdimir Lončar
Aka Blazeme
PHP/jQuery Dev, BildStudio
Crna Gora / Pljevlja

Član broj: 74833
Poruke: 674
77.222.11.*

Jabber: jezdonet@gmail.com


+4 Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:23 - pre 189 meseci
http://php.net/eval
Probaj ovako:
Code:

<?
if (!eregi("index.php", $_SERVER["PHP_SELF"])) {
die ("You can't access this file directly...");
}
echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";


$index = 1;


include("header.php");
global $link,$prefix,$map,$site_path;
echo"<br>";
?>


EDIT.
Evo ako mora preko eval:
Code:

<?
if (!eregi("index.php", $_SERVER["PHP_SELF"])) {
die ("You can't access this file directly...");
}
eval("echo \"<form action='{$_SERVER['PHP_SELF']}' method='post'>\";");


$index = 1;

include("header.php");
global $link,$prefix,$map,$site_path;
echo"<br>";
?>

“I never think of the future - it comes soon enough.” - Albert Anštajn (Albert Einstein)
 
Odgovor na temu

Nemanja Avramović
Engineering Manager
MENU Technologies
Beograd, Srbija

Moderator
Član broj: 32202
Poruke: 4391
79.101.161.*

Sajt: https://avramovic.info


+46 Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:23 - pre 189 meseci
Ne znam zašto tu javlja grešku, ali u tom slučaju uopšte nije potrebno koristiti eval već običan echo:

Code:
echo "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">";


I da, "global" se koristi samo unutar funkcije.

izmena: Jezdimir i ja smo pisali u isto vreme.
Laravel Srbija.

[NE PRUŽAM PODRŠKU ZA PHP PREKO PRIVATNIH PORUKA!]
 
Odgovor na temu

Sandin

Član broj: 173998
Poruke: 48
92.241.158.*



Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:30 - pre 189 meseci
da hvala vam decki, iso sam sa echo, ali evo opet mi javlja drugu gresku :S

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/xxxxx/public_html/sivo/details.php on line 128

evo copy koda od linije 126 pa do 174 jednostavno ne mogu naci u cemu je problem :S

Code:

echo"
<table width=\"412\" height=\"335\" align=\"center\">
  <tr>
    <td width=\"145\" height=\"28\"><span class="style3">Adresa:</span></td>
    <td width=\"257\"><span class="style4">$addr</span></td>
  </tr>
  <tr>
    <td><span class="style3">Telefon:</span></td>
    <td><span class="style4">$phone</span></td>
  </tr>
  <tr>
    <td><span class="style3">Mobitel:</span></td>
    <td><span class="style4">$mobile</span></td>
  </tr>
  <tr>
    <td><span class="style3">Fax:</span></td>
    <td><span class="style4">$fax</span></td>
  </tr>
  <tr>
    <td><span class="style3">Kanton:</span></td>
    <td><span class="style4">$state</span></td>
  </tr>
  <tr>
    <td><span class="style3">Grad:</span></td>
    <td><span class="style4">$city</span></td>
  </tr>
  <tr>
    <td><span class="style3">Država:</span></td>
    <td><span class="style4">$country</span></td>
  </tr>
  <tr>
    <td><span class="style3">Poštanski broj:</span></td>
    <td><span class="style4">$postcode</span></td>
  </tr>
  <tr>
    <td><span class="style3">e-Mail:</span></td>
    <td><span class="style4">$email</span></td>
  </tr>
  <tr>
    <td><span class="style3">Website:</span></td>
    <td><span class="style4">$website</span></td>
  </tr>
  <tr>
    <td><span class="style3">Mapa:</span></td>
    <td><a href=\"http://www.mapquest.com/maps/map.adp?country=".urlencode($country)."&address=".urlencode($addr)."&city=".urlencode($city)."&state=".urlencode($state)."&zipcode=$postcode&submit=Get+Map\"; class="style4"
>Get Map</a></td>
  </tr>
</table>";
}

No keyboard attached. Press F1 to continue!
 
Odgovor na temu

Jezdimir Lončar
Aka Blazeme
PHP/jQuery Dev, BildStudio
Crna Gora / Pljevlja

Član broj: 74833
Poruke: 674
77.222.11.*

Jabber: jezdonet@gmail.com


+4 Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:31 - pre 189 meseci
Imas:
Code:
<td width=\"257\"><span class="style4">$addr</span></td>

Probaj:
Code:
<td width=\"257\"><span class=\"style4\">$addr</span></td>

Isto i za ostale linije...

@Nemanja, da :) Ni ja nisam skontao za sta ce mu eval..
@Sandin, sintaksne greske su ti najlakse za resavanje.. Samo malo pogledaj malo tu liniju i koristi neki editor sa Syntax Highlightingom..
“I never think of the future - it comes soon enough.” - Albert Anštajn (Albert Einstein)
 
Odgovor na temu

Sandin

Član broj: 173998
Poruke: 48
92.241.158.*



Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:39 - pre 189 meseci
pa to mi ej doslo tako u kodu, ali eto rijesio sam to, btw bili mi mogao preporuciti kakav dobar editor Syntax Highlightingom da se nemucim vise s tim, inace radim u dreamweaveru cs3 pa mi ne pokazuje bas puno :S
No keyboard attached. Press F1 to continue!
 
Odgovor na temu

Jezdimir Lončar
Aka Blazeme
PHP/jQuery Dev, BildStudio
Crna Gora / Pljevlja

Član broj: 74833
Poruke: 674
77.222.11.*

Jabber: jezdonet@gmail.com


+4 Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:45 - pre 189 meseci
I ja kodiram u Dreamweaver CS3, i on ima Syntax Highlighting.
Za PHP, HTML, CSS.........
Elem, za nesta ozbiljnije Zend Studio definitivno.
Evo vidi razliku, kad stavis \" i samo ", kako ti "izlazi" iz echo funkcije.

“I never think of the future - it comes soon enough.” - Albert Anštajn (Albert Einstein)
Prikačeni fajlovi
 
Odgovor na temu

Sandin

Član broj: 173998
Poruke: 48
92.241.158.*



Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:47 - pre 189 meseci
aha, hvala na pojasnjenju jer nisam znao da je to to :( hehe ako budem kakvi jos problema imao uvezano za ovo javim se, hvala puno
No keyboard attached. Press F1 to continue!
 
Odgovor na temu

Jezdimir Lončar
Aka Blazeme
PHP/jQuery Dev, BildStudio
Crna Gora / Pljevlja

Član broj: 74833
Poruke: 674
77.222.11.*

Jabber: jezdonet@gmail.com


+4 Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:49 - pre 189 meseci
Np.
Jos da dodam da mozes da koristis echo ' (sa jednim ' a ne sa dva - "), pa ti tako nece "izlaziti" iz echo funkcije.
Pogledaj FAQ da vidis razliku izmedju " i '.
“I never think of the future - it comes soon enough.” - Albert Anštajn (Albert Einstein)
 
Odgovor na temu

Sandin

Član broj: 173998
Poruke: 48
92.241.158.*



Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:51 - pre 189 meseci
Citat:
Sandin: aha, hvala na pojasnjenju jer nisam znao da je to to :( hehe ako budem kakvi jos problema imao uvezano za ovo javim se, hvala puno


evo nisam samo to odradio i to prode pa mi javlja ovo :S koja komplikaicja :S

Warning: include(themes//theme.php) [function.include]: failed to open stream: No such file or directory in /home/a9044121/public_html/sivo/header.php on line 10

Warning: include() [function.include]: Failed opening 'themes//theme.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a9044121/public_html/sivo/header.php on line 10


Fatal error: Call to undefined function myheader() in /home/a9044121/public_html/sivo/header.php on line 22

evo kode od themp.php

Code:

<?php
function OpenTable() {
    echo "<table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"#FFFFFF\" align=\"center\"><tr><td>\n";
    echo "<table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"#FFFFFF\" align=\"center\"><tr><td>\n";
}

function CloseTable() {
    echo "</td></tr></table></td></tr></table>\n";
}

function myheader(){
    global $loginorout,$banner,$google;
 $tmpfile = "themes/paglax/header.html";
 if(empty($google)){
     $banner=$banner;
 }else{
     $banner=$google;
 }
 if(!file_exists($tmpfile)){
     die("File '$tmpfile' Not Found.");
 }
 $file = implode("", file($tmpfile));
 $file = addslashes($file);
 $file = "\$output=\"".$file."\";";
 eval($file);
 echo"$output";


}


function myfooter(){

 $tmpfile = "themes/paglax/footer.html";
 if(!file_exists($tmpfile)){
 die("File '$tmpfile' Not Found.");
 }
 $file = implode("", file($tmpfile));
 $file = addslashes($file);
 $file = "\$output=\"".$file."\";";
 eval($file);
 echo"$output";

}

function mysearch(){

 $tmpfile = "themes/paglax/search.html";
 if(!file_exists($tmpfile)){
 die("File '$tmpfile' Not Found.");
 }
 $file = implode("", file($tmpfile));
 $file = addslashes($file);
 $file = "\$output=\"".$file."\";";
 eval($file);
 echo"$output";

}

?>


uaa izvilenicu hehe


No keyboard attached. Press F1 to continue!
 
Odgovor na temu

dakipro
Dalibor Jovic
Web Developer
Bergen, Norway

Moderator
Član broj: 31848
Poruke: 1792
*.adsl.beotel.net.

Sajt: norway.dakipro.com


+190 Profil

icon Re: syntax error, kako rijesiti27.09.2008. u 17:52 - pre 189 meseci
Preporuka za Zend, ali o tome vec imas top temu tako da nije ovde tome mesto
 
Odgovor na temu

Jezdimir Lončar
Aka Blazeme
PHP/jQuery Dev, BildStudio
Crna Gora / Pljevlja

Član broj: 74833
Poruke: 674
*.crnagora.net.

Jabber: jezdonet@gmail.com


+4 Profil

icon Re: syntax error, kako rijesiti28.09.2008. u 18:16 - pre 189 meseci
Citat:

Warning: include(themes//theme.php) [function.include]: failed to open stream: No such file or directory in /home/a9044121/public_html/sivo/header.php on line 10

Probaj da stavis:
Code:

<?php
require("themes/theme.php");
?>

Ova poruka gore ti znaci da si pogrijesio putanju.
“I never think of the future - it comes soon enough.” - Albert Anštajn (Albert Einstein)
 
Odgovor na temu

Sandin

Član broj: 173998
Poruke: 48
92.241.158.*



Profil

icon Re: syntax error, kako rijesiti28.09.2008. u 22:15 - pre 189 meseci
hvala puno si mi pomogo.. sad ne znam koliko je pametno pisati u istu temu ali imam sad problem koji sam ne znam rijesiti :S

da prvo pojasnim o cemu se radi, pravim web-biznis direktoriji i sad donekle sam ja to nes i zavrsio naso par skripti pa to kombiniram sad i ispo mi je problem u tomu kad nemogu da stavim ispod direktorija tj njegovog naziva u naslovnoj opis, koji sam naravno unjeo kad sam dodavo kategoriju to sad trenutno izgleda ovako...

Test(2) Gllupost(1) Proba(4)
... ... ...

borojevi u zagradama oznacavaju koliko se nalazi u tim kategorijama unosa i ispod su podkadtegorije te tri tackice (...) ali ja necu da pisu pod kategorije vec da pise opis kategorija.. uglavnom evo kod od mog viewdir.php pa ako moze neko da pogleda i da mi objasni sta treba da samo zamjenim znam da trebam samo zamijeniti nesto ali ne mogu ga naci :S

Code:

 <?


if (!eregi("index.php", $_SERVER['PHP_SELF'])) {
    die ("You can't access this file directly...");
}


$index = 1;

include("header.php");
global $prefix, $link,$banner;

$cid=getvarint("cid");
//$findtot=mysql_query("select * from yp_list where cid=$cid", $link);
//$totallist=mysql_num_rows($findtot);
// This cause some problem
$sql=mysql_query("SELECT count(yp_list.listid)  AS total, count(yp_cat.cid) as totalcat  FROM yp_list LEFT JOIN yp_cat ON yp_list.cid = yp_cat.cid WHERE yp_list.cid =yp_cat.cid AND yp_cat.parentid='$cid' or yp_cat.cid ='$cid' AND active='1'",$link) or die("Error".mysql_error());
list($totallist,$totalcat)=mysql_fetch_row($sql);

$result = mysql_query("select title,parentid from yp_cat where cid=$cid", $link);
list($title,$parentid)=mysql_fetch_row($result);
$title=getparentlink($parentid,$title);
//openTable();
//echo"<tr><td align=center>$banner</td></tr>";
//closeTable();
//echo"<br>";

//update hits
@mysql_query("UPDATE  ".$prefix."_cat SET hits=hits+1 WHERE cid=$cid",$link);


echo"<div align=\"center\">
  <center>
  <table cellpadding=\"5\" border=\"0\" width=\"750\">
    <tr align=\"center\">
      <td valign=\"middle\" align=\"left\">
      <p align=\"left\"><b>::&nbsp;<a href=index.php>Početna</a>&nbsp;&nbsp;<strong><big>»</big></strong>&nbsp;$title($totallist)</b></td>
    </tr>
    <tr align=\"center\">
      <td align=\"center\">";
//working on it
  $resulta=@mysql_query("select listname FROM ".$prefix."_list  JOIN ".$prefix."_cat ON  ".$prefix."_list.cid= ".$prefix."_cat.cid  WHERE    ".$prefix."_cat.cid='$cid' AND active='1'",$link);
  while($al=@mysql_fetch_array($resulta)){
    $alphalist[]=strtolower(substr("$al[listname]",0,1));

  }
  echo"<table align=center>";
  echo"<tr><td><a href=\"index.php?file=viewdir&amp;cid=$cid\"><b>Sve</b></a>&nbsp;&nbsp;";
  foreach($alpha as $value){
      if(is_array($alphalist) && in_array(strtolower($value),$alphalist)){
        echo"<a href=\"index.php?file=viewdir&amp;cid=$cid&amp;startwith=$value\"><b>$value</b></a>&nbsp;&nbsp;";
      }else{
        echo"$value&nbsp;&nbsp;";
      }
  }


  echo"</td></tr>";
  echo"</table>";
  closeTable();

echo"<hr noshade=\"noshade\" color=\"#ff9933\" size=\"1\"></td>
</tr>
</table>
</center>
</div>";


$result2 = mysql_query("SELECT yp_cat.cid,title, count(listid) as totallist  FROM yp_cat LEFT  JOIN yp_list ON yp_list.cid = yp_cat.cid WHERE parentid = $cid AND active='1' GROUP  BY yp_cat.cid", $link) or die("Error".mysql_error());
$count = 1;
$csub=mysql_num_rows($result2);

echo"<div align=\"center\">";
echo"<table border=\"0\" width=80%>";
echo"<tr>";
while($row=@mysql_fetch_array($result2)){
echo"<td width=\"5%\">&nbsp;</td><td><a href=\"index.php?file=viewdir&amp;cid=$row[cid]\">$row[title]</a>($row[totallist])</td><td width=\"5%\">&nbsp;</td>";
if($count==3){
    echo"</tr></tr>";
    $count=0;
 }
$count++;
}
echo"</tr>";
echo"</table>";
echo"</div>";
closeTable();

if(isset($_GET["startwith"])){
    $startwith=addslashes($_GET["startwith"]);
}else{
    $startwith="";
}
if(!empty($_GET["startwith"])){
    $con= "substring(listname FROM 1 FOR 1)  LIKE '%$startwith%'  AND";
}else{
    $con="";
}

$query="select listid,cid,listname,description FROM ".$prefix."_list where $con  cid=$cid AND active='1'";

$resultc=mysql_query("$query", $link) or die("Error".mysql_error());
$num_record = mysql_num_rows($resultc);


if($num_record<1){
    openTable();
    echo"<center>"._YPNORECORDFOUND."</center>";
    closeTable();
    include("footer.php");
    exit;
}

if(isset($_GET['page']))
$page=intval($_GET['page']);
else $page=1;

$currentpage=$page;

$perpage =10;
$start=($page-1) * $perpage;
$pages=ceil($num_record/$perpage);

$starting_no = $start + 1;

if ($num_record - $start<$perpage) {
   $end_count = $num_record;
} elseif ($num_record - $start >= $perpage) {
   $end_count = $start + $perpage;
}

if($pages>1)
$page_link = makepagelink("index.php?file=viewdir&cid=$cid&startwith=$startwith", $page, $pages);
else
$page_link = "";


$result=@mysql_query("select listid,cid,phone,listname,description,city,country,website from yp_list where  $con  cid=$cid limit $start,$perpage", $link);

if($num_record>0){
echo"<div align=\"center\">";
echo"<table cellSpacing=0 cellPadding=0 width=75% border=0>
  <tr>
    <td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
  </tr>
  <tr>
    <td vAlign=top align=left>
    <p align=left>Prikazano » :
   $starting_no-$end_count od $num_record unosa » Stranica $currentpage</td>
    <td width=20>&nbsp;</td>
    <td vAlign=top align=right>
    <p align=right>";
    echo"$page_link";
   echo"</td>
  </tr>
  <tr>
    <td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
  </tr>
</table>";
echo"</div>";

echo "<div align=center>
  <center>
  <table cellPadding=5 width=75% border=0>
    <tr>
      <td vAlign=top align=right width=7% bgColor=#ffd966>
      <strong>Broj.</strong></td>
      <td vAlign=top align=left width=45% bgColor=#ffd966>
      <strong>Organizacija&nbsp;&nbsp; </strong></td>
      <td vAlign=top align=left width=25% bgColor=#ffd966 >
      <strong>Grad</strong></td>
      <td vAlign=top align=left width=15% bgColor=#ffd966>
      <strong>Država</strong></td>
      <td vAlign=top align=middle width=8% bgColor=#ffd966 >
      <strong>Web stranica</strong></td>
    </tr>
  </table>
  </center>
</div>";
$num=$starting_no-1;
while(list($listid,$cid,$phone,$listname,$description,$city,$country,$website)=mysql_fetch_row($result)) {
$title = stripslashes($title);
$description = stripslashes($description);
$num++;
if($website="<a href=\"$website\" target=\"_blank\"><img alt=\"Posjetite $listname web stranicu\" src=\"images/homepage.gif\" border=\"0\" width=19 height=19></a>";

}
}
if(strlen($phone)<3){
$phone="";
}else{
$phone="($phone)";
}


$country=country($country);

echo"<div align=center>
  <center>
  <table cellPadding=5 width=75% border=0>
    <tr>
      <td vAlign=top align=right width=7% bgColor=#ffe699>
      $num</td>
      <td vAlign=top align=left width=45% bgColor=#ffe699>

      <a href=\"index.php?file=details&amp;listid=$listid&amp;cid=$cid\">
      $listname</a> <br>$phone</td>
      <td vAlign=top align=left width=25% bgColor=#ffe699>
      $city</td>
      <td vAlign=top align=left width=15% bgColor=#ffe699>
      $country</td>
      <td vAlign=top align=middle width=8% bgColor=#ffe699>$website</td>
    </tr>
  </table>
  </center>
</div>";




echo"<br>";
if($num_record>0){
echo"<div align=\"center\">";
echo"<table cellSpacing=0 cellPadding=0 width=75% border=0>
  <tr>
    <td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
  </tr>
  <tr>
    <td vAlign=top align=left>
    <p align=left>Prikazano » :
   $starting_no-$end_count od $num_record unosa » Strana $currentpage</td>
    <td width=20>&nbsp;</td>
    <td vAlign=top align=right>
    <p align=right>";
    echo"<a href=#top>Vrh</a>&nbsp;$page_link";
   echo"</td>
  </tr>
  <tr>
    <td colSpan=3><hr color=#ff9933 noShade SIZE=1></td>
  </tr>
    </table>";
    echo"</div>";
}

include("footer.php");

?>

No keyboard attached. Press F1 to continue!
 
Odgovor na temu

[es] :: PHP :: syntax error, kako rijesiti

[ Pregleda: 2593 | Odgovora: 12 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.