public function __construct() { $servername = "localhost"; $username = "******"; $password = "******"; $dbname = "ecommerce"; if (is_null(self::$conn)) { self::$conn = mysqli_connect('localhost', 'root', 'iti', 'ecommerce'); } }
function __construct($id = -1) { if (self::$conn == Null) { self::$conn = mysqli_connect('localhost', 'root', 'iti', 'babyshop'); } if ($id != -1) { $query = "select * from subType where id={$id} limit 1"; $result = mysqli_query(self::$conn, $query); $cat = mysqli_fetch_assoc($result); $this->id = $cat['id']; $this->name = $cat['name']; } }
function display_rentorhire_category() { $subcategory = new subcategory("rentorhire_category"); $category = $subcategory->getcategory(); if (is_array($category)) { echo '<table cellspacing="4" class="sub_categories" width="100%">'; echo '<tr>'; $countTd = 0; foreach ($category as $row) { if ($countTd % 4 == 0 && $countTd > 1) { echo "</tr><tr>"; } $countTd++; echo '<td class="whiteBg"><div><div><a href="' . $_SERVER['PHP_SELF'] . '?rentorhire_seo_url=' . $row['seo_url'] . '&seo_url=' . $_GET['seo_url'] . '" style="text-decoration:none;">'; echo $row['name'] . " "; echo "<font color='green'>"; $sql = "select * from `rentorhire`,`rentorhire_category`,`sub_maincategory` \r\n\t\t\t\t\twhere \r\n\t\t\t\t\tsub_maincategory.id = rentorhire.sub_maincategory_id and \r\n\t\t\t\t\trentorhire.product_category = rentorhire_category.id and\r\n\t\t\t\t\trentorhire_category.seo_url='" . $row['seo_url'] . "' and\r\n\t\t\t\t\tsub_maincategory.seo_url='" . $_GET['seo_url'] . "'"; // echo $sql; $getresults = $this->mysql->getdata($sql); $num = $this->mysql->num; if ($num == "") { $num = 0; } echo $num; echo "</font>"; echo '</a></div></div></td>'; if ($countTd % 4 != 0) { echo '<td width="20"></td>'; } } echo '</tr>'; echo '</table>'; } else { echo "No Sub Category Found!"; } }
protected function showForm($mode, $category_id, $id = null) { $category = Category::find($category_id); if (count($category) > 0) { if ($id) { if (!($subcategory = subcategory::find($id))) { return Redirect()->to('subcategory'); } } else { $subcategory = ''; } return View('user.subcategories.form', compact('mode', 'category', 'subcategory')); } else { return Redirect()->back()->withErrors(trans('validation.categoryid-problem')); } }
<?php include "header.php"; require_once "../common/class/mysql.class.php"; require_once "../common/class/rentorhire.class.php"; require_once "../common/class/category.class.php"; require_once "../common/class/sub_rentorhire.class.php"; require_once "../common/class/user.class.php"; $category = new subcategory("sub_maincategory"); $sub_rentorhire = new sub_rentorhire(); ?> <style> .grey { font-weight:bold; color:#FFFFFF; } </style><script src="/js/checkall.js"></script> <script language="javascript"> var checkBoxArr; function deleterentorhire() { checkBoxArr = getSelectedCheckboxValue(document.listjob.checkdel); if (checkBoxArr.length == 0) { alert("No Users Selected"); return false; }
if (checkBoxArr.length == 0) { alert("No Users Selected"); return false; } var arv = checkBoxArr.toString(); document.getElementById('selectcheck').value=arv; return confirm("Are You Sure ?"); } </script> <?php $category = new subcategory($_GET['type']); if ($_GET['wtdo'] == 'add_category' && $_POST['category'] != "") { $add = $category->add_category($_POST['category']); } if ($_GET['wtdo'] == 'edit_category' && $_POST['category'] != "") { $add = $category->edit_category($_POST['category'], $_GET['id']); } switch ($_GET['type']) { case "maincategory": $message = "Categories"; break; case "projects_category": $message = "projects category"; break; case "rentorhire_category": $message = "Rent or Hire category";
<?php include "header.php"; require_once "../common/class/category.class.php"; $category_class = new subcategory("sub_maincategory"); $sub_category = $category_class->get_category_by_id($_GET['id']); $category_class = new subcategory("maincategory"); $get_category = $category_class->getcategory(); ?> <table align="center" width="100%"> <tr align="center"> <td align="center" bgcolor="#66CCFF">Edit Sub Category</td> </tr> </table> <form name="frmaddcategory" action="sub_category_management.php?wtdo=edit_category&id=<?php echo $_GET['id']; ?> " method="post" onSubmit="if(validateForm(this)) return true; else return false;"> <div class="formRow" align="center"> <span class="fieldName"><label for="tags"><strong>Sub Category Name</strong></label></span> <span class="fieldVal"><input type="text" id="subcategory" name="subcategory" value="<?php echo $sub_category['name']; ?> " class="vldnoblank textWidth" /> <span class="checkStatus"></span> </span> </div> <div class="formRow" align="center">
alert("No Users Selected"); return false; } var arv = checkBoxArr.toString(); document.getElementById('selectcheck').value=arv; return confirm("Are You Sure ?"); } </script> <?php $mysql = new mysql(); $common = new common(); $category = new subcategory("sub_maincategory"); $table = "sub_category"; if ($_GET['wtdo'] == 'add_category' && $_POST['category'] != "") { echo $add = $category->add_sub_category($_POST['subcategory'], $_POST['markbold'], $_POST['category']); } if ($_GET['wtdo'] == 'edit_category' && $_POST['category'] != "") { echo $add = $category->edit_sub_category($_POST['subcategory'], $_GET['id'], $_POST['markbold'], $_POST['category']); } ?> <table align="left" width="100%" style="font-family:Arial, Helvetica, sans-serif; font-weight:bold; color:#FFFFFF; font-size:16px;"> <tr><td colspan="6" align="center" valign="middle"> <table align="center" > <tr>
<?php include '../subcategory.php'; $subcategoryAction = new subcategory(); $catName = $_POST['scat']; $subcategoryAction->removeCategory($catName); header("location:removesubcategory.html");
<?php include "header.php"; require_once "../common/class/category.class.php"; $category = new subcategory($_GET['type']); $name = $category->getbyid($_GET['id']); ?> <table align="center" width="100%"> <tr align="center"> <td align="center" bgcolor="#66CCFF">Edit Category</td> </tr> </table> <form name="frmaddcategory" action="category_management.php?wtdo=edit_category&id=<?php echo $_GET['id']; ?> &type=<?php echo $_GET['type']; ?> " method="post" onSubmit="if(validateForm(this)) return true; else return false;"> <div class="formRow" align="center"> <span class="fieldName"><label for="tags"><strong>Category Name</strong></label></span> <span class="fieldVal"><input type="text" id="category" name="category" value="<?php echo $name; ?> " class="vldnoblank textWidth" /> <span class="checkStatus"></span> </span> </div>
<div class="panel-heading"> <h3 class="panel-title">Categories</h3> </div> <div class="panel-body"> <ul class="nav nav-pills nav-stacked category-menu"> <?php include "../category.php"; include "../sub-category.php"; ?> <?php $cat = new category(); $data = $cat->getallcategory(); $sub = new subcategory(); for ($i = 0; $i < count($data); $i++) { ?> <li> <a href="category.php?cat_id=<?php echo $data[$i]['category_id']; ?> "><?php echo $data[$i]['category_name']; ?> <span class="badge pull-right">42</span></a> <ul> <?php $subdata = $sub->getsubbycat($data[$i]['category_id']); for ($j = 0; $j < count($subdata); $j++) { ?>
$statelist = $objservice->getstatelist(); foreach ($statelist as $data) { echo "<option value='" . $data['id'] . "'"; if ($data['id'] == $service['subcategory']) { echo "selected='selected'"; } echo ">" . $data['name'] . "</option>"; } ?> </select><span class="checkStatus"></span> </td> </tr> <tr> <th><label for="jobtype">Service Category</label></th> <td><?php $objservicetype = new subcategory("services_category"); $jobservice = $objservicetype->getcategory(); echo "<select class='jobtype' id='servicecategory' name=\"servicecategory\">"; foreach ($jobservice as $data) { echo "<option value='" . $data['id'] . "'"; if ($service['service_category'] == $data['id']) { echo "selected='selected'"; } echo ">" . $data['name'] . "</option>"; //$str.="checkboxarray.push('chk_".$data['id']."');\n"; } echo "</select>"; ?> <span class="checkStatus"></span> </td> </tr>
<?php include 'subcategoryclass.php'; if (isset($_GET['id']) && is_numeric($_GET['id'])) { // get the 'id' variable from the URL $id = $_GET['id']; $scateg = new subcategory(); $scateg->delete($id); header("location:addSubcategory.php"); } else { header("location:addSubcategory.php"); }
<?php include '../subcategory.php'; $subcategoryAction = new subcategory(); $catID = $_POST['cat']; $subcategoryAction->addSubCategory($catID); // header("location:addsubcategory.php");
<?php include "header.php"; require_once "../common/class/category.class.php"; $delete_category = new subcategory($_GET['type']); if ($_GET['action'] == "delete" && $_GET['id'] == "") { $midarray = explode(",", $_POST['selectcheck']); foreach ($midarray as $w) { $delete_category->deletecategory($w, $table); } echo "<script>alert('Category Deleted ...'); window.location='category_management.php?type=" . $_GET['type'] . "';</script>"; } else { $delete_category->deletecategory($_GET['id'], $table); echo "<script>alert('Category Deleted ...'); window.location='category_management.php?type=" . $_GET['type'] . "';</script>"; } ?>
<?php include 'subcategoryclass.php'; $categ = new subcategory(); if (isset($_POST['save'])) { if (!empty(trim($_POST['scatname']))) { $scat_id = $_POST['scat_id']; $categ->name = $_POST['scatname']; $categ->update($scat_id); header("location:addSubcategory.php"); } else { header("location:addSubcategory.php"); } }
<?php include '../subcategory.php'; $subcategoryAction = new subcategory(); $nsc = $_POST['scat']; $subcategoryAction->editSubCategory($nsc); header("location:editsubcategory.html");
<?php include 'Aheader.php'; ?> <form enctype="multipart/form-data" action="addProduct.php" method="post"> <div id="inside"> <table width="500px" align="center"> <tr> <th>subcategory name</th> <td><select name="scatname"> <?php include 'subcategoryclass.php'; $scat = new subcategory(); $c = $scat->subcategory(); foreach ($c as $key => $value) { $scat_id = $value['id']; $name = $value['name']; echo "<option value='{$scat_id}'>{$name}</option> "; } ?> </select></td> </tr> <tr> <th>product name</th> <td><input type="text" name="pname"/></td> </tr> <tr> <th>description</th> <td><input type="text" name="desc"/></td> </tr> <tr>
<?php include "header.php"; require_once "../common/class/category.class.php"; $category_class = new subcategory("maincategory"); $get_category = $category_class->getcategory_admin(); ?> <table align="center" width="100%"> <tr align="center"> <td align="center" bgcolor="#66CCFF">Add Sub Category</td> </tr> </table> <form name="frmaddcategory" action="sub_category_management.php?wtdo=add_category" method="post" onSubmit="if(validateForm(this)) return true; else return false;"> <div class="formRow" align="center"> <span class="fieldName"><label for="tags"><strong>Sub Category Name</strong></label></span> <span class="fieldVal"><input type="text" id="subcategory" name="subcategory" class="vldnoblank textWidth" /> <span class="checkStatus"></span> </span> </div> <div class="formRow" align="center"> <span class="fieldName"><label for="tags"><strong>Select Category</strong></label></span> <span class="fieldVal"> <select name="category" id="category" class="vldnoblank bigTextBox" errormessage="Please select a valid Category"> <option value="" selected="selected">Select Category</option> <?php foreach ($get_category as $category) { echo '<option value="' . $category['id'] . '" >' . $category['name'] . '</option>'; }
<?php include "header.php"; require_once "../common/class/category.class.php"; $delete_category = new subcategory("sub_maincategory"); if ($_GET['action'] == "delete" && $_GET['id'] == "") { $midarray = explode(",", $_POST['selectcheck']); foreach ($midarray as $w) { $delete_category->deleteSubCategory($w); } //disconnect_db($cn); echo "<script>alert('Category Deleted ...'); window.location='sub_category_management.php';</script>"; } else { $delete_category->deleteSubCategory($_GET['id']); echo "<script>alert('Category Deleted ...'); window.location='sub_category_management.php';</script>"; } ?>
<legend>User Data</legend> User name: <input type="text" name="username"/><br/><br/><br/> Password: <input type="password" name="password"/><br/><br/><br/> Email: <input type="text" name="email"/><br/><br/><br/> Birthday: <input type="text" name="birth"/><br/><br/><br/> Job: <input type="text" name="job"/><br/><br/><br/> Admin: <input type="radio" name="admin" value="1"/> User: <input type="radio" name="admin" value="0"/><br/><br/><br/> Credit limit: <input type="text" name="credit"/><br/><br/><br/> Address: <textarea cols="30" name="address"></textarea><br/><br/><br/> Add user interests:<br/> <?php //display category in html select element include '../subcategory.php'; $data = []; $subcatAction = new subcategory(); $result = $subcatAction->getSubCategory(); while ($row = mysqli_fetch_array($result)) { $data[] = $row; } foreach ($data as $key => $value) { ?> <input type="checkbox" name="interset[]" value="<?php echo $value[2]; ?> "/> <?php echo $value[2]; ?> <br/> <?php }
<?php include 'header1.php'; include 'subcategoryclass.php'; $subcateg = new subcategory(); $c = $subcateg->subcategory(); ?> <div id="inside"> <table class="table table-bordered table-hover table-striped table-responsive"> <?php foreach ($c as $key => $value) { $name = $value['name']; ?> <tr > <td><?php echo $name; ?> </td> <td><a href="editSubcategory.php?id=<?php echo $value['id']; ?> ">edit</a></td> <td><a href="removeSubcategory.php?id=<?php echo $value['id']; ?> ">delete</a></td> </tr> <?php }
} if (empty(trim($_GET['desc']))) { $errors[] = "the desc is empty"; $_SESSION['errors'] = $errors; } if (empty($errors)) { $sub_category->sub_cat_name = $_GET['name']; $sub_category->sub_cat_desc = $_GET['desc']; $sub_category->cat_id = $_GET['cat']; $sub_category->insert(); } $data = $sub_category->getallsubcategory(); $response1 = []; $response1[] = $data; $response1[] = $errors; $jsondata = json_encode($response1); echo $jsondata; // $sub_category = new subcategory(); // $sub_category->sub_cat_name = $_GET['name']; // $sub_category->sub_cat_desc = $_GET['desc']; // $sub_category->sub_cat_id = $_GET['cat']; // $sub_category->insert(); // $data = $sub_category->getallsubcategory(); // $jsondata = json_encode($data); // echo $jsondata; } else { $cat = new subcategory(); $jsondata = json_encode($cat->getallsubcategory()); echo $jsondata; } }
<?php include 'category.php'; include 'sub-category.php'; if (isset($_GET['cat'])) { $subcat = new subcategory(); $jsondata = json_encode($subcat->getsubbycat($_GET['cat'])); echo $jsondata; } else { $cat = new category(); $jsondata = json_encode($cat->getallcategory()); echo $jsondata; }