Error !! Can't find data file : $data_file.
"; exit; } else { if ($max_record_in_data_file <> "0") { $f = file($data_file); rsort($f); $j = count($f); if ($j > $max_record_in_data_file) { $rf = fopen($data_file,"w"); if (strtoupper($os)=="UNIX") { if (flock($rf,LOCK_EX)) { for ($i=0; $i<$max_record_in_data_file; $i++) { fwrite($rf,$f[$i]); } flock($rf,LOCK_UN); } } else { for ($i=0; $i<$max_record_in_data_file; $i++) { fwrite($rf,$f[$i]); } } fclose($rf); } } } switch ($do) { case "": $record = file($data_file); rsort($record); $jmlrec = count($record); ?> BAMSEs hemsida - Gästbok

gästbok

Skriv i gästboken

0) $jml_page++; $no = $page*$max_entry_per_page-$max_entry_per_page; if ($jmlrec == 0) echo "Det finns inga inlägg än."; $w = 0; //--Color for ($i=0; $i<$max_entry_per_page; $i++) { $no++; $recno = $no-1; if (isset($record[$recno])) { $row = explode("|~|",$record[$recno]); if ($w==0) { $warna = $table_content_1a; $warna2 = $table_content_1b; $w=1; } else { $warna = $table_content_2a; $warna2 = $table_content_2b; $w=0; } echo "
$row[4] $row[2]
$row[3]
$row[6] ta bort

"; } //--end if } //--end for if ($jml_page > 1) { if ($page <> 1) echo "[Top] "; else echo "[Top] "; echo "Page # "; if ($jml_page > 10) { if ($page < 5) { $start = 1; $stop = 10; } elseif ($jml_page - $page < 5) { $start = $jml_page - 9; $stop = $jml_page; } else { $start = $page-4; $stop = $page+5; } if ($start <> 1) echo "... "; for ($p=$start; $p<=$stop; $p++) { if ($p == $page) echo "$p  "; else echo "$p  "; } if ($stop <> $jml_page) echo "... "; echo "av $jml_page "; } else { for ($p=1; $p<=$jml_page; $p++) { if ($p == $page) echo "$p  "; else echo "$p  "; } } if ($page <> $jml_page) echo "[Bottom]"; else echo "[bottom]"; } else echo "
Sida #1 av 1"; ?>
PHP Guestbook
BAMSEs hemsida - Gästbok


Namn:
E-mail:
Kommentar:
Anti-spam kod: (skriv dessa fem siffror i rutan nedan)

Fel!

Du skrev in fel kod. Klicka här och försök igen."; exit; } if (strlen($vname) > 70) $vname = substr($vname,0,70); if (strlen($vemail) > 100) $vemail = substr($vemail,0,100); if ($vname=="" or $vcomment=="") { echo "

Fel!

Du glömde några fält. Klicka här och försök igen."; exit; } $test_comment = explode(" ",$vcomment); $jmltest = count($test_comment); for ($t=0; $t<$jmltest; $t++) { if (strlen(trim($test_comment[$t])) > 35) { echo "

Fel!

Pajja inte gästboken! Klicka här och försök igen."; exit; } } //--only 2000 characters allowed for comment, change this value if necessary $maxchar = 2000; if (strlen($vcomment) > $maxchar) $vcomment = substr($vcomment,0,$maxchar)."..."; $idx = date("YmdHis"); $vdatum = date("Y-m-d"); $vtid = date("H:i"); $vname = str_replace("<","",$vname); $vname = str_replace(">","",$vname); $vname = str_replace("~","-",$vname); $vname = str_replace("\"",""",$vname); $vcomment = str_replace("<","<",$vcomment); $vcomment = str_replace(">",">",$vcomment); $vcomment = str_replace("~","-",$vcomment); $vcomment = str_replace("\"",""",$vcomment); if (strtoupper($os) == "WIN") { $vcomment = str_replace("\r\n","
",$vcomment); $vcomment = str_replace("\r","",$vcomment); $vcomment = str_replace("\n","",$vcomment); } else { $vcomment = str_replace("\n","
",$vcomment); $vcomment = str_replace("\r","",$vcomment); } $ipnum = getenv("REMOTE_ADDR"); $newdata = "|~|$idx|~|$vdatum|~|$vtid|~|$vname|~|$vemail|~|$vcomment|~|$ipnum|~|\n"; $newdata = stripslashes($newdata); $bagus = true; $cekdata = file($data_file); $jmlcekdata = count($cekdata); if ($jmlcekdata > 0) { rsort($cekdata); if ($jmlcekdata > 2) { $newrow = explode("|~|",$newdata); $jmlentry = 0; for ($c=0; $c<3; $c++) { $cekrow = explode("|~|",$cekdata[$c]); if ($cekrow[4] == $newrow[4] || ($cekrow[3] == $newrow[3] && $cekrow[4] == $newrow[4])) { $jmlentry++; } } $bagus = ($jmlentry < 3) ? true : false; } } if ($bagus) { $tambah = fopen($data_file,"a"); if (strtoupper($os)=="UNIX") { if (flock($tambah,LOCK_EX)) { fwrite($tambah,$newdata); flock($tambah,LOCK_UN); } } else { fwrite($tambah,$newdata); } fclose($tambah); //--SEND MAIL if (strtoupper($notify) == "YES") { $msgtitle = "Someone signed your guestbook"; $vcomment = str_replace(""","\"",$vcomment); $vcomment = stripslashes($vcomment); $vcomment = str_replace("
","\n",$vcomment); $msgcontent = "Local time : $vtid\n\nThe addition from $vname :\n----------------------------\n\n$vcomment\n\n-----End Message-----"; @mail($admin_email,$msgtitle,$msgcontent,"From: $vemail\n"); } } echo "

Tack för ditt inlägg.

Du skickas vidare till gästboken...
"; break; case "del": $record = file($data_file); $jmlrec = count($record); for ($i=0; $i<$jmlrec; $i++) { $row = explode("|~|",$record[$i]); if ($id == $row[1]) { ?> BAMSEs hemsida - Gästbok

Bekräfta borttagning

$row[4] $row[2]
$row[3] $row[6] ta bort
"; break; } } echo "
Lösenord:

Ta bort alla inlägg från detta IP : $row[7]

"; ?>
$admin_password) { echo "

Fel lösenord!

Vänta...
"; exit; } $record = file($data_file); $jmlrec = count($record); for ($i=0; $i<$jmlrec; $i++) { $row = explode("|~|",$record[$i]); if ($byip == "") { if ($row[1] == $id) { $record[$i] = ""; break; } } else { if ($row[7] == $byip) { $record[$i] = ""; } } } $update_data = fopen($data_file,"w"); if (strtoupper($os) == "UNIX") { if (flock($update_data,LOCK_EX)) { for ($j=0; $j<$jmlrec; $j++) { if ($record[$j] <> "") { fputs($update_data,$record[$j]); } } flock($update_data,LOCK_UN); } } else { for ($j=0; $j<$jmlrec; $j++) { if ($record[$j] <> "") { fputs($update_data,$record[$j]); } } } fclose($update_data); echo "

Inlägget har raderats!

Vänta...
"; break; } //--end switch ?>