Вторник, 23.04.2024, 15:05
Главная Регистрация RSS
Приветствую Вас, Гость
Меню сайта
Категории раздела
Delphi [12]
С++ [0]
С# [1]
PHP [7]
Мини-чат
Наш опрос
Оцените мой сайт
Всего ответов: 23
Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
Форма входа
Главная » 2012 » Январь » 09
И теперь сформируем внешний вид гостевой книги:
css/main.css

Code

*{
  margin:0;
  padding:0;
}
body {
  background-color:#fff;
  color:#fff;
  font:14px/1.3 Arial,sans-serif;
}
footer {
  background-color:#212121;
  bottom:0;
  box-shadow: 0 -1px 2px #111111;
  display:block;
  height:70px;
  left:0;
  position:fixed;
  width:100%;
  z-index:100;
}
footer h2{
  font-size:22px;
  font-weight:normal;
  left:50%;
  margin-left:-400px;
  padding:22px 0;
  position:absolute;
  width:540px;
}
footer a.stuts,a.stuts:visited{
  border:none;
  text-decoration:none;
  color:#fcfcfc;
  font-size:14px;
  left:50%;
  line-height:31px;
  margin:23px 0 0 110px;
  position:absolute;
  top:0;
}
footer .stuts span {
  font-size:22px;
  font-weight:bold;
  margin-left:5px;
}

.container {
  background: transparent url(../images/book_open.jpg) no-repeat top center ;
  color: #000000;
  height: 600px;
  margin: 20px auto;
  overflow: hidden;
  padding: 35px 100px;
  position: relative;
  width: 600px;
}
#col1, #col2 {
  float: left;
  margin: 0 10px;
  overflow: hidden;
  text-align: center;
  width: 280px;
}
#col1 {
  -webkit-transform: rotate(3deg);
  -moz-transform: rotate(3deg);
  -ms-transform: rotate(3deg);
  -o-transform: rotate(3deg);
}
#records form {
  margin:10px 0;
  padding:10px;
  text-align:left;
}
#records table td.label {
  color: #000;
  font-size: 13px;
  padding-right: 3px;
  text-align: right;
}
#records table label {
  font-size: 12px;
  vertical-align: middle;
}
#records table td.field input, #records table td.field textarea {
  background-color: rgba(255, 255, 255, 0.4);
  border: 0px solid #96A6C5;
  font-family: Verdana,Arial,sans-serif;
  font-size: 13px;
  margin-top: 2px;
  padding: 6px;
  width: 190px;
}
#records table td.field input[type=submit] {
  background-color: rgba(200, 200, 200, 0.4);
  cursor: pointer;
  float:right;
  width: 100px;
}
#records table td.field input[type=submit]:hover {
  background-color: rgba(200, 200, 200, 0.8);
}
#records_list {
  text-align:left;
}
#records_list .record {
  border-top: 1px solid #000000;
  font-size: 13px;
  padding: 10px;
}
#records_list .record:first-child {
  border-top-width:0px;
}
#records_list .record p:first-child {
  font-weight:bold;
  font-size:11px;
}
Категория: PHP | Просмотров: 5235 | Добавил: vavilov8 | Дата: 09.01.2012 | Комментарии (2)

Шаг 1. SQL
Для работы нашего приложения требуется создать таблицу:
Code
CREATE TABLE IF NOT EXISTS `s178_guestbook` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default '',
  `email` varchar(255) default '',
  `description` varchar(255) default '',
  `when` int(11) NOT NULL default '0',
  `ip` varchar(20) default NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


Шаг 2. PHP

Основной файл будет содержать следующий код:
guestbook.php  ... Читать дальше »
Категория: PHP | Просмотров: 2742 | Добавил: vavilov8 | Дата: 09.01.2012 | Комментарии (1)

вы можете воспользоваться нашим примером, в котором реализована отправка писем с использованием smtp-сервера, для которого требуется авторизация. Поэтому не забудьте добавить в скрипт соответствующие реквизиты доступа

Например:
Code

function authSendEmail($from, $namefrom, $to, $nameto,  
$subject, $message)  
{  
$smtpServer = "smtp.domain.tld";  
$port = "25";  
$timeout = "30";  
$username = "postmaster@domain.tld";  
$password = "YouPassword";  
$localhost = "localhost";  
$newLine = "\r\n";  

//Connect to the host on the specified port  
$smtpConnect = fsockopen($smtpServer, $port, $errno,  
$errstr, $timeout);  
$smtpResponse = fgets($smtpConnect, 515);  
if(empty($smtpConnect))  
{  
$output = "Failed to connect: $smtpResponse";  
return $output;  
}  
else  
{  
$logArray['connection'] = "Connected: $smtpResponse";  
}  

//Request Auth Login  
fputs($smtpConnect,"AUTH LOGIN" . $newLine);  
$smtpResponse = fgets($smtpConnect, 515);  
$logArray['authrequest'] = "$smtpResponse";  

//Send username  
fputs($smtpConnect, base64_encode($username) . $newLine);  
$smtpResponse = fgets($smtpConnect, 515);  
$logArray['authusername'] = "$smtpResponse";  

//Send password  
fputs($smtpConnect, base64_encode($password) . $newLine);  
$smtpResponse = fgets($smtpConnect, 515);  
$logArray['authpassword'] = "$smtpResponse";  

//Say Hello to SMTP  
fputs($smtpConnect, "HELO $localhost" . $newLine);  
$smtpResponse = fgets($smtpConnect, 515);  
$logArray['heloresponse'] = "$smtpResponse";  

//Email From  
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);  
$smtpResponse = fgets($smtpConnect, 515);  
$logArray['mailfromresponse'] = "$smtpResponse";  

//Email To  
fputs($smtpConnect, "RCPT TO: $to" . $newLine);  
$smtpResponse = fgets($smtpConnect, 515);  
$logArray['mailtoresponse'] = "$smtpResponse";  

//The Email  
fputs($smtpConnect, "DATA" . $newLine);  
$smtpResponse = fgets($smtpConnect, 515);  
$logArray['data1response'] = "$smtpResponse";  

//Construct Headers  
$headers = "MIME-Version: 1.0" . $newLine;  
$headers .= "Content-type: text/html;  
charset=windows-1251" . $newLine;  
$headers .= "To: $nameto <$to>" . $newLine;  
$headers .= "From: $namefrom <$from>" . $newLine;  

fputs($smtpConnect, "To: $to\nFrom: $from\nSubject:  
$subject\n$headers\n\n$message\n.\n");  

$smtpResponse = fgets($smtpConnect, 515);  
$logArray['data2response'] = "$smtpResponse";  

// Say Bye to SMTP  
fputs($smtpConnect,"QUIT" . $newLine);  
$smtpResponse = fgets($smtpConnect, 515);  
$logArray['quitresponse'] = "$smtpResponse";  
}  

//new function  

$to = "postmaster@domain.tld";  
$nameto = "Demo User";  
$from = "postmaster@domain.tld";  
$namefrom = "Postmaster";  
$subject = "Hello World Again!";  
$message = "World, Hello!";  

authSendEmail($from, $namefrom, $to, $nameto,  
$subject, $message);
Категория: PHP | Просмотров: 1839 | Добавил: vavilov8 | Дата: 09.01.2012 | Комментарии (0)