]][ahhhhhhhasdasdassasdkksdadddsddfgh
במ12[aspddfsdfsdfdfnsd g ggk ffghaskjjsaddddkdasdasd asdadghdgh;';';'
/
home
/
swordshipmanagem
/
public_html
/
admin
/
Upload FileeE
HOME
<?php require('database.php'); session_start(); error_reporting(0); function do_login() { if (isset($_POST['login'])) { $user = ($_POST['username']); $pass = ($_POST['password']); //require('database.php'); $ob = new database(); $ob->query("SELECT * FROM admin where username='$user' and password='$pass'"); if ($ob->numRows() >= 1) { foreach($ob->rows() as $data) { $_SESSION['user'] = $_POST['username']; $_SESSION['id'] = $data['id']; echo '<script>parent.location.assign("home.php")</script>'; } }else{ echo '<script>alert("Username and Password.")</script>'; } } } function check_login() { session_start(); if (!isset($_SESSION['user'])){ $username=$_SESSION['user']; header('location:index.php'); } } function logout() { session_start(); session_destroy(); header("Location:index.php"); } function topbar() { ?> <!--Header Start--> <div class="header" > <a href="home.php"><img src="images/1-0001.png" width="200" height="100" class="logo"></a> <div class="pull-right"> <!--Notifications Start--> <div class="notifications-head"> <!--Messages Start--> <div class="btn-group m_left hide-mobile" > <a class="dropdown-toggle" data-toggle="dropdown" href="#"> <span class="notification">531</span><span class="triangle-1"></span><i class="icon-comments"></i><span class="caret"></span> </a> <div class="dropdown-menu"> <span class="triangle-2"></span> <div class="ichat"> <div class="ichat-messages"> <div class="ichat-title"> <div class="pull-left">New Messages</div> <div class="pull-right"><span>Update 4*</span></div> <div class="clear"></div> </div> <div class="imessage"> <div class="iavatar"><img src="images/users/1.jpg" alt=""></div> <div class="imes"> <div class="iauthor"><a href="https://www.swordshipmanagement.com:2096/cpsess6194132644/3rdparty/roundcube/?_task=mail&_mbox=INBOX">admin@swordshipmanagement</a></div> <div class="itext"></div> </div> <div class="idelete"><a href="#"><span><i class="icon-remove"></i></span></a></div> <div class="clear"></div> </div> <div class="imessage"> <div class="iavatar"><img src="images/users/6.jpg" alt=""></div> <div class="imes"> <div class="iauthor"></div> <div class="itext"> <a href="https://www.swordshipmanagement.com:2096/cpsess6194132644/3rdparty/roundcube/?_task=mail&_mbox=INBOX">crewing@swordshipmanagemen</a> </div> </div> <div class="idelete"><a href="#"><span><i class="icon-remove"></i></span></a></div> <div class="clear"></div> </div> <div class="imessage"> <div class="iavatar"><img src="images/users/6.jpg" alt=""></div> <div class="imes"> <div class="iauthor"></div> <div class="itext"> <a href="https://www.swordshipmanagement.com:2096/cpsess6194132644/3rdparty/roundcube/?_task=mail&_mbox=INBOX">info@swordshipmanagement.</a> </div> </div> <div class="idelete"><a href="#"><span><i class="icon-remove"></i></span></a></div> <div class="clear"></div> </div> <div class="imessage"> <div class="iavatar"><img src="images/users/6.jpg" alt=""></div> <div class="imes"> <div class="iauthor"></div> <div class="itext"> <a href="https://www.swordshipmanagement.com:2096/cpsess6194132644/3rdparty/roundcube/?_task=mail&_mbox=INBOX">sushila@swordshipmanageme</a> </div> </div> <div class="idelete"><a href="#"><span><i class="icon-remove"></i></span></a></div> <div class="clear"></div> </div> <div class="imessage"> <div class="iavatar"><img src="images/users/6.jpg" alt=""></div> <div class="imes"> <div class="iauthor"></div> <div class="itext"> <a href="https://www.swordshipmanagement.com:2096/cpsess6194132644/3rdparty/roundcube/?_task=mail&_mbox=INBOX">swordrising@swordshipmanag</a> </div> </div> <div class="idelete"><a href="#"><span><i class="icon-remove"></i></span></a></div> <div class="clear"></div> </div> <div class="imessage"> <div class="iavatar"><img src="images/users/2.jpg" alt=""></div> <div class="imes"> <div class="iauthor"></div> <div class="itext"> <a href="https://www.swordshipmanagement.com:2096/cpsess6194132644/3rdparty/roundcube/?_task=mail&_mbox=INBOX">cdocs@swordshipmanagemen</a> </div> </div> <div class="idelete"><a href="#"><span><i class="icon-remove"></i></span></a></div> <div class="clear"></div> </div> <div class="ichat-link"><a href="#">Login Pssword</a> <a href="#">A2u1Zbu2AB[1 </a> <a href="#"></a> <a href="#"></a> <div class="clear"></div> </div> </div> <a href="#" class="iview">View all</a><a href="#" class="imark">Mark all read</a> </div> </div> </div> <!--Messages END--> <!--Recent Activity Start--> <div class="btn-group pull-left hide-mobile" > <a class="dropdown-toggle" data-toggle="dropdown" href="#"> <span class="notification">77</span><span class="triangle-1"></span><i class="icon-bell"></i><span class="caret"></span> </a> <div class="dropdown-menu"> <span class="triangle-2"></span> <div class="ichat"> <div class="ichat-messages"> <div class="ichat-title"> <div class="pull-left">Recent Activity</div> <div class="pull-right"><span>Update 14*</span></div> <div class="clear"></div> </div> <div class="r_activity"> <div class="imessage"> <div class="r_icon"><a href="#"><i class="icon-camera"></i></a></div> <div class="r_info"> <div class="r_name"><strong>Alan Cook</strong> a new photo</div> <div class="r_text"><i class="icon-time"></i> 3 hours ago</div> <div class="r_link"><a href="#">View...</a></div> </div> <div class="clear"></div> </div> <div class="imessage"> <div class="r_icon"><a href="#"><i class="icon-thumbs-up"></i></a></div> <div class="r_info"> <div class="r_name"><strong>Isaac Donaldson</strong> like: BMW E36</div> <div class="r_text"><i class="icon-time"></i> 5 hours ago</div> <div class="r_link"><a href="#">View...</a></div> </div> <div class="clear"></div> </div> <div class="imessage"> <div class="r_icon"><a href="#"><i class="icon-user"></i></a></div> <div class="r_info"> <div class="r_name">Registered new user</div> <div class="r_text"><i class="icon-time"></i> 15th of May - 06:21</div> <div class="r_link"><a href="#">View...</a></div> </div> <div class="clear"></div> </div> </div> </div> <a href="#" class="iview">View all</a><a href="#" class="imark">Mark all read</a> </div> </div> </div> <!--Recent Activity END--> </div><!--Notifications END--> <!--Button User Start--> <div class="btn-group pull-right" > <a class="btn btn-profile dropdown-toggle" id="button-profile" data-toggle="dropdown" href="#"> <span class="name-user"><strong style="text-transform:capitalize">Welcome <?php echo $_SESSION['user'];?> </strong>,</span> <span class="avatar"><img src="images/users/1.jpg" alt="" ></span> <span class="caret"></span> </a> <div class="dropdown-menu" id="prof_dropdown"> <div class="item_m"><span class="caret"></span></div> <ul class="clear_ul" > <li><a href="#"><i class="icon-globe"></i> Home</a></li> <li><a href="change.php"><i class="icon-cog"></i>Password Change</a></li> <li><a href="logout.php"><i class="icon-off"></i> Sign Out</a></li> </ul> </div> </div> <!--Button User END--> </div> </div> <?php } function head() { ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Sword Ship Management Admin</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="Complete Web Solution like Web Development, Web Designing, PHP Development, Jquery Templates."> <meta name="author" content="HD Infotech"> <!-- The styles --> <link id="bs-css" href="css/bootstrap-cerulean.css" rel="stylesheet"> <style type="text/css"> body { padding-bottom: 40px; } .sidebar-nav { padding: 9px 0; } </style> <link href="css/bootstrap-responsive.css" rel="stylesheet"> <link href="css/charisma-app.css" rel="stylesheet"> <link href="css/jquery-ui-1.8.21.custom.css" rel="stylesheet"> <link href='css/fullcalendar.css' rel='stylesheet'> <link href='css/fullcalendar.print.css' rel='stylesheet' media='print'> <link href='css/chosen.css' rel='stylesheet'> <link href='css/uniform.default.css' rel='stylesheet'> <link href='css/colorbox.css' rel='stylesheet'> <link href='css/jquery.cleditor.css' rel='stylesheet'> <link href='css/jquery.noty.css' rel='stylesheet'> <link href='css/noty_theme_default.css' rel='stylesheet'> <link href='css/elfinder.min.css' rel='stylesheet'> <link href='css/elfinder.theme.css' rel='stylesheet'> <link href='css/jquery.iphone.toggle.css' rel='stylesheet'> <link href='css/opa-icons.css' rel='stylesheet'> <link href='css/uploadify.css' rel='stylesheet'> <!-- The HTML5 shim, for IE6-8 support of HTML5 elements --> <!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <!-- The fav icon --> <link rel="shortcut icon" href="img/favicon.ico"> </head> <?php } function copyright() { ?> <footer> <p class="pull-left">© Copyright & All Rights Reserved By <a href="../index.php" target=_blank>Phenawa Fashion</a></p> </footer> <?php } function footer() { ?> <!-- jQuery --> <script type="text/javascript" src='tinymce/tinymce.min.js' referrerpolicy="origin"> </script> <script type="text/javascript"> tinymce.init({ selector: 'textarea', width: 600, height: 300, plugins: [ 'advlist autolink link image lists charmap print preview hr anchor pagebreak', 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking', 'table emoticons template paste help' ], toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | ' + 'bullist numlist outdent indent | link image | print preview media fullpage | ' + 'forecolor backcolor emoticons | help', menu: { favs: {title: 'My Favorites', items: 'code visualaid | searchreplace | emoticons'} }, menubar: 'favs file edit view insert format tools table help', content_css: 'css/content.css' }); </script> <script src="js/jquery-1.7.2.min.js"></script> <!-- jQuery UI --> <script src="js/jquery-ui-1.8.21.custom.min.js"></script> <!-- transition / effect library --> <script src="js/bootstrap-transition.js"></script> <!-- alert enhancer library --> <script src="js/bootstrap-alert.js"></script> <!-- modal / dialog library --> <script src="js/bootstrap-modal.js"></script> <!-- custom dropdown library --> <script src="js/bootstrap-dropdown.js"></script> <!-- scrolspy library --> <script src="js/bootstrap-scrollspy.js"></script> <!-- library for creating tabs --> <script src="js/bootstrap-tab.js"></script> <!-- library for advanced tooltip --> <script src="js/bootstrap-tooltip.js"></script> <!-- popover effect library --> <script src="js/bootstrap-popover.js"></script> <!-- button enhancer library --> <script src="js/bootstrap-button.js"></script> <!-- accordion library (optional, not used in demo) --> <script src="js/bootstrap-collapse.js"></script> <!-- carousel slideshow library (optional, not used in demo) --> <script src="js/bootstrap-carousel.js"></script> <!-- autocomplete library --> <script src="js/bootstrap-typeahead.js"></script> <!-- tour library --> <script src="js/bootstrap-tour.js"></script> <!-- library for cookie management --> <script src="js/jquery.cookie.js"></script> <!-- calander plugin --> <script src='js/fullcalendar.min.js'></script> <!-- data table plugin --> <script src='js/jquery.dataTables.min.js'></script> <!-- chart libraries start --> <script src="js/excanvas.js"></script> <script src="js/jquery.flot.min.js"></script> <script src="js/jquery.flot.pie.min.js"></script> <script src="js/jquery.flot.stack.js"></script> <script src="js/jquery.flot.resize.min.js"></script> <!-- chart libraries end --> <!-- select or dropdown enhancer --> <script src="js/jquery.chosen.min.js"></script> <!-- checkbox, radio, and file input styler --> <script src="js/jquery.uniform.min.js"></script> <!-- plugin for gallery image view --> <script src="js/jquery.colorbox.min.js"></script> <!-- rich text editor library --> <script src="js/jquery.cleditor.min.js"></script> <!-- notification plugin --> <script src="js/jquery.noty.js"></script> <!-- file manager library --> <script src="js/jquery.elfinder.min.js"></script> <!-- star rating plugin --> <script src="js/jquery.raty.min.js"></script> <!-- for iOS style toggle switch --> <script src="js/jquery.iphone.toggle.js"></script> <!-- autogrowing textarea plugin --> <script src="js/jquery.autogrow-textarea.js"></script> <!-- multiple file upload plugin --> <script src="js/jquery.uploadify-3.1.min.js"></script> <!-- history.js for cross-browser state change on ajax --> <script src="js/jquery.history.js"></script> <!-- application script for Charisma demo --> <script src="js/charisma.js"></script> <?php } function navigation() { ?> <div class="speedbar"> <div class="speedbar-content"> <ul class="menu-drop"> <li><a href="#"><i class="icon-chevron-down"></i></a> <ul> <li><a href="home.php">Dashboard</a></li> <li><a href="news.php">News</a></li> <li><a href="about_us.php">About Us</a></li> <li><a href="career.php">Career</a></li> <li><a href="services.php">Services</a></li> <li><a href="address.php">Contact Detail</a></li> <li><a href="view_cat.php">View Fleet List</a></li> <li><a href="category.php">Add Ship Details</a></li> </ul> </div> </div> <?php } function menu() { ?> <div id="sidebar"> <ul class="menu-sidebar"> <li><a href="#"><i class="icon-home"></i> <span>General</span></a></li> <li><a href="#" class="active"><i class="icon-group"></i> <span>UI </span></a></li> <li><a href="#"><i class="icon-edit"></i> <span>Forms</span></a></li> <li><a href="#"><i class="icon-briefcase"></i> <span>Others</span></a></li> <li><a href="#"><i class="icon-warning-sign"></i> <span>Errors</span></a></li> <li><a href="#"><i class="icon-gift"></i> <span>Bonus</span></a></li> </ul> </div> <?php } function fancy() { ?> <!-- Add jQuery library --> <script type="text/javascript" src="fancy/lib/jquery-1.10.2.min.js"></script> <!-- Add mousewheel plugin (this is optional) --> <script type="text/javascript" src="fancy/lib/jquery.mousewheel.pack.js?v=3.1.3"></script> <!-- Add fancyBox main JS and CSS files --> <script type="text/javascript" src="fancy/source/jquery.fancybox.pack.js?v=2.1.5"></script> <link rel="stylesheet" type="text/css" href="fancy/source/jquery.fancybox.css?v=2.1.5" media="screen" /> <!-- Add Button helper (this is optional) --> <link rel="stylesheet" type="text/css" href="fancy/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" /> <script type="text/javascript" src="fancy/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script> <!-- Add Thumbnail helper (this is optional) --> <link rel="stylesheet" type="text/css" href="fancy/source/helpers/jquery.fancybox-thumbs.css?v=1.0.7" /> <script type="text/javascript" src="fancy/source/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script> <!-- Add Media helper (this is optional) --> <script type="text/javascript" src="fancy/source/helpers/jquery.fancybox-media.js?v=1.0.6"></script> <script type="text/javascript"> $(document).ready(function() { /* * Simple image gallery. Uses default settings */ $('.fancybox').fancybox(); /* * Different effects */ // Change title type, overlay closing speed $(".fancybox-effects-a").fancybox({ helpers: { title : { type : 'outside' }, overlay : { speedOut : 0 } } }); // Disable opening and closing animations, change title type $(".fancybox-effects-b").fancybox({ openEffect : 'none', closeEffect : 'none', helpers : { title : { type : 'over' } } }); // Set custom style, close if clicked, change title type and overlay color $(".fancybox-effects-c").fancybox({ wrapCSS : 'fancybox-custom', closeClick : true, openEffect : 'none', helpers : { title : { type : 'inside' }, overlay : { css : { 'background' : 'rgba(238,238,238,0.85)' } } } }); // Remove padding, set opening and closing animations, close if clicked and disable overlay $(".fancybox-effects-d").fancybox({ padding: 0, openEffect : 'elastic', openSpeed : 150, closeEffect : 'elastic', closeSpeed : 150, closeClick : true, helpers : { overlay : null } }); /* * Button helper. Disable animations, hide close button, change title type and content */ $('.fancybox-buttons').fancybox({ openEffect : 'none', closeEffect : 'none', prevEffect : 'none', nextEffect : 'none', closeBtn : false, helpers : { title : { type : 'inside' }, buttons : {} }, afterLoad : function() { this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); } }); /* * Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked */ $('.fancybox-thumbs').fancybox({ prevEffect : 'none', nextEffect : 'none', closeBtn : false, arrows : false, nextClick : true, helpers : { thumbs : { width : 50, height : 50 } } }); /* * Media helper. Group items, disable animations, hide arrows, enable media and button helpers. */ $('.fancybox-media') .attr('rel', 'media-gallery') .fancybox({ openEffect : 'none', closeEffect : 'none', prevEffect : 'none', nextEffect : 'none', arrows : false, helpers : { media : {}, buttons : {} } }); /* * Open manually */ $("#fancybox-manual-a").click(function() { $.fancybox.open('1_b.jpg'); }); $("#fancybox-manual-b").click(function() { $.fancybox.open({ href : 'iframe.html', type : 'iframe', padding : 5 }); }); $("#fancybox-manual-c").click(function() { $.fancybox.open([ { href : '1_b.jpg', title : 'My title' }, { href : '2_b.jpg', title : '2nd title' }, { href : '3_b.jpg' } ], { helpers : { thumbs : { width: 75, height: 50 } } }); }); }); </script> <style type="text/css"> .fancybox-custom .fancybox-skin { box-shadow: 0 0 50px #222; } </style> <?php } function gallery() { if(isset($_POST['add_gallery'])) { //require('database.php'); $output_dir = 'upload/'; $title = $_POST['title']; if(isset($_FILES["image"]["name"])) { if (!is_dir($output_dir)) { mkdir($output_dir); } $error =$_FILES["image"]["error"]; { if(is_array($_FILES["image"]['name'])) { $ob = new database(); $fileCount = count($_FILES["image"]['name']); for($i=0; $i < $fileCount; $i++) { $r = rand(-1,1234567890); $fileName = $_FILES["image"]["name"][$i]; $ret[$fileName]= $output_dir.$fileName; if (move_uploaded_file($_FILES["image"]["tmp_name"][$i],$output_dir.$r.$fileName )) { $ob->query("INSERT INTO gallery set title='$title', name='".$output_dir.$r.$fileName."'"); } } $iid = mysql_insert_id(); if(!empty($iid)) { echo '<script>alert("'.$fileCount.' Images Upload Successfully.")</script>'; echo '<script>parent.location.assign("gallery.php")</script>'; }else{ echo '<script>alert("Failed.\nTry Again.")</script>'; } } } } } } function add_slider_img() { if(isset($_POST['add_slide_img'])) { //echo $_GET['title']; //require('database.php'); $ob = new database(); $target = 'slider/'; if (!is_dir($target)) { mkdir($target); } $c = count($_FILES['image']['name']); for($i=0; $i<$c; $i++) { $r = rand(0123456789,1234567890); $pic = $target.$r.$_FILES['image']['name'][$i]; $ob->query("INSERT INTO slider SET name='$pic'"); move_uploaded_file($_FILES['image']['tmp_name'][$i], $pic); } $n = mysql_insert_id(); if (!empty($n)) { echo '<script>alert("'.$c.' Images Successfully Uploaded")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.assign("slider.php")</script>'; }else{ echo '<script>alert("Failed.\nTry Again.")</script>'; } } } function add_img() { if(isset($_POST['add_img'])) { //echo $_GET['title']; //require('database.php'); $ob = new database(); $target = 'upload/'; if (!is_dir($target)) { mkdir($target); } $c = count($_FILES['image']['name']); for($i=0; $i<$c; $i++) { $r = rand(0123456789,1234567890); $pic = $target.$r.$_FILES['image']['name'][$i]; $ob->query("INSERT INTO gallery SET title='$_GET[title]', name='$pic'"); move_uploaded_file($_FILES['image']['tmp_name'][$i], $pic); } $n = mysql_insert_id(); if (!empty($n)) { echo '<script>alert("'.$c.' Images Successfully Uploaded")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload()</script>'; }else{ echo '<script>alert("Failed.\nTry Again.")</script>'; } } } function edit_about() { if (isset($_POST['edit_about'])) { //require('database.php'); $title = $_POST['title']; $desc = mysql_real_escape_string($_POST['desc']); $ob = new database(); $ob->query("UPDATE about SET title='$title', description='$desc' where id='$_GET[id]'"); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function add_about() { if (isset($_POST['add_about'])) { //require('database.php'); $title = $_POST['title']; $desc = $_POST['desc']; $ob = new database(); $ob->query("INSERT INTO about SET title='$title', description='$desc'"); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function add_career() { if (isset($_POST['add_career'])) { //require('database.php'); $title = $_POST['title']; $desc = $_POST['desc']; $ob = new database(); $ob->query("INSERT INTO career SET title='$title', description='$desc'"); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function edit_career() { if (isset($_POST['edit_career'])) { //require('database.php'); $title = $_POST['title']; $desc = mysql_real_escape_string($_POST['desc']); $ob = new database(); $ob->query("UPDATE career SET title='$title', description='$desc' where id='$_GET[id]'"); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function add_service() { if (isset($_POST['add_service'])) { //require('database.php'); $title = $_POST['title']; $desc = $_POST['desc']; $ob = new database(); $ob->query("INSERT INTO service SET title='$title', description='$desc'"); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function edit_news() { if (isset($_POST['edit_news'])) { //require('database.php'); $title = $_POST['title']; $desc = mysql_real_escape_string($_POST['desc']); $ob = new database(); $ob->query("UPDATE news SET title='$title', description='$desc' where id='$_GET[id]'"); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function upd_cat() { if(isset($_POST['upd_cat'])) { $imo = $_POST['imo']; $title = $_POST['title']; $id = $_GET['id']; $desc = $_POST['desc']; $ob = new database(); if($_FILES['image']['name']) { $target = 'upload/'; $r = rand(0, 123456789); $pic = $target.$r.$_FILES['image']['name']; $ob->query("SELECT * FROM `category` WHERE id='$id'"); foreach($ob->rows() as $data) { $nn = $data['image']; unlink($nn); } if(move_uploaded_file($_FILES['image']['tmp_name'] , $pic)) { $ob->query("UPDATE `category` SET title='$title', description='$desc', image='$pic' WHERE id='$id'"); echo '<script>alert("Updated Succesfully")</script>'; echo '<script>parent.location.reload()</script>'; } } else { $ob->query("UPDATE `category`SET title='$title',imo='$imo', description='$desc' WHERE id='$id'"); echo '<script>alert("Updated Succesfully")</script>'; echo '<script>parent.location.reload()</script>'; } } } function edit_service() { if (isset($_POST['edit_service'])) { //require('database.php'); $title = $_POST['title']; $desc = mysql_real_escape_string($_POST['desc']); $ob = new database(); $ob->query("UPDATE `service` SET title='$title', description='$desc' where id='$_GET[id]'"); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function edit_address() { if (isset($_POST['edit_address'])) { //require('database.php'); $title = $_POST['title']; $mail = $_POST['mail']; $detail = $_POST['detail']; $desc = $_POST['desc']; $ob = new database(); $ob->query("UPDATE address SET title='$title', description='$desc', mail='$mail', detail='$detail' where id='$_GET[id]'"); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function add_address() { if (isset($_POST['add_address'])) { //require('database.php'); $title = $_POST['title']; $mail = $_POST['mail']; $detail = $_POST['detail']; $desc = $_POST['desc']; $ob = new database(); $ob->query("INSERT INTO address SET title='$title', description='$desc', mail='$mail', detail='$detail' "); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function add_news() { if (isset($_POST['add_news'])) { //require('database.php'); $title = $_POST['title']; $desc = $_POST['desc']; $ob = new database(); $ob->query("INSERT INTO news SET title='$title', description='$desc' "); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function delete_address() { if (isset($_POST['delete_address'])) { //require('database.php'); $title = $_POST['title']; $mail = $_POST['mail']; $detail = $_POST['detail']; $desc = $_POST['desc']; $ob = new database(); $ob->query("DELETE FROM address WHERE title='$title', description='$desc', mail='$mail', detail='$detail' "); echo '<script>alert("Deleted Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function add_page() { if (isset($_POST['add_page'])) { //require('database.php'); $title = $_POST['title']; $desc = mysql_real_escape_string($_POST['desc']); $ob = new database(); $ob->query("INSERT INTO menu SET title='$title', description='$desc'"); echo '<script>alert("Page Added Succesfully.")</script>'; echo '<script>parent.location.assign("view_pages.php");</script>'; } } function edit_page() { if (isset($_POST['edit_page'])) { //require('database.php'); $title = $_POST['title']; $desc = mysql_real_escape_string($_POST['desc']); $ob = new database(); $ob->query("UPDATE menu SET title='$title', description='$desc' where id='$_GET[id]'"); echo '<script>alert("Data Successfully Updated.")</script>'; echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.reload();</script>'; } } function editor() { ?> <script src="ckeditor/ckeditor.js"></script> <script src="ckeditor/adapters/jquery.js"></script> <?php } function add_cat() { if(isset($_POST['add_cat'])) { //$id = $_GET['id']; $name = $_POST['title']; $imo = $_POST['imo']; $cat = $_POST['abc']; $img = $_FILES['image']['name']; $s_desc = $_POST ['s_desc']; $target = 'upload/'; if(!is_dir($target)) { mkdir($target); } $r = rand(0, 123456789); $pic = $target.$r.$img; $cc = explode('.', $cat); $cc[0]; $cc[1]; if($name != null && $cc[1] != 0) { if($cc[0] == "category") { $ob = new database(); $ob->query("SELECT * FROM sub_category WHERE title='$name'"); if($ob->numRows() >= 1) { echo '<script>alert("Title is Already Exist.\n")</script>'; } else { if(move_uploaded_file($_FILES['image']['tmp_name'], $pic)) { $ob->query("INSERT INTO sub_category SET title='$name', imo='$imo', cat_id='$cc[1]', description='$s_desc', image='$pic'"); } $n = mysql_insert_id(); if($n) { echo '<script>alert("Data Added Succesfully.\n")</script>'; //echo '<script>parent.location.assign("category.php")</script>'; } else { echo '<script>alert("Error.\nPlese Try Again.")</script>'; echo '<script>parent.location.assign("category.php")</script>'; } } } if($cc[0] == "sub_category") { $ob = new database(); $ob->query("SELECT * FROM sub_sub_category WHERE title='$name'"); if($ob->numRows() >= 1) { echo '<script>alert("Title is Already Exist.\n")</script>'; } else { if(move_uploaded_file($_FILES['image']['tmp_name'], $pic)) { $ob->query("SELECT * FROM sub_category WHERE id='$cc[1]'"); foreach($ob->rows() as $ss) { $cid = $ss['cat_id']; $ob->query("INSERT INTO sub_sub_category SET title='$name', sub_id='$cc[1]', cat_id='$cid', description='$s_desc', image='$pic'"); } } $n = mysql_insert_id(); if($n) { echo '<script>alert("Data Added Succesfully.\n")</script>'; echo '<script>parent.location.assign("category.php")</script>'; } else { echo '<script>alert("Error.\nPlese Try Again.")</script>'; echo '<script>parent.location.assign("category.php")</script>'; } } } } elseif($name != null && $cc[1] == 0) { $ob = new database(); $ob->query("SELECT * FROM category WHERE title='$name'"); if($ob->numRows() >= 1) { echo '<script>alert("Title is Already Exist.\n")</script>'; } else { if(move_uploaded_file($_FILES['image']['tmp_name'], $pic)) { $ob->query("INSERT INTO category SET title='$name', imo='$imo', description='$s_desc', image='$pic'"); } $n = mysql_insert_id(); if($n) { echo '<script>alert("Data Added Succesfully.\n")</script>'; echo '<script>parent.location.assign("category.php")</script>'; } else { echo '<script>alert("Error.\nPlese Try Again.")</script>'; echo '<script>parent.location.assign("category.php")</script>'; } } } else { if($name == null && $cc[1] == 0) { echo '<script>alert("Name is Missing.\nPlease select any Category")</script>'; echo '<script>parent.location.assign("category.php")</script>'; } elseif($name == null) { echo '<script>alert("Name is Missing.\n")</script>'; echo '<script>parent.location.assign("category.php")</script>'; } } } } function upd_cat02() { if(isset($_POST['upd_cat'])) { $imo = $_POST['imo']; $title = $_POST['title']; $id = $_GET['id']; $desc = $_POST['desc']; $ob = new database(); if($_FILES['image']['name']) { $target = 'upload/'; $r = rand(0, 123456789); $pic = $target.$r.$_FILES['image']['name']; $ob->query("SELECT * FROM `category` WHERE id='$id'"); foreach($ob->rows() as $data) { $nn = $data['image']; unlink($nn); } if(move_uploaded_file($_FILES['image']['tmp_name'] , $pic)) { $ob->query("UPDATE `category` SET title='$title', description='$desc', image='$pic' WHERE id='$id'"); echo '<script>alert("Updated Succesfully")</script>'; echo '<script>parent.location.reload()</script>'; } } else { $ob->query("UPDATE `category`SET title='$title',imo='$imo', description='$desc' WHERE id='$id'"); echo '<script>alert("Updated Succesfully")</script>'; echo '<script>parent.location.reload()</script>'; } } } function upd_subcat() { if(isset($_POST['upd_subcat'])) { $title = $_POST['title']; $id = $_GET['id']; $desc = mysql_real_escape_string($_POST['s_desc']); $ob = new database(); if($_FILES['image']['name']) { $target = 'upload/'; $r = rand(0, 123456789); $pic = $target.$r.$_FILES['image']['name']; $ob->query("SELECT * FROM sub_category WHERE id='$id'"); foreach($ob->rows() as $data) { $nn = $data['image']; unlink($nn); } if(move_uploaded_file($_FILES['image']['tmp_name'] , $pic)) { $ob->query("UPDATE sub_category SET title='$title', description='$desc', image='$pic' WHERE id='$id'"); echo '<script>alert("Updated Succesfully")</script>'; echo '<script>parent.location.reload()</script>'; } } else { $ob->query("UPDATE sub_category SET title='$title', description='$desc' WHERE id='$id'"); echo '<script>alert("Updated Succesfully")</script>'; echo '<script>parent.location.reload()</script>'; } } } function upd_subsubcat() { if(isset($_POST['upd_subsubcat'])) { $title = $_POST['title']; $id = $_GET['id']; $desc = mysql_real_escape_string($_POST['s_desc']); $ob = new database(); if($_FILES['image']['name']) { $target = 'upload/'; $r = rand(0, 123456789); $pic = $target.$r.$_FILES['image']['name']; $ob->query("SELECT * FROM sub_sub_category WHERE id='$id'"); foreach($ob->rows() as $data) { $nn = $data['image']; unlink($nn); } if(move_uploaded_file($_FILES['image']['tmp_name'] , $pic)) { $ob->query("UPDATE sub_sub_category SET title='$title', description='$desc', image='$pic' WHERE id='$id'"); echo '<script>alert("Updated Succesfully")</script>'; echo '<script>parent.location.reload()</script>'; } } else { $ob->query("UPDATE sub_category SET title='$title', description='$desc' WHERE id='$id'"); echo '<script>alert("Updated Succesfully")</script>'; echo '<script>parent.location.reload()</script>'; } } } function add_product() { if(isset($_POST['add_product'])) { $code = $_POST['code']; $title = $_POST['title']; $price = $_POST['price']; $color = count($_POST['color']); $size = $_POST['size']; $type = $_POST['type']; $cat = $_POST['abc']; $tt = explode('.', $cat); $tt[0]; $tt[1]; $s_desc = ($_POST['s_desc']); $l_desc = ($_POST['l_desc']); $ob = new database(); $ob->query("SELECT * FROM product WHERE code='$code'"); if($ob->numRows() >= 1) { echo '<script>alert("Code is Already Exist.\n")</script>'; } else { if($_FILES['image']['name']) { $target = 'upload/'; if(!is_dir($target)) { mkdir($target); } $c = count($_FILES['image']['name']); for($i=0; $i<$c; $i++) { $r = rand(0, 123456789); $pic = $target.$r.$_FILES['image']['name'][$i]; if((move_uploaded_file($_FILES['image']['tmp_name'][$i], $pic))) { $ob = new database(); $ob->query("INSERT INTO product_image SET code='$code', image='$pic'"); //echo '<script>alert("Data Successfully Inserted.")</script>'; //echo '<script>parent.jQuery.fancybox.close()</script>'; //echo '<script>parent.location.reload();</script>'; } } } if($tt[0] == 'category') { if(!empty($color)) { for($i=0; $i<$color; $i++) { $cc = $_POST['color'][$i]; $zz = $_POST['size'][$i]; $rr = $_POST['type'][$i]; $rrr = $_POST['price'][$i]; $ob->query("INSERT INTO product SET cat_id='$tt[1]', code='$code', name='$title', type='$rr', price='$rrr', description='$l_desc', s_desc='$s_desc', color='$cc', size='$zz'"); } } else { $ob->query("INSERT INTO product SET cat_id='$tt[1]', code='$code', name='$title', description='$l_desc', s_desc='$s_desc'"); } $n = mysql_insert_id(); if($n) { echo '<script>alert("Added Succesfully.\n")</script>'; } else { echo '<script>alert("Error.\n")</script>'; } } elseif($tt[0] == 'sub_category') { if(!empty($color)) { for($i=0; $i<$color; $i++) { $cc = $_POST['color'][$i]; $zz = $_POST['size'][$i]; $rr = $_POST['type'][$i]; $rrr = $_POST['price'][$i]; $ob->query("INSERT INTO product SET sub_id='$tt[1]', code='$code', name='$title', type='$rr', price='$rrr', description='$l_desc', s_desc='$s_desc', color='$cc', size='$zz'"); } } else { $ob->query("INSERT INTO product SET sub_id='$tt[1]', code='$code', name='$title', description='$l_desc', s_desc='$s_desc'"); } $n = mysql_insert_id(); if($n) { echo '<script>alert("Product Added Succesfully.\n")</script>'; echo '<script>parent.location.assign("product.php")</script>'; } else { echo '<script>alert("Error.\n")</script>'; } } elseif($tt[0] == 'sub_sub_category') { if(!empty($color)) { for($i=0; $i<$color; $i++) { $cc = $_POST['color'][$i]; $zz = $_POST['size'][$i]; $rr = $_POST['type'][$i]; $rrr = $_POST['price'][$i]; $ob->query("INSERT INTO product SET sub_sub_id='$tt[1]', code='$code', name='$title', type='$rr', price='$rrr', description='$l_desc', s_desc='$s_desc', color='$cc', size='$zz'"); } } else { $ob->query("INSERT INTO product SET sub_sub_id='$tt[1]', code='$code', name='$title', description='$l_desc', s_desc='$s_desc'"); } $n = mysql_insert_id(); if($n) { echo '<script>alert("Added Succesfully.\n")</script>'; } else { echo '<script>alert("Error.\n")</script>'; } } } } } function add_product_image() { if(isset($_POST['add_product_image'])) { $code = $_GET['code']; if($_FILES['image']['name']) { $target = 'upload/'; if(!is_dir($target)) { mkdir($target); } $c = count($_FILES['image']['name']); for($i=0; $i<$c; $i++) { $r = rand(0, 123456789); $pic = $target.$r.$_FILES['image']['name'][$i]; if((move_uploaded_file($_FILES['image']['tmp_name'][$i], $pic))) { $ob = new database(); $ob->query("INSERT INTO product_image SET code='$code', image='$pic'"); echo '<script>alert("Images Successfully Added.")</script>'; //echo '<script>parent.jQuery.fancybox.close()</script>'; echo '<script>parent.location.assign("product.php?code='.$_GET['code'].'");</script>'; } } } } } function upd_product_price() { if(isset($_POST['upd_product_price'])) { //$code = $_POST['code']; $id = $_GET['id']; //$title = $_POST['title']; $type = $_POST['type']; $color = $_POST['color']; $size = $_POST['size']; //$cat = $_POST['abc']; //$s_desc = mysql_real_escape_string($_POST['s_desc']); //$l_desc = mysql_real_escape_string($_POST['l_desc']); $ob = new database(); $ob->query("UPDATE product SET type='$type', color='$color', size='$size' WHERE id='$id'"); echo '<script>alert("Updated Succesfully.\n")</script>'; echo '<script>parent.location.reload()</script>'; } } function upd_product() { if(isset($_POST['upd_product'])) { $code = $_POST['code']; $id = $_GET['id']; $title = $_POST['title']; $price = $_POST['price']; //$type = $_POST['type']; //$cat = $_POST['abc']; $s_desc = mysql_real_escape_string($_POST['s_desc']); $l_desc = mysql_real_escape_string($_POST['l_desc']); $ob = new database(); $ob->query("UPDATE product SET name='$title', description='$l_desc', s_desc='$s_desc', price='$price' WHERE code='$code'"); echo '<script>alert("Updated Succesfully.\n")</script>'; echo '<script>parent.location.reload()</script>'; } } function pass_update() { if(isset($_POST['change'])) { $ob = new database(); $current =($_POST['current']); $new =($_POST['new']); $confirm =($_POST['conf']); if($new == $confirm) { $ob->query("SELECT * FROM admin WHERE password='$current'"); if($ob->numRows() >= 1) { $ob->query("UPDATE admin SET password='$new' WHERE password='$current'"); echo "<script>alert('Password Changed Succesfully')</script>"; } else { echo "<script>alert('Current Password Not Matched')</script>"; } } else { echo "<script>alert('Confirm Password Not Matched')</script>"; } } } ?>