теперь разобраться бы с гостевой книгой
я немного понял как редактировать БД через phpMyAdmin ,
какие кодировки должны быть проставлены и где (их там много
)
вот пхп файлы для гостевой :
install.php
Код:
<?
require_once("config.php");
$DBconnect = mysql_connect($DBhost, $DBuser, $DBpass);
mysql_select_db($DBname, $DBconnect);
$sql="CREATE TABLE guestbook" . "(
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
email varchar(255),
message text NOT NULL,
date varchar(255) NOT NULL,
ip varchar(255) NOT NULL,
PRIMARY KEY (id))";
@mysql_query($sql, $DBconnect) or die(mysql_error());
print "Table created.….";
?>
config.php
Код:
<?
$DBhost = "localhost";
$DBuser = "namebd";
$DBpass = "passbd";
$DBname = "namebd";
$DBtable = "guestbook";
?>
submitEntries.php
Код:
<?
require_once("config.php");
$DBconnect = mysql_connect($DBhost, $DBuser, $DBpass);
mysql_select_db($DBname, $DBconnect);
$Date = (date ("d/m/y",time()));
$ip = getenv('REMOTE_ADDR');
if ($Submit == "Yes") {
mysql_query("INSERT INTO $DBtable (name,email,message,date,ip) VALUES ('$Name','$Email','$Message','$Date','$ip')",$DBconnect) or die(mysql_error());
}
?>
getEntries.php
Код:
<?
require_once("config.php");
$DBconnect = mysql_connect($DBhost, $DBuser, $DBpass);
mysql_select_db($DBname, $DBconnect);
$number = mysql_query("SELECT * FROM $DBtable", $DBconnect) or die (mysql_error());
$postcount = @mysql_num_rows($number);
$postLow = $postcount - $NumHigh;
$postHigh = $postLow + 11;
$result = mysql_query("SELECT * FROM $DBtable WHERE id > $postLow AND id < $postHigh ORDER BY id DESC", $DBconnect) or die (mysql_error());
$postdisplay = @mysql_num_rows($result);
for ($count = 0; $count < $postdisplay; $count++) {
$post = mysql_fetch_array($result);
$id = $post['id'];
$name = $post['name'];
$email = $post['email'];
$message = $post['message'];
$date = $post['date'];
$ip = $post['ip'];
$output .= "<font color=\"#4D778C\">Name: </font>" . "<a href=\"mailto:$email\">$name</a>" . "<br />";
$output .= "<font color=\"#4D778C\">Message: </font>" . $message . "<br />";
$output .= "<font color=\"#6B391F\">Date: </font>" . "<font color=\"#6B391F\">$date</font>". "<br />". "<br />" ;
if ($id == 1) {
$output .= "<font color=\"#4D778C\">No more entries.…..</font>";
}
}
print "&guestbook=$output&postcount=$postcount&numhigh=$NumHigh&numlow=$NumLow";
?>