Beispiel #1
0
<html>
<?php 
include 'header.php';
?>
<body>
<form method="post" action="add_customer.php">
	Name: <input type="text" name="name" value="" required><br>
	Surname: <input type="text" name="surname" value="" required><br>
	Contact: <input type="text" name="contact_number" value="" required><br>
	E-mail: <input type="text" name="email" value="" required><br>
	RSA ID: <input type="text" name="sa_id_number" value=""><br>
	Address: <input type="text" name="address" value="" required><br>
	<input type="submit">
</form>

<?php 
$dbconn = new mysql_database();
if (!empty($_POST)) {
    $name = $_POST["name"];
    $surname = $_POST["surname"];
    $contact_number = $_POST["contact_number"];
    $email = $_POST["email"];
    $sa_id_number = $_POST["sa_id_number"];
    $address = $_POST["address"];
    $sql = "INSERT INTO customer (name, surname, contact_number, email, sa_id_number, address) \n\t\tvalues ('" . $name . "', '" . $surname . "', '" . $contact_number . "', '" . $email . "', '" . $sa_id_number . "', '" . $address . "')";
    $result = $dbconn->insert($sql);
    echo $result;
}
?>
    <form action="customer.php" method="post"><input type="submit" value="Return"></form>
</body>
Beispiel #2
0
?>

</td></tr>
</table>

<form method="post" action="add_order.php">
	<label>Add new Order</label><br>
	Customer ID: <input type="text" name="customer_id" value="" required><br>
	DVD ID: <input type="text" name="dvd" value="" required><br>
	<input type="submit">
</form>


<!-- need to add an dvd_order for every dvd added-->
<?php 
$dbconn = new mysql_database();
if (!empty($_POST)) {
    //print_r($_POST);
    $customer_id = $_POST["customer_id"];
    $dvd_id_array = $_POST["dvd"];
    $sql = "INSERT INTO orders (customer_id, rent_date, due_date, actual_return_date) \n\t\tvalues ('" . $customer_id . "', curdate(), adddate(curdate(),2) , '' )";
    $result = $dbconn->insert_order($sql);
    $dvd_id_array = explode(",", $dvd_id_array);
    foreach ($dvd_id_array as $key => $dvd_id) {
        $sql = "insert into dvd_orders (dvd_id, order_id) values ('" . $dvd_id . "', '" . $result . "')";
        $result = $dbconn->insert_order($sql);
    }
}
?>
    <form action="order.php" method="post"><input type="submit" value="Return"></form>
</body>
Beispiel #3
0
<html>
    <?php 
include 'header.php';
?>
<body>
<?php 
$dbconn = new mysql_database();
if (!empty($_GET)) {
    $ID = $_GET["order_id"];
    $sql = "DELETE FROM orders WHERE orders_ID=" . $ID . "";
    $result = $dbconn->delete_order($sql);
    echo $result;
}
?>

<form action="order.php" method="post"><input type="submit" value="Return"></form>
</body>
</html>
Beispiel #4
0
<html>
<?php 
include 'header.php';
?>
<body>
<table>
	<tr><td>ID</td> 
	<td>Name</td> 
	<td>Description</td>
	<td>Release Date</td>
	<td>Category name</td></tr>

<?php 
$dbconn = new mysql_database();
$result = $dbconn->fetch("select * from dvd inner join category on category.Category_ID=dvd.category_id");
if ($result->num_rows > 0) {
    // output data of each row
    while ($row = $result->fetch_assoc()) {
        echo "<tr>" . "<td>" . $row["ID"] . "</td>" . "<td>" . $row["name"] . "</td>" . "<td>" . $row["description"] . "</td>" . "<td>" . $row["release_date"] . "</td>" . "<td>" . $row["category_name"] . "</td>" . "<td><form action=edit_dvd.php?ID='" . $row["ID"] . "' method='post'><input type='submit' value=edit></form></td>" . "<td><form action=delete_dvd.php?dvd_id='" . $row["ID"] . "' method='post'><input type='submit' value='delete'></form></td>";
    }
}
?>

</td></tr>
</table>

<form action="add_dvd.php" method="post"><input type="submit" value="Add DVD"></form>

</body>
</html>
<?php

include_once 'mysql_database.php';
$title = isset($_POST['title']) ? $_POST['title'] : '';
$author = isset($_POST['author']) ? $_POST['author'] : '';
$statement = isset($_POST['statement']) ? $_POST['statement'] : '';
$explanation = isset($_POST['explanation']) ? $_POST['explanation'] : '';
$solution_code = isset($_POST['solution_code']) ? $_POST['solution_code'] : '';
$category = isset($_POST['category']) ? $_POST['category'] : '';
$title = htmlspecialchars($title);
$author = htmlspecialchars($author);
$statement = htmlspecialchars($statement);
$explanation = htmlspecialchars($explanation);
$solution_code = htmlspecialchars($solution_code);
$category = htmlspecialchars($category);
$mysql = new mysql_database();
$mysql->connect_mysql();
$mysql->insert_table_solved_problems_mysql($title, $author, $statement, $explanation, $solution_code, $category);
$mysql->disconnect_mysql();
Beispiel #6
0
<html>
<?php 
include 'header.php';
?>
    
<?php 
$dbconn = new mysql_database();
if (!empty($_POST) && !empty($_GET)) {
    $ID = $_GET["ID"];
    $name = $_POST["name"];
    $surname = $_POST["surname"];
    $contact_number = $_POST["contact_number"];
    $email = $_POST["email"];
    $sa_id_number = $_POST["sa_id_number"];
    $address = $_POST["address"];
    $sql = "UPDATE customer SET name='" . $name . "', surname='" . $surname . "', contact_number='" . $contact_number . "', email='" . $email . "', sa_id_number='" . $sa_id_number . "', address='" . $address . "' WHERE id='" . $ID . "'";
    $result = $dbconn->update($sql);
    echo $result;
}
?>
        <form action="customer.php" method="post"><input type="submit" value="Return"></form>
    </body>
 </html>
Beispiel #7
0
    $dbconn = new mysql_database();
    $result = $dbconn->fetch("select * from orders where orders_ID=" . $id . "");
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_assoc()) {
            echo '<form method="post" action="edit_order.php?order_id=' . $row["orders_ID"] . '">
					Rental Date: <input type="text" name="rent_date" value="' . $row["rent_date"] . '" required><br>
					Due Date: <input type="text" name="due_date" value="' . $row["due_date"] . '" required><br>
					Return Date: <input type="text" name="actual_return_date" value="' . $row["actual_return_date"] . '" required><br>
					Customer ID: <input type="text" name="customer_id" value="' . $row["customer_id"] . '" required><br>
					<input type="submit">
					</form>';
        }
    }
} else {
    //echo "<p>not clicked";
}
$dbconn = new mysql_database();
if (!empty($_POST) && !empty($_GET)) {
    $orders_ID = $_GET["order_id"];
    $rent_date = $_POST["rent_date"];
    $due_date = $_POST["due_date"];
    $actual_return_date = $_POST["actual_return_date"];
    $customer_id = $_POST["customer_id"];
    $sql = "UPDATE orders SET rent_date='" . $rent_date . "', due_date='" . $due_date . "', due_date='" . $due_date . "', actual_return_date='" . $actual_return_date . "' WHERE orders_ID='" . $orders_ID . "'";
    $result = $dbconn->update_order($sql);
    echo $result;
}
?>
    <form action="order.php" method="post"><input type="submit" value="Return"></form>
</body>
</html>
Beispiel #8
0
<html>
<?php 
include 'header.php';
?>
<body>
<?php 
if (!empty($_GET)) {
    $ID = $_GET["ID"];
    $dbconn = new mysql_database();
    $id = octdec($ID);
    $result = $dbconn->fetch("SELECT * FROM dvd where ID={$id}");
    if ($result->num_rows > 0) {
        while ($row = $result->fetch_assoc()) {
            echo '<form method="post" action="edit_dvd.php?ID=' . $row["ID"] . '">
                Name: <input type="text" name="name" value="' . $row["name"] . '" required><br>
                Description: <textarea name="description" value required>"' . $row["description"] . '"</textarea><br>
                Release Date: <input type="text" name="release_date" value="' . $row["release_date"] . '" required><br>
                Category ID: <input type="text" name="category_id" value="' . $row["category_id"] . '" required><br>
                <input type="submit">
                </form>';
        }
    }
} else {
    //echo "<p>not clicked";
}
if (!empty($_POST) && !empty($_GET)) {
    $ID = $_GET["ID"];
    $name = $_POST["name"];
    $description = $_POST["description"];
    $release_date = $_POST["release_date"];
    $category_id = $_POST["category_id"];
<?php

include_once 'mysql_database.php';
$category = isset($_GET['category']) ? $_GET['category'] : '';
$mysql = new mysql_database();
$mysql->connect_mysql();
$mysql->show_solved_problems($category);
$mysql->disconnect_mysql();
Beispiel #10
0
require_once $base['dir'] . 'data/config.php';
require_once $base['dir'] . 'source/core.func.php';
require_once $base['dir'] . 'source/mysqldb.class.php';
$base['post'] = paddslashes($_POST);
$base['get'] = paddslashes($_GET);
$base['cookie'] = paddslashes($_COOKIE);
unset($_POST);
unset($_GET);
unset($_COOKIE);
$langset = $base['cookie']['lang'] ? $base['cookie']['lang'] : $config['lang'];
require_once $base['dir'] . 'lang/langset.php';
$langset = in_array($langset, array_keys($all_lang)) ? $langset : $base['cookie']['lang'];
require_once $base['dir'] . 'lang/' . $langset . '/all.lang.php';
$base['lang'] = $lang;
unset($lang);
$base['config'] = $config;
unset($config);
$db = new mysql_database();
if (!$db->connect($base['config']['db'])) {
    error_report($base['lang']['db_connect_error']);
}
if ($base['get']['mod'] == '') {
    $base['get']['mod'] = 'index';
}
if (!empty($_FILES)) {
    $base['get']['mod'] = 'upload';
}
if (!in_array($base['get']['mod'], array('index', 'upload', 'show', 'admin'))) {
    error_report(str_replace('\\1', '<code>' . htmlspecialchars($base['get']['mod']) . '</code>', $base['lang']['mod_not_found']));
}
require_once $base['dir'] . 'source/' . $base['get']['mod'] . '.mod.php';
Beispiel #11
0
<html>
<?php 
include 'header.php';
?>
<body>
<form method="post" action="add_dvd.php">
	<label>Add new DVD</label><br>
	Name: <input type="text" name="name" value="" required><br>
	Description: <textarea name="description" value="" required></textarea><br>
	Release Date: <input type="text" name="release_date" value="" required><br>
	Category ID: <input type="text" name="category_id" value="" required><br>
	<input type="submit">
</form>

<?php 
$dbconn = new mysql_database();
if (!empty($_POST)) {
    $name = $_POST["name"];
    $description = $_POST["description"];
    $release_date = $_POST["release_date"];
    $category_id = $_POST["category_id"];
    $sql = "INSERT INTO dvd (name, description, release_date, category_id) \n           values ('" . $name . "', '{$description}', '" . $release_date . "', '" . $category_id . "')";
    $result = $dbconn->insert_dvd($sql);
    echo $result;
}
?>
        <form action="dvd.php" method="post"><input type="submit" value="Return"></form>
    </body>
</html>
Beispiel #12
0
<?php

include_once 'mysql_database.php';
include_once 'short_url.php';
$db = new mysql_database();
$url = new short_url();
$user_short_url = isset($_GET['short_code']) ? $_GET['short_code'] : '';
//take the $short_code from the url using the .htaccess file
$db->connect();
$url->selectUrl($user_short_url);
$db->close();
Beispiel #13
0
<?php 
include 'header.php';
?>
<body>

<form action="add_order.php" method="post"><input type="submit" value="Add order"></form>

<table>
	<tr><td>Order ID</td>
    <td>Customer ID</td> 
	<td>Rental Date</td>
    <td>Return Date</td>
	<td>Actions</td></tr>

<?php 
$dbconn = new mysql_database();
$result = $dbconn->fetch("SELECT * FROM orders INNER JOIN customer on customer.ID=orders.customer_id ORDER BY orders_ID DESC");
if ($result->num_rows > 0) {
    // output data of each row
    while ($row = $result->fetch_assoc()) {
        echo "<tr>" . "<td>" . $row["orders_ID"] . "</td>" . "<td>" . $row["ID"] . "</td>" . "<td>" . $row["rent_date"] . "</td>" . "<td>" . $row["actual_return_date"] . "</td>" . "<td><form action='edit_order.php?order_id=" . $row["orders_ID"] . "' method='post'><input type='submit' value='edit'></form></td>" . "<td><form action='delete_order.php?order_id=" . $row["orders_ID"] . "' method='post'><input type='submit' value='delete'></form></td>";
    }
}
?>

</td></tr>
</table>



</body>
Beispiel #14
0
        echo $row["category_name"];
        ?>
</td> 
        <td><?php 
        echo $row["Category_ID"];
        ?>
</td>
        <td><form action="delete_category.php?ID=<?php 
        echo $row["Category_ID"];
        ?>
" method="post"><input type="submit" value="delete"></form></td></tr>
    <?php 
    }
}
?>
<form method="post">
    Category name: <input type="text" name="name" value="" required><br>
    <input type="submit">
</form>

<?php 
$dbconn = new mysql_database();
if (!empty($_POST)) {
    $name = $_POST["name"];
    $sql = "INSERT INTO category (category_name) values ('" . $name . "')";
    $result = $dbconn->insert_category($sql);
    echo $result;
}
?>
    <form action="index.php" method="post"><input type="submit" value="Return"></form>
</body>
Beispiel #15
0
<html>
<?php 
include 'header.php';
?>
    
<body
<?php 
$dbconn = new mysql_database();
if (!empty($_GET)) {
    $ID = $_GET["ID"];
    echo $ID;
    $sql = 'DELETE FROM customer WHERE ID=' . $ID . '';
    $result = $dbconn->delete($sql);
    echo $result;
}
?>
<form action="customer.php" method="post"><input type="submit" value="Return"></form>
</body>
</html>
Beispiel #16
0
<html>
    <?php 
include 'header.php';
?>
<body>
<?php 
$dbconn = new mysql_database();
if (!empty($_GET)) {
    $ID = $_GET["dvd_id"];
    $sql = 'DELETE FROM dvd WHERE ID=' . $ID . '';
    $result = $dbconn->delete_dvd($sql);
    echo $result;
}
?>

<form action="dvd.php" method="post"><input type="submit" value="Return"></form>
</body>
</html>
<?php

include_once 'mysql_database.php';
$category = isset($_GET['category']) ? $_GET['category'] : '';
$title = isset($_GET['title']) ? $_GET['title'] : '';
$mysql = new mysql_database();
$mysql->connect_mysql();
$mysql->show_solution_problem($category, $title);
$mysql->disconnect_mysql();
Beispiel #18
0
<html>
<?php 
include 'header.php';
?>
<body>
<table>
	<tr><td>ID</td> 
	<td>Name</td> 
	<td>Surname</td>
	<td>Contact Number</td>
	<td>Email</td>
	<td>SA ID Number</td>
	<td>Address</td>
	<td>Actions</td></tr>
<?php 
$dbconn = new mysql_database();
$result = $dbconn->fetch("select * from customer");
if ($result->num_rows > 0) {
    while ($row = $result->fetch_assoc()) {
        ?>
        <tr><td><?php 
        echo $row["ID"];
        ?>
</td> 
        <td><?php 
        echo $row["name"];
        ?>
</td> 
        <td><?php 
        echo $row["surname"];
        ?>