script tel2: style.css und die schriftgröße...

Beitrag lesen

function make_link($string)  {   $string = ' ' . $string;   $string = preg_replace("#(^|[\n ])([\w]+?://.?[^ "\n\r\t<])#is", "\1<a href="\2">\2</a>", $string);   $string = preg_replace("#(^|[\n ])((www|ftp).[\w-]+.[\w-.~]+(?:/[^ "\t\n\r<])?)#is", "\1<a href="http://\2">\2</a>", $string);   $string = preg_replace("#(^|[\n ])([a-z0-9&-_.]+?)@([\w-]+.([\w-.]+.)[\w]+)#i", "\1<a href="mailto:\2@\3">\2@\3</a>", $string);   $string = substr($string, 1);   return $string;  }

function browse()  {   global $p, $entries_per_page, $entry_count, $previous_page, $next_page;

if ($entry_count > $entries_per_page)   {    $new_index_before = $p - 1;    $new_index_after = $p + 1;    $site_count = ceil($entry_count / $entries_per_page);    ?><p class="gb-browse"><?php    if ($new_index_before >= 0) { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $new_index_before; ?>" title="<?php echo $previous_page; ?>">&laquo;</a>&nbsp;<?php }    if ($new_index_before >= 0 && $new_index_before < $site_count) echo "";    if ($p==0) { ?><span class="caution">1</span>&nbsp;<?php } else { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=0">1</a>&nbsp;<?php }    for($x=$p-3; $x<$p+4; $x++)     {      if ($x > 0 && $x < $site_count) { if ($x==$p) { ?><span class="caution"><?php echo $x+1; ?></span>&nbsp;<?php } else { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $x; ?>"><?php echo $x+1; ?></a>&nbsp;<?php } }     }    if ($new_index_after < $site_count) { ?><a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?p=<?php echo $new_index_after; ?>" title="<?php echo $next_page; ?>">&raquo;</a><?php }    ?></p><?php   }  }

function parse_time($time_dump) {  global $months_translated;  if (isset($months_translated))   {    $months = array("January","February","March","April","May","June","July","August","September","October","November","December");    $time_dump = str_replace($months,$months_translated,$time_dump);   }  if (substr($time_dump,0,1)=="0") $time_dump = substr($time_dump, 1);  return $time_dump; }

if (isset($_POST['action'])) $action = $_POST['action']; if (isset($_GET['action'])) $action = $_GET['action'];

if (isset($_POST['login_password']))  {   if ($_POST['login_password'] == $password)    {     $_SESSION['admin'] = true;     header("location: ".basename($_SERVER["PHP_SELF"]));     die("<a href="".basename($_SERVER["PHP_SELF"])."">further...</a>");    }   else { $action="none"; $show="login failed"; }  }

if (isset($_POST['edit']))  {   if (isset($_SESSION['admin']))    {     $data = file($gbdata);     $row_count = count($data);     for ($row = 0; $row < $row_count; $row++)      {       $parts = explode("|", $data[$row]);       if ($parts[0] == $_POST['entry_uniqid'])        {         $entry_uniqid = $parts[0];         $time = $parts[1];         $ip = $parts[2];         $name = urldecode($parts[3]);         $email = base64_decode(urldecode($parts[4]));         $hp = urldecode($parts[5]);         $place = urldecode($parts[6]);         $text = urldecode($parts[7]);         $comment = urldecode($parts[8]);         break;        }      }     $action="edit";     $show="form";    }   else { $action = "none"; $show = "no authorization"; }  }

// wenn Eintrag gel&ouml;scht werden soll, fragen, ob sicher: if (isset($_POST['delete']))  {   $action="none";   $show="delete ask if sure";

}

// wenn L&ouml;schen best&auml;tigt wurde, Eintrag l&ouml;schen: if (isset($_POST['entry_uniqid_del_ok']))  {   if (isset($_SESSION['admin']))    {     $data = file($gbdata);     $row_count = count($data);     $fp = fopen($gbdata, 'w+');     flock($fp, 2);     for ($row = 0; $row < $row_count; $row++)      {       $parts = explode("|", $data[$row]);       if ($parts[0] != $_POST['entry_uniqid_del_ok']) { fwrite($fp, trim($data[$row])."\n"); }      }     flock($fp, 3);     fclose($fp);

header("location: ".basename($_SERVER["PHP_SELF"]));     die("<a href="".basename($_SERVER["PHP_SELF"])."">further...</a>");    }   else { $action = "none"; $show = "no authorization"; }  }

// wenn Formular abgeschickt wurde: if (isset($_POST['form_submited'])) {  // &uuml;bergebene Variablen ermitteln:  if (isset($_POST['time'])) $time = $_POST['time'];  if (isset($_POST['entry_uniqid'])) $entry_uniqid = $_POST['entry_uniqid'];  $name = $_POST['name'];  $text = $_POST['text'];  $place = $_POST['place'];  $email = $_POST['email'];  $hp = $_POST['hp'];  if (isset($_POST['comment'])) $comment = $_POST['comment']; else $comment="xxx";  // unn&ouml;tige Leerzeichen abschneiden:  $name = trim($name);  $email = trim($email);  $hp = trim($hp);  $place = trim($place);  $text = trim($text);  $comment = trim($comment);  if ($comment=="") $comment="xxx";  // "http://" von Homepage abschneiden:  if (substr($hp,0,7) == "http://") { $hp = substr($hp,7); }  // &Uuml;berpr&uuml;fungen der Daten:  unset($errors);

// Ckeck if IP already posted in the last 5 minutes:  $data = file($gbdata);  foreach($data as $line)   {    if (trim($line)!="")    {    $parts = explode("|", $line);    $saved_time = (int)$parts[1];    if (time() < $saved_time+300 && $_SERVER["REMOTE_ADDR"] == $parts[2] && !isset($_SESSION['admin']))     {      $errors[] = $error_already_made_entry; break;     }    }   }

if ($name == "") $errors[] = $error_no_name;  if ($text == "") $errors[] = $error_no_text;  if(isset($email) && $email != "" and !preg_match("/[1]+@.+.\D{2,5}$/", $email)) $errors[] = $error_email_wrong;  if (strlen($text) > $text_maxlength) { $error_text_too_long = str_replace("[characters]", strlen($text), $error_text_too_long); $error_text_too_long = str_replace("[max_characters]", $text_maxlength, $error_text_too_long); $errors[] = $error_text_too_long; }  if ($text != "" && strlen($text) < $text_minlength) $errors[] = $error_text_too_short;  // Schauen, ob zu lange W&ouml;rter vorhanden sind:  $text_arr = explode(" ",$name); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $name_word_maxlength) {  $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$name_word_maxlength)))."...", $error_word_too_long); $errors[] = $error_word_too_long_x; } }  $text_arr = explode(" ",$place); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $place_word_maxlength) {  $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$place_word_maxlength)))."...", $error_word_too_long); $errors[] = $error_word_too_long_x; } }  $text_arr = str_replace("\n", " ", $text);  if ($bbcode == true); { $text_arr = preg_replace("#[b](.+?)[/b]#is", "\1", $text_arr); $text_arr = preg_replace("#[i](.+?)[/i]#is", "\1", $text_arr); $text_arr = preg_replace("#[u](.+?)[/u]#is", "\1", $text_arr); $text_arr = preg_replace("#[link](.+?)[/link]#is", "\1", $text_arr); $text_arr = preg_replace("#[link=(.+?)](.+?)[/link]#is", "\2", $text_arr); }  $text_arr = explode(" ",$text_arr); for ($i=0;$i<count($text_arr);$i++) { trim($text_arr[$i]); $laenge = strlen($text_arr[$i]); if ($laenge > $text_word_maxlength) {  $error_word_too_long_x = str_replace("[word]", htmlspecialchars(stripslashes(substr($text_arr[$i],0,$text_word_maxlength)))."...", $error_word_too_long);$errors[] = $error_word_too_long_x; } }

// save entry when no errors:  if (empty($errors) && isset($_POST['entry']) && $action=="entry")   {    $time = time();    $text = urlencode($text);    $name = urlencode($name);    $email = urlencode(base64_encode($email));    $hp = urlencode($hp);    $place = urlencode($place);    $ip = $_SERVER["REMOTE_ADDR"];    $comment = urlencode($comment);    $entry = uniqid("")."|".$time."|".$ip."|".$name."|".$email."|".$hp."|".$place."|".$text."|".$comment."\n";    $data = file($gbdata);    $c = count($data);    $fp = fopen($gbdata, 'w+');    flock($fp, 2);    fwrite($fp, $entry);    for ($i = 0; $i < $c; $i++) { fwrite($fp, trim($data[$i])."\n"); }    flock($fp, 3);    fclose($fp);

// e-mail notification:    if (isset($adminemail) && $adminemail != "")    {     $emailbody = urldecode($text);     $absender = urldecode($name);     if ($email != "") $absender_email = base64_decode(urldecode($email)); else $absender_email = "no@ema.il";     $header= "From: ".$absender."<".$absender_email.">\n";    $header .= "X-Mailer: PHP/" . phpversion(). "\n";     $header .= "X-Sender-IP: $ip\n";     $header .= "Content-Type: text/plain";     @mail($adminemail, $mail_subject, $emailbody, $header);    }

header("location: ".basename($_SERVER["PHP_SELF"]));    die("<a href="".basename($_SERVER["PHP_SELF"])."">further...</a>");   }

elseif (empty($errors) && isset($_POST['entry']) && $action=="edit")   {    if (isset($_SESSION['admin']))     {      $entry_uniqid = $_POST['entry_uniqid'];      $name = urlencode($name);      $email = urlencode(base64_encode($email));      $hp = urlencode($hp);      $place = urlencode($place);      $text = urlencode($text);      $comment = urlencode($comment);      $data = file($gbdata);      $row_count = count($data);      $fp = fopen($gbdata, "w+");      flock($fp, 2);      for ($row = 0; $row < $row_count; $row++)       {        $parts = explode("|", $data[$row]);        if ($parts[0] == $entry_uniqid) { fwrite($fp, $parts[0]."|".$parts[1]."|".$parts[2]."|".$name."|".$email."|".$hp."|".$place."|".$text."|".$comment."\n"); }        else { fwrite($fp, trim($data[$row])."\n"); }       }      flock($fp, 3);      fclose($fp);      header("location: ".basename($_SERVER["PHP_SELF"]));      die("<a href="".basename($_SERVER["PHP_SELF"])."">further...</a>");     }    else $show="no authorization";   }  else $show="form"; }


  1. ^@ ↩︎