PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Line 105 (lol)



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:&nbsp;<input name=\"autor\" size=\"100\">\r\n";
$toret .= "Head:&nbsp;&nbsp;<input name=\"head\" size=\"100\">\r\n";
$toret .= "Text:&nbsp;&nbsp;<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!

red_head105
17-09-2003, 06:41
Hey

:D vielleicht schaust du eine Zeile weiter oben, da fehlt ein ";"

Gruß red_head105

Giuly
17-09-2003, 12:02
LOL Ich blinder Affe ;)

aber es kommt trotzdem:

Warning: Supplied argument is not a valid MySQL result resource in /var/www/web1/html/index.php on line 74

Warning: Supplied argument is not a valid MySQL result resource in /var/www/web1/html/index.php on line 74

Warning: Supplied argument is not a valid MySQL result resource in /var/www/web1/html/index.php on line 74

Warning: Supplied argument is not a valid MySQL result resource in /var/www/web1/html/index.php on line 74

red_head105
17-09-2003, 12:20
hmmmm....

änder mal die Zeile $queryString
zu
$queryString = "SELECT ". $entry ." FROM SigNews";

Bei dir steht da z.B.
$queryString =
SELECT autorFROM SigNews
drin

Gruß red_head105

Giuly
17-09-2003, 13:29
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];
}
mysql_free_result($queryGet);
return $toret;
}

trotzdem gleicher fehler o.O!

Gaert
17-09-2003, 13:39
Hallo!

Setz mal nach dem "$queryGet = mysql_query($queryString);" ein "echo mysql_error()" - dann wirst du schon sehen was der Fehler ist.

Gruß,

Gaert

Giuly
17-09-2003, 15:55
fehler gefunden :)
VARCHAR(500) konnte nicht erstellt werden. Ich hab das jetzt in TEXT geändert, jetzt gehts.


Wie macht man den Hintergrund vom Bild transparent?

Gaert
17-09-2003, 17:03
Original geschrieben von Giuly

Wie macht man den Hintergrund vom Bild transparent?

Transparentes GIF?!

Giuly
17-09-2003, 21:21
jo