Location: PHPKode > projects > M_Gbook > mgbook/functions.php
<? 
include ("config.php");
mysql_connect($db_host, $db_login, $db_pass);
mysql_select_db($db_name);
if ($_POST['name']==TRUE and $_POST['text']==TRUE){

setcookie("c_name", addslashes($_POST['name']), time()+252000);  
setcookie("c_mail", addslashes($_POST['mail']), time()+252000);  
setcookie("c_site", addslashes($_POST['site']), time()+252000); 
setcookie("c_icq", addslashes($_POST['icq']), time()+252000); 

if(md5($_POST['captcha'])===$_COOKIE['m_captcha']){

	$query="INSERT INTO `m_gbook` (`name`,`mail`,`site`,`icq`,`date`,`text`,`ip`) VALUES ('".addslashes($_POST['name'])."','".addslashes($_POST['mail'])."','".addslashes($_POST['site'])."','".addslashes($_POST['icq'])."','". $_POST['date']."','".addslashes($_POST['text'])."','".$_SERVER['REMOTE_ADDR']."');";
	$result=mysql_query($query);
	if ($result==TRUE){

	if ($tell=="yes"){mail_send($adm_mail, $adm_login, $_POST['name'], $_POST['mail'], $_POST['icq'], $_POST['site'], $_POST['text'], $_POST['date'], $REMOTE_ADDR);}
	header("Location: ".$_SERVER['PHP_SELF']);}
	else {
	header("Location: ".$_SERVER['PHP_SELF']); } }
else {echo "<script>alert('Íåïðàâèëüíûé êîä ïðîâåðêè!');</script>";}
	
} 

$style="<style type=\"text/css\">
BODY {
	font-family: verdana:
}
.unvis_div{display: none;}
.small_br{
font-size: 5pt;
}
.modify {
color: #FF0000;
border-color: red;
border: 1px solid;
font-size: 15px;
font-weight: bold;
}
a.textcontrol:link, a.textcontrol:active, a.textcontrol:visited {
height: 100px;
background-color: 000;
padding: 0;
}

</style>";

function view_textarea ($form, $name, $cols, $rows, $content, $gbook_font_text, $gbook_color_text, $gbook_color_text) {
$table="<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\">
<tr><td colspan=\"2\"><font  size=".$gbook_font_text."pt color=".$gbook_color_text."><a style=\"color: ".$gbook_color_text."; text-decoration: none;\" title=\"Bold\" href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+'[b][/b]'\"><strong>B</strong></a> | <a style=\"color: ".$gbook_color_text."; text-decoration: none; \" title=\"Italic\" href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+'[i][/i]'\"><em>I</em></a> | <a style=\"color: ".$gbook_color_text."; text-decoration: none; \" title=\"Underline\" href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+'[u][/u]'\"><u>U</u></a> | <a style=\"color: ".$gbook_color_text."; text-decoration: none; \" title=\"Strike\" href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+'[s][/s]'\"><strike>S</strike></a> | 
<select name=\"colors\" onchange=\"".$form.".".$name.".value=".$form.".".$name.".value+'['+".$form.".colors.value+'][/'+this.value+']'\">
<option selected disabled>color</option>
<option value=\"white\" style=\"background-color: white;\">white</option>
<option value=\"red\"  style=\"background-color: red;\">red</option>
<option value=\"yellow\"  style=\"background-color: yellow;\">yellow</option>
<option value=\"magenta\"  style=\"background-color: magenta;\">magenta</option>
<option value=\"green\"  style=\"background-color: green;\">green</option>
<option value=\"cyan\"  style=\"background-color: cyan;\">cyan</option>
<option value=\"blue\"  style=\"background-color: blue;\">blue</option>
<option value=\"navy\" style=\"background-color: navy;\">navy</option>
<option value=\"brown\"  style=\"background-color: brown;\">brown</option>
<option value=\"gray\"  style=\"background-color: gray;\">gray</option>
<option value=\"black\"  style=\"background-color: black;\">black</option>
</select>
</font></td></tr>
<tr><td valign=\"top\" width=\"10%\">
<textarea name=".$name." cols=".$cols." rows=".$rows.">".$content."</textarea>
</td><td valign=\"top\">
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :) '\"><img border=\"0\" src=smiles/smiley1.gif alt=smile title=\":)\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' ;) '\"><img border=\"0\" src=smiles/smiley2.gif alt=smile title=\";)\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :o '\"><img border=\"0\" src=smiles/smiley3.gif alt=smile title=\":o\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :D '\"><img border=\"0\" src=smiles/smiley4.gif alt=smile title=\":D\"></a><br>
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :S '\"><img border=\"0\" src=smiles/smiley5.gif alt=smile title=\":S\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :( '\"><img border=\"0\" src=smiles/smiley6.gif alt=smile title=\":(\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' &gt;:S '\"><img border=\"0\" src=smiles/smiley7.gif alt=smile title=\"&gt;:S\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :o) '\"><img border=\"0\" src=smiles/smiley8.gif alt=smile title=\":o)\"></a><br>
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :oy: '\"><img border=\"0\" src=smiles/smiley9.gif alt=smile title=\":oy\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :star: '\"><img border=\"0\" src=smiles/smiley10.gif alt=smile title=\":star:\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :P '\"><img border=\"0\" src=smiles/smiley11.gif alt=smile title=\":P\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :sleep: '\"><img border=\"0\" src=smiles/smiley12.gif alt=smile title=\":sleep:\"></a><br>
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' ;( '\"><img border=\"0\" src=smiles/smiley13.gif alt=smile title=\";(\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' :} '\"><img border=\"0\" src=smiles/smiley14.gif alt=smile title=\":}\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' &gt;:) '\"><img border=\"0\" src=smiles/smiley15.gif alt=smile title=\"&gt;:)\"></a> 
<a href=\"javascript:void(0);\" onclick=\"".$form.".".$name.".value=".$form.".".$name.".value+' 8) '\"><img border=\"0\" src=smiles/smiley16.gif alt=smile title=\"8)\"></a> 


</td></tr></table>";
return $table;
}


function strip($string) {
$replace = array(":)" => "<img src=\"smiles/smiley1.gif\" alt=\"\" title=\":)\">",
":)" => "<img src=\"smiles/smiley1.gif\" alt=\"\" title=\":)\">",
";)" => "<img src=\"smiles/smiley2.gif\" alt=\"\" title=\";)\">",
":o" => "<img src=\"smiles/smiley3.gif\" alt=\"\" title=\":o\">",
":D" => "<img src=\"smiles/smiley4.gif\" alt=\"\" title=\":D\">",
":S" => "<img src=\"smiles/smiley5.gif\" alt=\"\" title=\":S\">",
":(" => "<img src=\"smiles/smiley6.gif\" alt=\"\" title=\":(\">",
"&gt;:S" => "<img src=\"smiles/smiley7.gif\" alt=\"\" title=\"&gt;:S\">",
":o)" => "<img src=\"smiles/smiley8.gif\" alt=\"\" title=\":o)\">",
":oy:" => "<img src=\"smiles/smiley9.gif\" alt=\"\" title=\":oy:\">",
":star:" => "<img src=\"smiles/smiley10.gif\" alt=\"\" title=\":star:\">",
":P" => "<img src=\"smiles/smiley11.gif\" alt=\"\" title=\":P\">",
":sleep:" => "<img src=\"smiles/smiley12.gif\" alt=\"\" title=\":sleep:\">",
";(" => "<img src=\"smiles/smiley13.gif\" alt=\"\" title=\";(\">",
":}" => "<img src=\"smiles/smiley14.gif\" alt=\"\" title=\":}\">",
"&gt;:)" => "<img src=\"smiles/smiley15.gif\" alt=\"\" title=\"&gt;:)\">",
"8)" => "<img src=\"smiles/smiley16.gif\" alt=\"\" title=\"8)\">",
"[b]" => "<b>",
"[/b]" => "</b>",
"[i]" => "<em>",
"[/i]" => "</em>",
"[u]" => "<u>",
"[/u]" => "</u>",
"[s]" => "<strike>",
"[/s]" => "</strike>",
"[red]" => "<font color=\"red\">",
"[white]" => "<font color=\"white\">",
"[yellow]" => "<font color=\"yellow\">",
"[magenta]" => "<font color=\"magenta\">",
"[green]" => "<font color=\"green\">",
"[cyan]" => "<font color=\"cyan\">",
"[blue]" => "<font color=\"blue\">",
"[navy]" => "<font color=\"navy\">",
"[brown]" => "<font color=\"brown\">",
"[gray]" => "<font color=\"gray\">",
"[black]" => "<font color=\"black\">",
"[/white]" => "</font>",
"[/red]" => "</font>",
"[/yellow]" => "</font>",
"[/magenta]" => "</font>",
"[/green]" => "</font>",
"[/cyan]" => "</font>",
"[/blue]" => "</font>",
"[/navy]" => "</font>",
"[/brown]" => "</font>",
"[/gray]" => "</font>",
"[/black]" => "</font>"
);
$newstring=strtr(nl2br(htmlspecialchars(stripslashes($string))), $replace);
return $newstring;
}



function mail_send($to, $admin, $name, $mail, $icq, $site, $text, $date, $REMOTE_ADDR)
{
if ($mail==TRUE) {
$send_mail="E-mail: $mail \n";
}
if ($icq==TRUE) {
$send_icq="ICQ: $icq \n";
}
if ($site==TRUE and $site!="http://") {
$send_site="URL: $site";
}
$message = "Óâàæàåìûé ".$admin.", â âàøåì ãîñòåâîì êíèãå äîáàâëåíà íîâàÿ çàïèñü.
 
Èìÿ: $name
".$send_mail.$send_icq.$send_site."
Òåêñò: ".htmlspecialchars($text)."
Âðåìÿ: $date
IP Adress: $REMOTE_ADDR
M_Gbook v1.5 - 2006 - Mesrop Minasyan - www.Mesrop.info";
mail($to, "Äîáàâëåí çàïèñü! ", $message , "From: M_Gbook");
}
  
function admin_ver($user, $pass, $config_username, $config_pass) {
	if ($user==TRUE and $pass==TRUE) {
		if ($user==$config_username and $pass==$config_pass){
		$ok="Authorized"; }
		elseif  ($user!=$confog_username or $pass!=$confog_pass) {$ok=FALSE;}
	}
return $ok;
}

$praverka=admin_ver($_COOKIE["m_gbook_username"], $_COOKIE["m_gbook_password"], $adm_login, $adm_pass);

if ($praverka==TRUE) {
$if_not_change_pass="<font color=\"red\" size=\"-1\"></font>Åñëè âû íå õîòèòå èçìåíèòü ëîãèí/ïàðîëü, òî îñòàâüòå ïóñòûì ýòè ïîëÿ.";
}
else {
$if_not_change_pass="";
}
if ($tell=="yes"){
$yes="checked";
$no="";
}
elseif ($tell=="no") {
$yes="";
$no="checked";
}
	   $dirct="images";
	   $hdl=opendir($dirct);
	   while ($file = readdir ($hdl))
	   {
	  		if (($file!=".") && ($file!="..")){
	   			$a[]=$file;
	   		}
	   }
	  	closedir($hdl);
		asort ($a);
		foreach ($a as $value){
	if ($gbook_image_path==$value) {$check=" selected ";} else {$check="";}
			$result=$result."<option onMouseOver=\"add_item.add_element_link.value='".$value."/'\" ".$check.">".$value."</option>";	
		}

$result_dir="<select name=\"m_gbook_image_path\">".$result."</select>";

$conf_table=$style."<table width=\"100%\" border=1><form method=post name=config>
<tr><td colspan=2 bgcolor=\"#FFA327\"><font color=#000000 size=+2>M_Gbook</font></td></tr>
<tr><td colspan=2  bgcolor=\"#FFEaB9\"><font color=#000000 size=+1>Àäìèíèñòðàòîð</font></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ëîãèí*:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_adm_login\" value=\"$adm_login\" size=\"25\"></font></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ïàðîëü*:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_adm_pass\" value=\"$adm_pass\"  size=\"25\"></font></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ýë. ïî÷òà*:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_adm_mail\" value=\"$adm_mail\" size=\"25\"></font></td></tr>
<tr><td colspan=2 bgcolor=\"#FFEaB9\"><font color=#000000 size=+1>Áàçà</font></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Õîñò (ñòàíäàðò &quot;localhost&quot;):</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_db_host\" value=\"$db_host\" size=\"25\" value=\"$localhost\"></font><input type=\"Button\" onclick=\"document.config.m_db_host.value=this.value\" value=\"localhost\"></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ëîãèí ê áàçå*:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_db_login\" value=\"$db_login\" size=\"25\"></font></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ïàðîëü ê áàçå*:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_db_pass\" value=\"$db_pass\" size=\"25\"></font></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Èìÿ áàçû*:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_db_name\" value=\"$db_name\" size=\"25\"></font></td></tr>
<tr><td colspan=2 bgcolor=\"#FFEaB9\"><font color=#000000 size=+1>Ãîñòåâàÿ êíèãà</font></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Èìÿ ãîñòåâîé êíèãè:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_title\" value=\"$gbook_title\" size=\"25\"></font></td></tr>

<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Èìÿ ôàéëà ãîñò. êíèãè:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_filename\" value=\"$gbook_filename\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_filename.value=this.value\" value=\"index.php\"></td></tr>

<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Êîëëåêöèÿ ãðàôèêè:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000>".$result_dir."</font><input type=\"Button\" onclick=\"document.config.m_gbook_image_path.value=this.value\" value=\"white_pixel_graphics_v1\"></td></tr>

<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Øèðèíà êíèãè â ïðîöåíòàõ:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_width\" value=\"$gbook_width\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_width.value=this.value\" value=\"55\"></td></tr>

<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ìàêñ. ñîîáù. íà ñòðàíèöå:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_maxmess\" value=\"$gbook_maxmess\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_maxmess.value=this.value\" value=\"10\"></td></tr>

<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ìèí. ñèìâîëîâ â òåêñòå:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_minchars\" value=\"$gbook_minchars\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_minchars.value=this.value\" value=\"5\"></td></tr>

<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ìàêñ. ñèìâîëîâ â òåêñòå:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_maxchars\" value=\"$gbook_maxchars\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_maxchars.value=this.value\" value=\"500\"></td></tr>

<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Öâåò ôîíà:</td><td bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_bg\" value=\"$gbook_bg\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_bg.value=this.value\" value=\"83C2ED\"></td></tr>

<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Öâåò ôîíà òàáëèöû çàãîëîâêà:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_bg_title\" value=\"$gbook_bg_title\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_bg_title.value=this.value\" value=\"374F3F\"></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Öâåò ôîíà òàáëèöû çàãîëîâêà ñîîáù.:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_bg_title_text\" value=\"$gbook_bg_title_text\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_bg_title_text.value=this.value\" value=\"444444\"></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Öâåò ôîíà òàáëèöû òåêñòà ñîîáù.:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_bg_text\" value=\"$gbook_bg_text\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_bg_text.value=this.value\" value=\"F4F3F5\"></td></tr>


<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Öâåò øðèôòà çàãîëîâêà:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_color_title\" value=\"$gbook_color_title\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_color_title.value=this.value\" value=\"FFFFFF\"></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Öâåò øðèôòà òåêñòà:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_color_text\" value=\"$gbook_color_text\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_color_text.value=this.value\" value=\"800000\"></td></tr>


<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Öâåò ëèíêîâ:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_a\" value=\"$gbook_a\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_a.value=this.value\" value=\"FFFFFF\"></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Öâåò ðàìêè:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_border\" value=\"$gbook_border\" size=\"25\"></font><input type=\"Button\" onclick=\"document.config.m_gbook_border.value=this.value\" value=\"FF0000\"></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ðàçìåð øðèôòà ïîäçàãîë.:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_font_title\" value=\"$gbook_font_title\" size=\"10\"> PT (point)</font><input type=\"Button\" onclick=\"document.config.m_gbook_font_title.value=this.value\" value=\"5\"></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Ðàçìåð øðèôòà:</td><td  bgcolor=\"#FFF8E6\"><font color=#000000><input type=text name=\"m_gbook_font_text\" value=\"$gbook_font_text\" size=\"10\"> PT (point)</font><input type=\"Button\" onclick=\"document.config.m_gbook_font_text.value=this.value\" value=\"2\"></td></tr>
<tr><td bgcolor=\"#FFF9Ea\" width=\"30%\"><font color=#000000>Óâåäîìëÿòü àäìèíà ïî ïî÷òå î íîâûõ ñîîáùåíèÿõ</td><td  bgcolor=\"#FFF8E6\"><font color=#000000>Äà: <input type=radio name=\"m_tell\" value=\"yes\" ".$yes.">&nbsp;&nbsp;Íåò: <input type=radio name=\"m_tell\" value=\"no\" ".$no."></font></td></tr>
<tr><td bgcolor=\"#FFEaB9\"><font color=#000000 size=+1></td><td bgcolor=\"#FFEaB9\"><font color=#000000 size=+1><input type=hidden name=\"go\" value=\"yes\"><input type=hidden name=do_save value=save><input type=submit value=\"Ñîõðàíèòü!\"></font></td></tr>
</form></table>";

if ($praverka==TRUE and $adm_login==FALSE and $adm_pass==FALSE) {
$adm_login=$_COOKIE["m_gbook_username"];
$adm_pass=$_COOKIE["m_gbook_password"];
}

 $cont_config =  "<? 
	\$adm_login=\"".$_POST['m_adm_login']."\";
	\$adm_pass=\"".$_POST['m_adm_pass']."\";
	\$adm_mail=\"".$_POST['m_adm_mail']."\";
	
	\$db_host=\"".$_POST['m_db_host']."\";
	\$db_login=\"".$_POST['m_db_login']."\";
	\$db_pass=\"".$_POST['m_db_pass']."\";
	\$db_name=\"".$_POST['m_db_name']."\";
	
	\$gbook_title=\"".$_POST['m_gbook_title']."\";
	\$gbook_filename=\"".$_POST['m_gbook_filename']."\";
	\$gbook_width=\"".$_POST['m_gbook_width']."\";
	\$gbook_image_path=\"".$_POST['m_gbook_image_path']."\";
	\$gbook_maxmess=\"".$_POST['m_gbook_maxmess']."\";
	
	\$gbook_minchars=\"".$_POST['m_gbook_minchars']."\";
	\$gbook_maxchars=\"".$_POST['m_gbook_maxchars']."\";
	
	
	\$gbook_bg=\"".$_POST['m_gbook_bg']."\";
	\$gbook_bg_title=\"".$_POST['m_gbook_bg_title']."\";
	\$gbook_bg_text=\"".$_POST['m_gbook_bg_text']."\";
	\$gbook_color_title=\"".$_POST['m_gbook_color_title']."\";
	\$gbook_bg_title_text=\"".$_POST['m_gbook_bg_title_text']."\";
	\$gbook_color_text=\"".$_POST['m_gbook_color_text']."\";
	\$gbook_a=\"".$_POST['m_gbook_a']."\";
	\$gbook_font_title=\"".$_POST['m_gbook_font_title']."\";
	\$gbook_font_text=\"".$_POST['m_gbook_font_text']."\";
	
	\$gbook_border=\"".$_POST['m_gbook_border']."\";
	\$tell=\"".$_POST['m_tell']."\";
?>";

function write($filename, $contents){

$file = fopen($filename, "w+");
   
        if (fwrite ($file, $contents)) {
		$fname= $GLOBALS['gbook_filename'];
		return TRUE;
		}
		else {
		return FALSE;
		}		
}




?>
Return current item: M_Gbook