B
BlackLove2005
Guten Abend,
leider komme ich bei einem Script nicht weiter und nun hoffe ich, dass Ihr mir dabei helfen könnt. Folgendes habe ich:
gb.php
gbn.php
gbw.php
So wenn ich dann das ganze Online stelle dann kommt folgendes:
Hmm kann mir jemand sagen was ich da falch mache?
Gruß BlackLove2005
leider komme ich bei einem Script nicht weiter und nun hoffe ich, dass Ihr mir dabei helfen könnt. Folgendes habe ich:
gb.php
PHP:
<?
include 'data/config.php';
$s = empty($_GET['s']) ? 0 : $_GET['s'];
$start = 10 * $s;
list($anzahl) = $db->fetch_row($db->query('select count(*) from 006_gb'));
$j = $anzahl - $start;
headline('Gästebuch');
echo 'Einträge '.(($anzahl - $start > 10)?($anzahl - $start -9):'1').' bis '.($anzahl - $start).' von '.$anzahl.'<br>Seite: '.(($s > 0)?'<a href="'.$PHP_SELF.'?home=g&s='.($s-1).'">«</a> ' : '« ');
for ($seite = 0; $seite < $anzahl / 10; $seite++)
if($seite == $s)
echo '<b>'.($seite + 1).'</b> ';
else
echo '<a href="?home=g&s='.($seite).'">'.($seite + 1).'</a> ';
echo (($anzahl - $start > 10)?' <a href="'.$PHP_SELF.'?home=g&s='.($s+1).'">»</a>' : '»').'<br><br><a href="gbn.php">Ins Gästebuch eintragen</a><br><br>';
$res = $db->query('Select name, time, mail, icq, url, comment, icon from 006_gb order by time desc limit '.$start.',10');
while(list($name,$time,$mail,$icq,$url,$comment,$icon) = $db->fetch_row($res)) {
if(substr(strtolower($url),0,7) != 'http://' && $url != "")
$url = 'http://'.$url;
bbcode($comment);
echo '<table style="width:100%;margin-bottom:33px;"><tr><td style="width:20px">'.($j--).'.: </td><td><b style="font-size:12pt">'.$name.'</b> schreibt am '.date('d. m. Y, \u\m H:i',$time).' Uhr:</td></tr><tr><td><img src="./img/smiley/'.$icon.'.gif" alt=""></td><td style="font-family:courier new;">'.nl2br($comment).'</td></tr>'.(($mail != '' || $icq != 0 || $url != '')?'<tr><td></td><td>'.(($mail != '')?'<a href="mailto:'.$mail.'">'.$mail.'</a>':'').(($mail != "" && ($icq != 0 || $url != ''))?' | ':'').(($icq != 0)?'<img style="height:18px;width:18px;vertical-align:middle" alt="" src="icqstat.php?icqnr='.$icq.'"> ICQ#: '.$icq:'').(($icq != 0 && $url != '')?' | ':'').(($url != '')?'<a target="_blank" href="'.$url.'">'.$url.'</a>':'').'</td></tr>':'').'</table>';
}
foot();
?>
gbn.php
PHP:
<?
include 'data/config.php';
headline('Eintragen');
?>
<form method="POST" action="gbw.php">
<input type="hidden" value="0" name="icon">
<fieldset><legend><b>Bitte ausfüllen</b></legend>
<table style="width:100%"><tr><td style="width:140px">Name:*</td><td><input type="text" name="sname" style="width:250px"></td></tr>
<tr><td>E-Mail:</td><td><input type="text" name="smail" style="width:250px"></td></tr>
<tr><td>ICQ-Nr.:</td><td><input type="text" name="sicq" size="12" maxlength="10"></td></tr>
<tr><td>Website:</td><td><input type="text" name="surl" style="width:100%"></td></tr><?
include 'inc/bbcode.inc.php';
?><tr><td>Kommentar:*<br><br><a href="#" onclick="javascript:bbcode();return false" id="bbcode">BBCode einblenden</a><br><a href="#" onclick="javascript:bbicon();return false" id="bbicon">Smileys einblenden</a></td><td><textarea name="content" style="width:100%;height:200px"></textarea></td></tr>
<tr><td></td><td id="smileys"></td></tr>
<tr><td><b>*</b> Pflichtangaben</td><td><input type="submit" value="Eintragen"></td></tr></table>
</fieldset>
</form><? foot(); ?>
gbw.php
PHP:
<?
include 'data/config.php';
$name = trim($_POST['sname']);
$icq = trim($_POST['sicq']);
$mail = trim($_POST['smail']);
$url = trim($_POST['surl']);
$text = trim($_POST['content']);
if(strlen($name) < 2 || strlen($name) > 40)
$error = true;
if(empty($text))
$error = true;
if(substr($url,0,7) != "http://" && $url != "")
$url = 'http://'.$url;
if(!empty($error)) {
headline('Fehlerhafte Eingabe!');
echo '<img src="./img/smiley/'.rand(1,39).'.gif"> <b>Bitte füllen Sie alle benötigten Felder aus!</b><br><br><a href="JavaScript:history.go(-1)">zurück</a>';
foot();
exit;
}
if($db->query('insert into 006_gb (name,time,mail,icq,url,comment,icon,ip,usera) values ("'.$name.'",unix_timestamp(now()),"'.$mail.'","'.$icq.'","'.$url.'","'.$text.'","'.$icon.'","'.getenv('REMOTE_ADDR').'","'.getenv('HTTP_USER_AGENT').'")')) {
echo '<script type="text/JavaScript">location.href="gb.php";</script>';
} else {
headline('Datenbankfehler!');
echo '<b>Beim Schreiben des Datensatzes ist ein Fehler aufgetreten!</b><br><a href="JavaScript:history.go(-1)">zurück</a>';
foot();
}
?>
So wenn ich dann das ganze Online stelle dann kommt folgendes:
Fatal error: Call to a member function on a non-object in /home/www/web430/html/buch/gb.php on line 7
Hmm kann mir jemand sagen was ich da falch mache?
Gruß BlackLove2005