<?php
session_start();
if(!isset($_SESSION['pardeepadmin']))
{
@ require_once('sign.php');
die();
}
else
{
@ require_once('../config.php');
$d=mysql_connect($DB_HOST,$DB_USER,$DB_PASS)
or die('Wrong database settings, kindly check your database username &amp; password');
if(!mysql_select_db($DB_NAME,$d))
die('Wrong database setings, kindly check your database name');

if(isset($_GET['start'])){$start=$_GET['start'];} else{$start=0;}
$strt=$start*10;
function HF($HF)
{
$highfilter="/[<\}\!\@\#\$\%\&\*\=\+\[\]\(\_\-\)\:\\\'\,\?\/\|\{\~\`\^\;\>]/i";
$HF=strip_tags($HF);
$HF=preg_replace($highfilter,"",$HF);
$HF=str_replace("  "," ",$HF);
$HF=strtolower(str_replace(" ","-",$HF));
$HF=str_replace("--","-",$HF);
$HF=filter_var($HF, FILTER_SANITIZE_URL);
return $HF;
}
function MF($MF)
{
$midfilter="/[<\}\!\@\#\$\*\-\_\\\'\/\|\{\~\`\^\;\>]/i";
$MF=strip_tags($MF);
$MF=preg_replace($midfilter," ",$MF);
$MF=str_replace("  "," ",$MF);
$MF=strtolower(str_replace(" ","-",$MF));
$MF=filter_var($MF, FILTER_SANITIZE_URL);
$MF=ucfirst(str_replace("-"," ",$MF));
return $MF;
}
function LF($LF)
{
$lowfilter="/[<\}\\\'\{\`\^\;\>]/i";
$LF=strip_tags($LF);
$LF=preg_replace($lowfilter," ",$LF);
$LF=str_replace("  "," ",$LF);
$LF=str_replace(" ","-",$LF);
$LF=filter_var($LF, FILTER_SANITIZE_URL);
$LF=ucfirst(str_replace("-"," ",$LF));
$LF=htmlspecialchars($LF);
return $LF;
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="'.$WEBSITE_URL.'/images/favicon.ico" type="image/x-icon" />
<style type="text/css">
<!--
body{background:#F0F0F0;color:#333;font-family:Arial,Helvetica,Sans-serif;margin:20px;font-size:13px;}
a{color:#0071BC;text-decoration:underline;font-size:13px;}
a:hover{background:#FFFFE0;color:#ff0000;}
p{font-size:13px;margin:3px;line-height:140%;}
b{font-size:12px;}
h1{font-size:18px;margin:5px;}
h2{font-size:13px;color:#333;margin:0px;}
.H2{display:block;background:#Eaf5f9;text-align:left;padding:2px 2px 2px 5px;;border-bottom:1px solid #CEE6EF;}
.H2 span{color:#CEE6EF;}
.SPAN{padding-2px;background:#0071bc;color:#fff;text-align:center;padding:2px;border:1px solid #0071bc;border-radius:5px;-moz-border-radius:5px; /* Firefox */}
img{border:0px;}
.WRAPPER{width:650px;background:#fff;padding:7px 21px 14px 21px;border:1px solid #fff;border-radius:5px;-moz-border-radius:5px; /* Firefox */}
.TOP{color:#D6E9F2;float:right;text-align:right;}
.TOP a{font-size:12px;}
ul{list-style-type:none;margin:0px;padding:0px;}
li{display:block;margin-left:0px;margin-bottom:2px;color:#0071BC;height:17px;overflow:hidden;}
.LIGHT{color:#D6E9F2;}
.LIGHT a,.FOOTER a{color:#999;font-size:12px;}
.LIGHT a:hover,.FOOTER a:hover{color:#FF0000;}
.FLOAT{display:block;float:left;width:auto;height:auto;margin:4px;padding:5px;background:#ECF1F2;}
.FLOAT span{display:block;height:17px;width:105px;overflow:hidden;}
.CONTAINER{padding:8px;margin-bottom:10px;border:1px solid #D6E9F2;overflow:hidden;}
.CONTAINER p a{text-decoration:none;}
.SEARCH{background:#0071bc;width:706px;height:24px;padding:8px;text-align:left;border:1px outset #0071bc;}
input[type=text],input[type=password]{background:#fff;width:620px;height:22px;border:1px solid #D6E9F2;border-radius:5px;-moz-border-radius:5px; /* Firefox */}
textarea{background:#fff;width:620px;height:150px;border:1px solid #D6E9F2;border-radius:5px;-moz-border-radius:5px; /* Firefox */}

.FOOTER{color:#999;}
-->
</style>
';
?>

<title>Create new section</title>
<?php @ require('header.php');?>
<h2 class='cosmics'>Create a new category</h2>
<?php
if(isset($_POST['submit']))
{
$section=MF($_POST['section']);
$description=MF($_POST['description']);
$keywords=MF($_POST['keywords']);
if((!preg_match("^[0-9a-zA-Z]+$^", $section))||(strlen($section)>25))
{
echo "<div class='red'>&raquo; Kindly correct your section name &amp; try again, it should be of atmost 25 words.</div>";
}
else if((!preg_match("^[0-9a-zA-Z\&\,\!\@\%\+\:\?\.]+$^", $description))||(strlen($description)>160))
{
echo "<div class='red'>&raquo; Kindly correct your page description &amp; try again, it should be of atmost 160 words.</div>";
}
else if((!preg_match("^[0-9a-zA-Z\,\&\.]+$^", $keywords))||(strlen($keywords)>100))
{
echo "<div class='red'>&raquo; Kindly correct your page keywords &amp; try again, it should be of atmost 100 words.</div>";
}
else
{
$get=mysql_query("select * from ".$DB_SUFFIX."_p_forums order by ID desc")or die("Oops Error Code - CREATE: 1");
$get3=mysql_fetch_array($get);
$get4=$get3['ID']+1;
mysql_query("insert into ".$DB_SUFFIX."_p_forums (name,subforum,description,keyword) 
values('$section','$get4','$description','$keywords')") or die("Oops Error Code - CREATE: 2");
echo "<div class='red'>&raquo; Created sucessfully !</div>";
}
}
else
{
echo "<br /><form action='create.php' method='post'>
<b>+ Enter a section name</b><br />(Avoid using symbols, 25 words max limit.)<br />
<input type='text' name='section' maxlength='25' /><br /><br />
<b>+ Description</b><br />
(Description of your page in 160 words, some symbols are allowed.)<br />
<textarea name='description' rows='6' cols='100' maxlength='160'></textarea><br /><br />
<b>+ Keywords</b><br />
(Keywords related with this page in 100 words. seprated each keyword with a comma ie ( , ))<br />
<input type='text' name='keywords' maxlength='100' /><br />
<br /><input type='submit' name='submit' value='create' />";
}
echo "</div><div align='center'><a href='index.php'>Back to dashboard</a></div>
</div></div>
</body>
</html>";
}
?>
