Jump to content

Parse error...


shockyz

Recommended Posts

Please help! :/ I got this generator file (http://www.sto-posto-zabava.com/generate_pages.php) which has some problem in code.

It shows an error: Parse error: syntax error, unexpected T_LNUMBER in /home/spzabava/public_html/generate_pages.php on line 32

 

<?php
require "cs_config.php";

require DIR_VICEVI."includes/class.db.php";
require DIR_VICEVI."includes/functions.php";

$search = array("\"");
$replace = array("''");

$db = new db;
$db->connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);

$sql=$db->query("
SELECT content 
FROM ".TABLE_CONTENT_VICEVI." 
WHERE active=1 AND active_date<=NOW() AND mark=NOW() 
LIMIT 1"
);

if ($db->num_rows($sql)==0) {
$sql=$db->query("
SELECT content 
FROM ".TABLE_CONTENT_VICEVI." 
WHERE active=1 AND mark<=NOW() 
ORDER BY mark DESC 
LIMIT 1"
);
}

$sqldata=$db->fetch_array($sql);

$vic_dana='document.write("'.nl2brStrict(utf2html(str_replace($search, $replace, $sqldata['content']))).'<br>[<a target=_blank title='100% Zabava - Vicevi - Zanimljivosti - Vesti - Video Klipovi - Tekstovi - Forum - Chat - Ankete' href=http://www.sto-posto-zabava.com>100% Zabava</a>]");';

$fp = fopen("vic.js", "wb");
fwrite($fp, $vic_dana);
fclose($fp);

$sql=$db->query("
SELECT content 
FROM ".TABLE_CONTENT_ZANIMLJIVOSTI." 
WHERE active=1 AND active_date<=NOW() 
ORDER BY date_time DESC 
LIMIT 1"
);

$sqldata=$db->fetch_array($sql);

$zanimljivost='document.write("'.nl2brStrict(utf2html(str_replace($search, $replace, $sqldata['content']))).'<br>[<a target=_blank title='100% Zabava - Vicevi - Zanimljivosti - Vesti - Video Klipovi - Tekstovi - Forum - Chat - Ankete' href=http://www.sto-posto-zabava.com>100% Zabava</a>]");';

$fp = fopen("zanimljivost.js", "wb");
fwrite($fp, $zanimljivost);
fclose($fp);

$sql=$db->query("
SELECT id, title, name, content, date_time 
FROM ".TABLE_CONTENT_VESTI." 
WHERE active=1 
ORDER BY date_time DESC 
LIMIT 1"
);

$sqldata=$db->fetch_array($sql);

$sqldata['content'] = utf2html(str_replace($search, $replace, $sqldata['content']));
$pos = strpos($sqldata['content'], "\r\n\r\n");
if ($pos!==false) $sqldata['content']=substr($sqldata['content'], 0, $pos).' <a href=http://zanimljive-vesti.sto-posto-zabava.com/comments.php?cid=1&cnt='.$sqldata['id'].' title='Nastavak zanimljive vesti' target=_blank>dalje>>></a>';

$datum=full_date($sqldata['date_time']);
$title=$sqldata['title'];
$izvor='Izvor: '.$sqldata['name'];

$vest='document.write("'.nl2brStrict(utf2html(str_replace($search, $replace, $datum.'.<br>'.$izvor.'<br><b>'.$title.'</b><br><br>')).$sqldata['content']).'");';

$fp = fopen("vest.js", "wb");
fwrite($fp, $vest);
fclose($fp);

function nl2brStrict($text, $replacement = '<br>')
{
   return preg_replace("((\r\n)+)", trim($replacement), $text);
}
?>

 

Can someone please take a look and help me with this, I'd appreciate it...

Link to comment
https://forums.phpfreaks.com/topic/180674-parse-error/
Share on other sites

http://www.php.net/manual/en/language.types.string.php

 

To specify a literal single quote, escape it with a backslash (\). To specify a literal backslash before a single quote, or at the end of the string, double it (\\). Note that attempting to escape any other character will print the backslash too.

Link to comment
https://forums.phpfreaks.com/topic/180674-parse-error/#findComment-953217
Share on other sites

Your string is delimited with ' (single quotes)

If you want to use single quotes within this string, you have to add \ before them, like this:

$vic_dana='document.write("'.nl2brStrict(utf2html(str_replace($search, $replace, $sqldata['content']))).'<br>[<a target=_blank title=\'100% Zabava - Vicevi - Zanimljivosti - Vesti - Video Klipovi - Tekstovi - Forum - Chat - Ankete\' href=http://www.sto-posto-zabava.com>100% Zabava</a>]");';

Link to comment
https://forums.phpfreaks.com/topic/180674-parse-error/#findComment-953240
Share on other sites

Thanx for ur answers! ;)

Now that I placed \ in front of ' I got these error messages:

Warning: fopen(vic.js): failed to open stream: Permission denied in /home/spzabava/public_html/generate_pages.php on line 34

 

Warning: fwrite(): supplied argument is not a valid stream resource in /home/spzabava/public_html/generate_pages.php on line 35

 

Warning: fclose(): supplied argument is not a valid stream resource in /home/spzabava/public_html/generate_pages.php on line 36

 

Warning: fopen(zanimljivost.js): failed to open stream: Permission denied in /home/spzabava/public_html/generate_pages.php on line 50

 

Warning: fwrite(): supplied argument is not a valid stream resource in /home/spzabava/public_html/generate_pages.php on line 51

 

Warning: fclose(): supplied argument is not a valid stream resource in /home/spzabava/public_html/generate_pages.php on line 52

 

Warning: fopen(vest.js): failed to open stream: Permission denied in /home/spzabava/public_html/generate_pages.php on line 74

 

Warning: fwrite(): supplied argument is not a valid stream resource in /home/spzabava/public_html/generate_pages.php on line 75

 

Warning: fclose(): supplied argument is not a valid stream resource in /home/spzabava/public_html/generate_pages.php on line 76

 

Code is now:

<?php
require "cs_config.php";

require DIR_VICEVI."includes/class.db.php";
require DIR_VICEVI."includes/functions.php";

$search = array("\"");
$replace = array("''");

$db = new db;
$db->connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);

$sql=$db->query("
SELECT content 
FROM ".TABLE_CONTENT_VICEVI." 
WHERE active=1 AND active_date<=NOW() AND mark=NOW() 
LIMIT 1"
);

if ($db->num_rows($sql)==0) {
$sql=$db->query("
SELECT content 
FROM ".TABLE_CONTENT_VICEVI." 
WHERE active=1 AND mark<=NOW() 
ORDER BY mark DESC 
LIMIT 1"
);
}

$sqldata=$db->fetch_array($sql);

$vic_dana='document.write("'.nl2brStrict(utf2html(str_replace($search, $replace, $sqldata['content']))).'<br>[<a target=_blank title=\'100% Zabava - Vicevi - Zanimljivosti - Vesti - Video Klipovi - Tekstovi - Forum - Chat - Ankete\' href=http://www.sto-posto-zabava.com>100% Zabava</a>]");';

$fp = fopen("vic.js", "wb");
fwrite($fp, $vic_dana);
fclose($fp);

$sql=$db->query("
SELECT content 
FROM ".TABLE_CONTENT_ZANIMLJIVOSTI." 
WHERE active=1 AND active_date<=NOW() 
ORDER BY date_time DESC 
LIMIT 1"
);

$sqldata=$db->fetch_array($sql);

$zanimljivost='document.write("'.nl2brStrict(utf2html(str_replace($search, $replace, $sqldata['content']))).'<br>[<a target=_blank title=\'100% Zabava - Vicevi - Zanimljivosti - Vesti - Video Klipovi - Tekstovi - Forum - Chat - Ankete\' href=http://www.sto-posto-zabava.com>100% Zabava</a>]");';

$fp = fopen("zanimljivost.js", "wb");
fwrite($fp, $zanimljivost);
fclose($fp);

$sql=$db->query("
SELECT id, title, name, content, date_time 
FROM ".TABLE_CONTENT_VESTI." 
WHERE active=1 
ORDER BY date_time DESC 
LIMIT 1"
);

$sqldata=$db->fetch_array($sql);

$sqldata['content'] = utf2html(str_replace($search, $replace, $sqldata['content']));
$pos = strpos($sqldata['content'], "\r\n\r\n");
if ($pos!==false) $sqldata['content']=substr($sqldata['content'], 0, $pos).' <a href=http://zanimljive-vesti.sto-posto-zabava.com/comments.php?cid=1&cnt='.$sqldata['id'].' title=\'Nastavak zanimljive vesti\' target=_blank>dalje>>></a>';

$datum=full_date($sqldata['date_time']);
$title=$sqldata['title'];
$izvor='Izvor: '.$sqldata['name'];

$vest='document.write("'.nl2brStrict(utf2html(str_replace($search, $replace, $datum.'.<br>'.$izvor.'<br><b>'.$title.'</b><br><br>')).$sqldata['content']).'");';

$fp = fopen("vest.js", "wb");
fwrite($fp, $vest);
fclose($fp);

function nl2brStrict($text, $replacement = '<br>')
{
   return preg_replace("((\r\n)+)", trim($replacement), $text);
}
?>

Link to comment
https://forums.phpfreaks.com/topic/180674-parse-error/#findComment-953250
Share on other sites

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.