Beispiel #1
0
    //echo $sql;
    if ($conn->query($sql) === TRUE) {
        // echo "New record created successfully";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $num = $_POST['create'];
    // print_r($_POST);
    if (empty($num)) {
        // echo "No amount 1";
    } else {
        $i = 0;
        while ($i < $num) {
            createInfo($fnames, $lnames, $cities, $conn);
            $i += 1;
        }
    }
}
//createInfo($fnames,$lnames,$cities, $conn);
//$conn->close();
?>
	<div class="results">

	<table id="results">
		
	<tr>
		<th>Name</th>
		<th>Gender</th>
		<th>Birthdate</th>
Beispiel #2
0
if (isset($_POST['page'])) {
    $page = $_POST["page"];
    $title = $_POST["title"];
    $content = $_POST["content"];
    $menu = $_POST["menu"];
    $menuorder = (int) $_POST["menuorder"];
    $template = $_POST["template"];
    $pagecontent_id = $_POST["onder"];
    if ($pagecontent_id == 'none') {
        $pagecontent_id = 'NULL';
        $pagecontent_id = mysql_real_escape_string($pagecontent_id);
        $sql = "INSERT INTO `pagecontent`(`page`, `title`, `content`, `menu`, `menuorder`, `template`, `pagecontent_id`) VALUES ('{$page}','{$title}','{$content}','{$menu}','{$menuorder}','{$template}', NULL)";
    } else {
        $sql = "INSERT INTO `pagecontent`(`page`, `title`, `content`, `menu`, `menuorder`, `template`, `pagecontent_id`) VALUES ('{$page}','{$title}','{$content}','{$menu}','{$menuorder}','{$template}','{$pagecontent_id}')";
    }
    createInfo($page, $title, $content, $menu, $menuorder, $template, $pagecontent_id, $sql);
    header("Location: index.php");
}
$db = new mysqli(SERVERNAME, USERNAME, PASSWORD, DBNAME);
$sql2 = "SELECT id, menu FROM pagecontent WHERE pagecontent_id IS NULL";
$menuitem = $db->query($sql2);
$onder = "<option value='none'>None</option>";
$menuitem = $menuitem->fetch_all(MYSQLI_ASSOC);
for ($i = 0; $i < count($menuitem); $i++) {
    $onder .= "<option value='" . $menuitem[$i]['id'] . "'>" . $menuitem[$i]['menu'] . "</option>";
}
$allowed = false;
$allowed = checkCookie();
if ($allowed == true) {
} else {
    header("Location: login.php");