Giuly
17-09-2003, 00:38
hi,
die errormsg ist "Parse error: parse error in /var/www/web1/html/index.php on line 105"
hier der source:
<?
/*
* Signature News - A PHP-Script wich prints the latest news on a PNG-Image
* Copyright (C) 2003 Giuliano Montecarlo
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
$mysql_host = "localhost";
$mysql_user = "";
$mysql_pass = "";
$mysql_db = "";
function connectDB($server, $user, $passwort, $database)
{
global $db;
$db = @MYSQL_CONNECT($server,$user,$passwort) or die ("Fehler! Bitte kontaktiere einen der Webmaster.\r\n");
$db_check = @MYSQL_SELECT_DB($database);
if($db)
{
return TRUE;
}
}
function drawPNG($newshead)
{
$location = array(0=>13, 1=>26, 2=>39, 3=>52);
header("Content-type: image/png");
$pointer = imagecreate(200, 100);
$backgound = ImageColorAllocate($pointer, 255, 255, 255);
$textcolor = ImageColorAllocate($pointer, 0, 0, 0);
ImageString($pointer, 2, 5, 1, "Neuste News:", $textcolor);
if(strlen($newstext) > 60) {
ImageString($pointer, 2, 5, $location[0], substr($newshead, 0, 20), $textcolor);
ImageString($pointer, 2, 5, $location[1], substr($newshead, 20, 40), $textcolor);
ImageString($pointer, 2, 5, $location[2], substr($newshead, 40, 60), $textcolor);
ImageString($pointer, 2, 5, $location[3], substr($newshead, 60, strlen($newshead)), $textcolor);
} elseif(strlen($newstext) > 40) {
ImageString($pointer, 2, 5, $location[0], substr($newshead, 0, 20), $textcolor);
ImageString($pointer, 2, 5, $location[1], substr($newshead, 20, 40), $textcolor);
ImageString($pointer, 2, 5, $location[2], substr($newshead, 40, strlen($newshead)), $textcolor);
} elseif(strlen($newstext) > 20) {
ImageString($pointer, 2, 5, $location[0], substr($newshead, 0, 20), $textcolor);
ImageString($pointer, 2, 5, $location[1], substr($newshead, 20, 40), $textcolor);
} else {
ImageString($pointer, 2, 5, $location[0], $newshead, $textcolor);
}
ImagePNG($pointer);
}
function getEntry($entry)
{
global $db;
$queryString = "SELECT ". $entry ."FROM SigNews";
$queryGet = mysql_query($queryString);
while($row = mysql_fetch_array ($queryGet, MYSQL_ASSOC)) {
$toret = $row[$entry];
}
return $toret;
}
function saveNews($newshead, $newstext, $autor)
{
global $db;
if(strlen($newshead) > 80 || strlen($newstext) > 500) return false;
$queryString = "UPDATE SigNews SET head='$newshead', text='$newstext',autor='$autor'";
$query = @mysql_query($queryString);
if(!$query) return false;
return true;
}
function newsToHTML()
{
$toret = "<html>\r\n";
$toret .= "<head>\r\n";
$toret .= "<title>";
$toret .= getEntry("head");
$toret .= "</title>\r\n";
$toret .= "</head>\r\n";
$toret .= "<body>\r\n";
$toret .= "<h3>". getEntry("head") ."</h3>\r\n";
$toret .= "<br>\r\n";
$toret .= "By: ". getEntry("autor") ."\r\n";
$toret .= "<br>\r\n"
$toret .= getEntry("autor"); // Line 105
$toret .= "</body>"
$toret = "</html>";
return $toret;
}
function entryForm()
{
$toret = "<html>\r\n";
$toret .= "<head>\r\n";
$toret .= "<title>News eintragen</title>\r\n";
$toret .= "</head>\r\n";
$toret .= "<body>\r\n";
$toret .= "<form action=\"". $PHP_SELF ."\">\r\n";
$toret .= "Autor: <input name=\"autor\" size=\"100\">\r\n";
$toret .= "Head: <input name=\"head\" size=\"100\">\r\n";
$toret .= "Text: <textarea name=\"text\" cols=\"100\" rows=\"5\">\r\n";
$toret .= "</form>\r\n";
$toret .= "</body>\r\n";
$toret .= "</html>\r\n";
return $toret;
}
connectDB($mysql_host, $mysql_user, $mysql_pass, $mysql_db);
switch($_GET["action"])
{
case "postnews": echo(entryForm()); break;
case "seenews": echo(newsToHTML()); break;
case "png": drawPNG(getEntry("head")); break;
}
?>
also ich finde den fehler nicht o.O!
die errormsg ist "Parse error: parse error in /var/www/web1/html/index.php on line 105"
hier der source:
<?
/*
* Signature News - A PHP-Script wich prints the latest news on a PNG-Image
* Copyright (C) 2003 Giuliano Montecarlo
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
$mysql_host = "localhost";
$mysql_user = "";
$mysql_pass = "";
$mysql_db = "";
function connectDB($server, $user, $passwort, $database)
{
global $db;
$db = @MYSQL_CONNECT($server,$user,$passwort) or die ("Fehler! Bitte kontaktiere einen der Webmaster.\r\n");
$db_check = @MYSQL_SELECT_DB($database);
if($db)
{
return TRUE;
}
}
function drawPNG($newshead)
{
$location = array(0=>13, 1=>26, 2=>39, 3=>52);
header("Content-type: image/png");
$pointer = imagecreate(200, 100);
$backgound = ImageColorAllocate($pointer, 255, 255, 255);
$textcolor = ImageColorAllocate($pointer, 0, 0, 0);
ImageString($pointer, 2, 5, 1, "Neuste News:", $textcolor);
if(strlen($newstext) > 60) {
ImageString($pointer, 2, 5, $location[0], substr($newshead, 0, 20), $textcolor);
ImageString($pointer, 2, 5, $location[1], substr($newshead, 20, 40), $textcolor);
ImageString($pointer, 2, 5, $location[2], substr($newshead, 40, 60), $textcolor);
ImageString($pointer, 2, 5, $location[3], substr($newshead, 60, strlen($newshead)), $textcolor);
} elseif(strlen($newstext) > 40) {
ImageString($pointer, 2, 5, $location[0], substr($newshead, 0, 20), $textcolor);
ImageString($pointer, 2, 5, $location[1], substr($newshead, 20, 40), $textcolor);
ImageString($pointer, 2, 5, $location[2], substr($newshead, 40, strlen($newshead)), $textcolor);
} elseif(strlen($newstext) > 20) {
ImageString($pointer, 2, 5, $location[0], substr($newshead, 0, 20), $textcolor);
ImageString($pointer, 2, 5, $location[1], substr($newshead, 20, 40), $textcolor);
} else {
ImageString($pointer, 2, 5, $location[0], $newshead, $textcolor);
}
ImagePNG($pointer);
}
function getEntry($entry)
{
global $db;
$queryString = "SELECT ". $entry ."FROM SigNews";
$queryGet = mysql_query($queryString);
while($row = mysql_fetch_array ($queryGet, MYSQL_ASSOC)) {
$toret = $row[$entry];
}
return $toret;
}
function saveNews($newshead, $newstext, $autor)
{
global $db;
if(strlen($newshead) > 80 || strlen($newstext) > 500) return false;
$queryString = "UPDATE SigNews SET head='$newshead', text='$newstext',autor='$autor'";
$query = @mysql_query($queryString);
if(!$query) return false;
return true;
}
function newsToHTML()
{
$toret = "<html>\r\n";
$toret .= "<head>\r\n";
$toret .= "<title>";
$toret .= getEntry("head");
$toret .= "</title>\r\n";
$toret .= "</head>\r\n";
$toret .= "<body>\r\n";
$toret .= "<h3>". getEntry("head") ."</h3>\r\n";
$toret .= "<br>\r\n";
$toret .= "By: ". getEntry("autor") ."\r\n";
$toret .= "<br>\r\n"
$toret .= getEntry("autor"); // Line 105
$toret .= "</body>"
$toret = "</html>";
return $toret;
}
function entryForm()
{
$toret = "<html>\r\n";
$toret .= "<head>\r\n";
$toret .= "<title>News eintragen</title>\r\n";
$toret .= "</head>\r\n";
$toret .= "<body>\r\n";
$toret .= "<form action=\"". $PHP_SELF ."\">\r\n";
$toret .= "Autor: <input name=\"autor\" size=\"100\">\r\n";
$toret .= "Head: <input name=\"head\" size=\"100\">\r\n";
$toret .= "Text: <textarea name=\"text\" cols=\"100\" rows=\"5\">\r\n";
$toret .= "</form>\r\n";
$toret .= "</body>\r\n";
$toret .= "</html>\r\n";
return $toret;
}
connectDB($mysql_host, $mysql_user, $mysql_pass, $mysql_db);
switch($_GET["action"])
{
case "postnews": echo(entryForm()); break;
case "seenews": echo(newsToHTML()); break;
case "png": drawPNG(getEntry("head")); break;
}
?>
also ich finde den fehler nicht o.O!