_Melchiors suffer page! /ver 0.1.4/





debug info: ".$message."
"; //} } _mesg("there start script"); _mesg("excuse for debug messages, it's for me, yeah /chagirov loh azaza/"); _mesg("connect to MySQL db"); $host = ""; $user = ""; $pass = ""; $database = ''; $table = ''; $link = mysql_connect($host, $user, $pass) or die(_mesg(mysql_error())); mysql_select_db($database) or die(_mesg(mysql_error())); _mesg("all right"); _mesg("start processing POST-method data"); $text = strip_tags($_POST['txtName']); if (strlen($text) > 0 && $text != "there") { _mesg($text); // Обрабатываем и пишем в ДБ $repeat = 0; $q = mysql_query("SELECT * FROM ".$table); $l = mysql_num_rows($q); for ($i=$l; $i > 0; $i = $i - 1) { $f = mysql_fetch_array($q); if ($text == $f[TEXT]) { $repeat = 1; } } if ($repeat == 0) { $l += 1; mysql_query('INSERT INTO '.$table.' (ID, TEXT) VALUES ("'.$l.'","'.$text.'")') or die(_mesg(mysql_error())); } else { _mesg("error : repeated message"); } } else { _mesg("error : empty message or example message"); // Выводим все ошибачки } _mesg("outputing messages"); $q = mysql_query("SELECT * FROM ".$table); $l = mysql_num_rows($q); for ($i=$l; $i > 0; $i = $i - 1) { $f = mysql_fetch_array($q); $out = "
Guest №"; $out1 = $f[ID]."
".strip_tags($f[TEXT])."


"; echo $out.$out1; } _mesg("close connection with DB"); mysql_close(); ?>