Example #1
0
 if ($org && $org->id()) {
     $launchkeys[org_id] = $org->id();
 } else {
     // Make sure to never get a org with a primary key of -1
     $launchkeys[org_id] = -1;
 }
 $launch->read($launchkeys);
 $launch->setall($launchkeys);
 // Set the foreign keys
 $launch->setall($_REQUEST, '/^launch_/');
 $launchpassword = md5(uniqid(rand(), true));
 if ($launch->id()) {
     $launch->update();
     DPRT("Updated launch={$launch->id}()");
 } else {
     $launch->insert();
     DPRT("Added launch={$launch->id}()");
 }
 // Log this digest
 $reqstr = mysql_real_escape_string(print_r($_REQUEST, TRUE));
 $quer = "insert into lti_digest (created_at, digest, request) values (NOW(), '{$digest}', '{$reqstr}');";
 mysql_query($quer);
 // Time to return a response, we either return a web service
 // response, debug outtput, or redirect back to ourselves
 $theurl = $_SERVER[SCRIPT_URI];
 $theuri = $_SERVER[REQUEST_URI];
 $i = strpos($theuri, '?');
 if ($i > 0) {
     $theurl = $theurl . substr($theuri, $i) . '&';
 } else {
     $theurl = $theurl . '?';
Example #2
0
    }
    if ($key == 0) {
        // image handling
        if (!empty($_FILES['image']['name'])) {
            $image_path = "images/users/" . $_FILES['image']['name'];
            move_uploaded_file($_FILES["image"]["tmp_name"], $image_path);
            $image = $_FILES['image']['name'];
        } else {
            $image = 'default.png';
        }
        // database insertion
        require_once 'database/model.php';
        $mydb = new ORM();
        $mydb->setTable("users");
        $user = array('name' => $_POST["name"], 'email' => $_POST["email"], 'password' => hash("md5", $_POST['password']), 'room_no' => $_POST["room"], 'ext' => $_POST["ext"], 'is_admin' => 0, 'pic' => $image);
        $result = $mydb->insert($user);
        header("Location: Users.php");
    }
}
?>

	    <h1>Add User</h1>
		<form method="post" action="AddUser.php" class="form-horizontal" enctype="multipart/form-data">
			<div class="form-group panel">
				<label class="control-label">Name</label>
				<input required type="name" name="name" class="form-control ">
                <label class="control-label">Email</label>
				<input required type="email" name="email" class="form-control" >
                <label class="control-label">Password</label>
				<input required type="password" name="password" class="form-control">
                <label class="control-label">Confirm Password</label>
Example #3
0
    if ($key == 0) {
        // image handling
        if (!empty($_FILES['image']['name'])) {
            $image_path = "images/products/" . $_FILES['image']['name'];
            move_uploaded_file($_FILES["image"]["tmp_name"], $image_path);
            $image = $_FILES['image']['name'];
        } else {
            $image = 'default.jpg';
        }
        // database insertion
        $selected = $cat_db->select(array('name' => $_POST["category"]));
        $category = $selected->fetch_assoc();
        $prod_db = new ORM();
        $prod_db->setTable("products");
        $product = array('name' => $_POST["product_name"], 'price' => $_POST["price"], 'category_id' => $category[id], 'is_available' => 1, 'pic' => $image);
        $result = $prod_db->insert($product);
        header("Location: Products.php");
    }
}
?>

        <h1>Add Product</h1>
		<form method="post" action="AddProduct.php" class="form-horizontal" enctype="multipart/form-data">
			<div class="form-group panel">
				<label class="control-label">Prduct Name</label>
				<input required type="text" name="product_name" class="form-control"><br>
                <label>Price</label><br>
				<input required type="number" name="price" min="0" class="form-control price" > <span class="desc">EGP</span> <br>
                <label class="control-label">Category</label><br>
				<select class="form-control category" name="category">
					<option disabled selected hidden>Category</option>
Example #4
0
	<div class="container" id="wrapper">
		<?php 
require_once 'database/model.php';
if ($_POST) {
    $key = 0;
    if (empty($_POST["category_name"])) {
        echo "<h4 class='alert-danger'> Category name is required</h4>";
        $key = 1;
    }
    if ($key == 0) {
        // database insertion
        $cat_db = new ORM();
        $cat_db->setTable("categories");
        $category = array('name' => $_POST["category_name"]);
        $result = $cat_db->insert($category);
        header("Location: Products.php");
    }
}
?>

        <h1>Add Category</h1>
		<form method="post" action="AddCategory.php" class="form-horizontal" enctype="multipart/form-data">
			<div class="form-group">
				<label class="control-label">Category Name</label>
				<input required type="text" name="category_name" class="form-control"><br>

				<button type="submit" value="Submit" class="btn btn-info">Submit</button>
  			</div>
		</form>
	</div>