<?php
include('../includes/cp-ar.php');
if(isset($_COOKIE['userid']) AND isset($_COOKIE['pass'])){
include('../includes/config.php');

$ui = intval($_COOKIE['userid']);

$p = addslashes($_COOKIE['pass']);
$p = htmlspecialchars($p);
$pa = "hpl]hgadjd";
$pmd5 = str_replace($pa,"",$p);

$query = mysql_query ("SELECT * FROM `admin` WHERE id='$ui' AND password='$pmd5' AND adminoruser='1'") or die ("Query failedd");
$counts = mysql_num_rows($query);
if($counts == 0){
echo $LANGAUGE_CP[5];
exit;
}
$Row = mysql_fetch_array($query);
$Row['username'] = htmlspecialchars($Row['username']);
$u = stripslashes($Row['username']);

function uploadfile($input,$namefolder,$uploadfolder)
{
global $_FILES;
// $namefolder = "upload";
// $uploadfolder = "../upload/";
$fileName = $_FILES[''.$input.'']['name'];
$tmpName  = $_FILES[''.$input.'']['tmp_name'];
$fileSize = $_FILES[''.$input.'']['size'];
$fileType = $_FILES[''.$input.'']['type'];

if(!empty($fileName)){
$time = time();
$ext = substr(strrchr($fileName, "."), 1);
$randName = md5(rand() * time());
$randName = substr($randName, 0, 5);
$filePath = $uploadfolder . $time . '-' . $randName . '.' . $ext;
$nameindatabase = $time . '-' . $randName . '.' . $ext;
$pathimages = "$namefolder/$nameindatabase";

$result = move_uploaded_file($tmpName, $filePath);
if (!$result) {
$text = "";
}else{
$text = $pathimages;
}
}

return $text;
}

$links = $LANGAUGE_CP[6];

$h = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html dir='".$LANGAUGE_CP['dir']."' xmlns='http://www.w3.org/1999/xhtml' xml:lang='".$LANGAUGE_CP['lang']."' lang='".$LANGAUGE_CP['lang']."'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=".$LANGAUGE_CP['charset']."' />
<link rel='stylesheet' href='".$LANGAUGE_CP['css']."' type='text/css' />
<title>".$LANGAUGE_CP[1]."</title>
<script type=\"text/javascript\" src=\"../js/ed.js\"></script>
<script type=\"text/javascript\" src=\"../js/jquery-1.2.2.pack.js\"></script>
<script type=\"text/javascript\" src=\"../js/ddaccordion.js\"></script>
<script type=\"text/javascript\" src=\"../js/tinymce/tiny_mce.js\"></script>
<script type=\"text/javascript\">
tinyMCE.init({
        // General options
        mode : \"exact\", //textareas
        elements : \"textarea1,textarea2\",
        theme : \"advanced\",
        plugins : \"safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager\",

        // Theme options
        theme_advanced_buttons1 : \"save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect\",
        theme_advanced_buttons2 : \"cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor\",
        theme_advanced_buttons3 : \"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen\",
        theme_advanced_buttons4 : \"insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage\",
        theme_advanced_toolbar_location : \"top\",
        theme_advanced_toolbar_align : \"right\",
        theme_advanced_statusbar_location : \"bottom\",
        theme_advanced_resizing : true,

        // Example content CSS (should be your site CSS)
        content_css : \"css/example.css\",

        // Drop lists for link/image/media/template dialogs
        template_external_list_url : \"js/template_list.js\",
        external_link_list_url : \"js/link_list.js\",
        external_image_list_url : \"js/image_list.js\",
        media_external_list_url : \"js/media_list.js\",

        // Replace values for the template plugin
        template_replace_values : {
                username : \"Some User\",
                staffid : \"991234\"
        }
});
</script>

<script type='text/javascript'>

ddaccordion.init({
        headerclass: 'expandable', //Shared CSS class name of headers group that are expandable
        contentclass: 'categoryitems', //Shared CSS class name of contents group
        revealtype: 'click', //Reveal content when user clicks or onmouseover the header? Valid value: 'click' or 'mouseover
        collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
        defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
        onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
        animatedefault: false, //Should contents open by default be animated into view?
        persiststate: true, //persist state of opened contents within browser session?
        toggleclass: ['', 'openheader'], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ['class1', 'class2']
        togglehtml: ['prefix', '', ''], //Additional HTML added to the header when it's collapsed and expanded, respectively  ['position', 'html1', 'html2'] (see docs)
        animatespeed: 'normal', //speed of animation: 'fast', 'normal', or 'slow'
        oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
                //do nothing
        },
        onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
                //do nothing
        }
})

</script>

<script type='text/javascript'>
function addText(text,idt){
  document.getElementById(idt).value += text;
}
</script>

</head>
<body>
<div id='wrap'>
<br />
<div align='center' class='bar'>".$LANGAUGE_CP[7]."</div><br />
<div class='menu'>
$links
</div>
<div class='content'>";

$f = "<br /><br /></div>

<div align='center' class='bar'>
".$LANGAUGE_CP[400]."
</div><br /><br />
</div>
</body>
</html>";





}else{

echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html dir='".$LANGAUGE_CP['dir']."' xmlns='http://www.w3.org/1999/xhtml' xml:lang='".$LANGAUGE_CP['lang']."' lang='".$LANGAUGE_CP['lang']."'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=".$LANGAUGE_CP['charset']."' />
<link rel='stylesheet' href='".$LANGAUGE_CP['css']."' type='text/css' />
<title>".$LANGAUGE_CP[1]."</title>
</head>
<body>
<br /><br /><br /><br />
".$LANGAUGE_CP[8]."
<br /><br /><br /><br />
</body>
</html>";
exit;
}
?>