Location: PHPKode > scripts > Form Mail Lite > form/design.php
<?php
require("header.php");
?>
<SCRIPT TYPE="text/javascript" SRC="mado.js"></SCRIPT>
<?php
if(!$_POST["set"]){
if($_GET['fid']){
$Log=file("log/form.cgi");
for($i=0;$i<sizeof($Log);$i++){
$line=explode(",",$Log[$i]);
if($line[0]==$_GET["fid"]){
$solid=$line[2];
$left=$line[3];
$right=$line[4];
$font=$line[5];
break;
}
}
}
}
?>
<?php
if($_POST["set"]){
if($_POST["fid"] == ''){
$preview1 .= 'Please select the form name.<br>';
$flag = 1;
}
if($_POST["centersolid"] != ''){
if (!preg_match('/^#[0-9a-fA-F]{6}$/',$_POST["centersolid"])) {
$preview1 .= 'Border seems invalid.<br>';
$flag = 1;
}
}
if($_POST["left"] != ''){ 
if (!preg_match('/^#[0-9a-fA-F]{6}$/',$_POST["left"])) {
$preview1 .= 'Left seems invalid.<br>';
$flag = 1;
}
}
if($_POST["right"] != ''){ 
if (!preg_match('/^#[0-9a-fA-F]{6}$/',$_POST["right"])) {
$preview1 .= 'Right seems invalid.<br>';
$flag = 1;
}
}
if($_POST["font"] != ''){
if (!preg_match('/^[0-9]+$/',$_POST["font"])) {
$preview1 .= 'Font Size seems invalid.<br>';
$flag = 1;
}
}
$err = '';
if($preview1 != '') {
$err .= $preview1;
$flag = 1;
}
}
?>
<?php
if ($flag){
echo $err;
}
?>
<?php
if($_POST["set"]){
$Fid=$_POST['fid'];
$solid=$_POST["solid"];
$left=$_POST["left"];
$right=$_POST["right"];
$font=$_POST["font"];
}
?>
<?php
if (!$flag){
if($_POST["set"]){
$solid = strip_tags($solid);
$left = strip_tags($left);
$right = strip_tags($right);
$font = strip_tags($font);
$Log=file("log/form.cgi");
for($i=0;$i<sizeof($Log);$i++){
$line=explode(",",$Log[$i]);
if($line[0]==$Fid){
$list=$line[1];
$To=$line[6];
$Subject=$line[7];
$Text=$line[8];
$Sign=$line[9];
$Complete=$line[10];
$Remail=$line[10];
break;
}
}
$lines=array("$Fid","$list","$solid","$left","$right","$font","$To","$Subject","$Text","$Sign","$Complete","$Remail","1");
$lines=implode(",",$lines);
$lines=$lines."\n";
$Log=file("log/form.cgi");
for($i=0;$i<sizeof($Log);$i++){
$line=explode(",",$Log[$i]);
if($line[0]==$Fid){
$Flg++;
array_splice($Log,$i,1,$lines);			
}

}
if($Flg){
$fp=fopen("log/form.cgi","w");
flock($fp, LOCK_EX);
foreach($Log as $line)fputs($fp,$line);	
fclose($fp); 
}
print "Saved<br/>";
}
}
?>
<form action="" method="POST" name="f">
<select name="fid">
<?php
$Log=@file("log/form.cgi");
for($i=0;$i<sizeof($Log);$i++){
$line=explode(",",$Log[$i]);
$Selected="";
if($line[0]==$Fid){
$Selected="selected";
}
?>
<option value="<?=$line[0]?>" <?=$Selected?>><?=$line[1]?></option>
<?php
}
?>
</select><br><br>
Font Size<br>
<input type=text size=7 name=font maxlength="3" onchange="font();" value=<?=$font?>> px<br>
Border<br>
<input type=text size=7 name=solid maxlength="7" onkeyup="solid();" onchange="so();" value=<?=$solid?>><input type="button" value="Color Code" onClick="new_win1()"><br>
Left<br>
<input type=text size=7 name=left maxlength="7" onkeyup="left();" onchange="le();" value=<?=$left?>><input type="button" value="Color Code" onClick="new_win2()"><br>
Right<br>
<input type=text size=7 name=right maxlength="7" onkeyup="right();" onchange="ri();" value=<?=$right?>><input type="button" value="Color Code" onClick="new_win3()"><br><br>
<input type=submit name=set value=" Update "></form>
<form name="f1">
<INPUT type='hidden' name='rows' value='solid'>
</form>
<form name="f2">
<INPUT type='hidden' name='rows' value='left'>
</form>
<form name="f3">
<INPUT type='hidden' name='rows' value='right'>
</form>
<br><br>
<?php
$formurl= str_replace(basename(__FILE__),"",'http://'.$_SERVER["HTTP_HOST"].$_SERVER[PHP_SELF])."forms/form.php";
$Log=@file("log/form.cgi");
for($i=0;$i<sizeof($Log);$i++){
$line=explode(",",$Log[$i]);
$ID=$line[0];
$Form=$line[1];
$sprint = sprintf("%.20s", $Form);
$length = mb_strlen($sprint);
if( $length >= 20 ){
$sprint .="..";
}
?>
<table width='370'>
<td>Preview &gt; <a href="forms/form.php?fid=<?=$ID?>" target="_blank" STYLE="color: #6A9C09;text-decoration:underline;"><?=$sprint?></a></td>
<td align="right"><a href="l.php?fid=<?=$ID?>" STYLE="text-decoration:underline;">Edit</a> - <a href="design.php?fid=<?=$ID?>" STYLE="text-decoration:underline;">Design</a> - <a href="skin.php?fid=<?=$ID?>" STYLE="text-decoration:underline;">Settings</a></td>
</table>
<textarea rows=2 cols=70 wrap="off">
<a href="<?=$formurl?>?fid=<?=$ID?>"><?=$Form?></a>
</textarea>
<?php
}
?>
<?php
require("footer.php");
?>
Return current item: Form Mail Lite