예제 #1
0
function addAppearance($s, $p, $d, $f)
{
    $q = sprintf("INSERT INTO appearances (showfk,peoplefk,dt) VALUES (%d,%d,STR_TO_DATE('%s', '%s')) ON DUPLICATE KEY UPDATE appearpk=LAST_INSERT_ID(appearpk)", $s, $p, $d, $f);
    $result = $GLOBALS[conn]->query($q);
    $appid = $GLOBALS[conn]->insert_id;
    return $appid;
}
function cleanString($text)
{
    $utf8 = array('/[áàâãªä]/u' => 'a', '/[ÁÀÂÃÄ]/u' => 'A', '/[ÍÌÎÏ]/u' => 'I', '/[íìîï]/u' => 'i', '/[éèêë]/u' => 'e', '/[ÉÈÊË]/u' => 'E', '/[óòôõºö]/u' => 'o', '/[ÓÒÔÕÖ]/u' => 'O', '/[úùûü]/u' => 'u', '/[ÚÙÛÜ]/u' => 'U', '/ç/' => 'c', '/Ç/' => 'C', '/ñ/' => 'n', '/Ñ/' => 'N', '/–/' => '-', '/[’‘‹›‚]/u' => ' ', '/[“”«»„]/u' => ' ', '/ /' => ' ');
    return preg_replace(array_keys($utf8), array_values($utf8), $text);
}
foreach ($lines as $lnum => $l) {
    echo "<hr>processing {$lnum} ...<br>";
    $p = explode("|", $l);
    $person = addPerson(addslashes($p[0]));
    echo "person is {$person} <br>";
    if (!$person) {
        continue;
    }
    $show = addShow(addslashes($p[5]));
    echo "show is {$show} <br>";
    if (!$show) {
        continue;
    }
    $date = $p[2];
    $dateformat = "%m/%d/%Y";
    $appearance = addAppearance($show, $person, $date, $dateformat);
    echo "appearance is {$appearance} <br>";
    if (!$appearance) {
        continue;
예제 #2
0
<?php

include 'adminheader.php';
print '<div id="formdiv">';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    print '<div class="msg" style="width: 90%">';
    if (isset($_POST['addPerson'])) {
        addPerson();
    }
    if (isset($_POST['delete'])) {
        delete('users', 'user_id', 'f_name');
    }
    print '</div><div style="clear: both"></div>';
}
$user = getAll();
print '<h1>redigera teamet</h1>';
if (!empty($user)) {
    foreach ($user as $user) {
        print '<div class="block">';
        print '<div class="delete">';
        print '<form method="post">
						<input type="hidden" name="id" value="' . $user['user_id'] . '">
						<input type="hidden" name="name" value="' . $user['f_name'] . '">
						<input type="submit" name="delete" value="Radera" class="button del_button">
					</form>';
        print '</div>';
        print '<h2>redigera ' . mb_strtolower($user['f_name'], 'UTF-8') . '</h2>';
        print '<form method="post" enctype="multipart/form-data" action="edituser.php">
					<input type="hidden" name="update" value="update">
					<input type="hidden" name="user_id" value="' . $user['user_id'] . '">
예제 #3
0
 } elseif ($_POST["sub"] == 2) {
     # couldn't record
     $message = "NOT Recorded!";
     $message_type = "error";
     $destination = "mainpage";
 } elseif ($_POST["sub"] == 3 && deactivateTarget($_POST["targetid"])) {
     # deactivated
     $message = "Deactivated OK!";
     $message_type = "success";
     $destination = "edit";
 } elseif ($_POST["sub"] == 3) {
     # couldn't deactivate
     $message = "NOT Deactivated!";
     $message_type = "error";
     $destination = "edit";
 } elseif ($_POST["sub"] == 4 && addPerson($_POST["name"])) {
     # added
     $message = "Added OK!";
     $message_type = "success";
     $destination = "edit";
 } elseif ($_POST["sub"] == 4) {
     # couldn't add
     $message = "NOT Added!";
     $message_type = "error";
     $destination = "edit";
 } elseif ($_POST["sub"] == 5) {
     $ratioarray = array();
     $numratios = $_POST["numratios"];
     $ratiosum = 0;
     for ($i = 0; $i < $numratios; $i++) {
         $ratioarray[$i] = array($_POST["id" . $i], $_POST["ratio" . $i]);
예제 #4
0
$stid = oci_parse($conn, $sql);
$res = oci_execute($stid);
while ($row = oci_fetch_array($stid, OCI_ASSOC)) {
    foreach ($row as $id) {
        echo "<option value={$id}>{$id}</option>";
    }
}
?>
			</select>
			<input type="submit" name="delete_person" value="Delete">
		</form>
	</div>
	<br />
	<span style="color:green">
	
	<?php 
addPerson($conn);
addUser($conn);
addSensor($conn);
deleteUser($conn);
deletePerson($conn);
deleteSensor($conn);
updatePerson($conn);
updateUser($conn);
?>
	
	</span>
		
</body>
</html>
<?php

include_once '../secret/api_key.php';
include '../_top.php';
include '../functions.php';
include_once '../hp-includes/people_lib.php';
$FLAG_CAN_CHANGE_DB = true;
function addPerson($name)
{
    $persons = getPersonsByName($name);
    // If I reached this point, I know for sure I either have one
    // or zero matches, there are no ambiguities.
    if (count($persons) == 0) {
        $person = addPersonToDatabase($name, $name);
        return $person->id;
    }
    return -1;
}
$name = mysql_real_escape_string(trim($_GET['name']));
if ($name) {
    $id = addPerson($name);
    echo $id;
    if ($id > 0) {
        mysql_query("UPDATE news_qualifiers SET idperson={$id} WHERE name='{$name}'");
    }
}
include '../_bottom.php';
예제 #6
0
			</div>
			<div class="inputdiv file">
				<input type="file" name="user_pic" value="Välj en bild (valfritt)">	<br>
			</div>
			<div class="inputdiv">
				<textarea name="story" placeholder="Beskrivning" rows="5" cols="22"><?php 
if (isset($_POST['story'])) {
    echo htmlentities($_POST['story']);
}
?>
</textarea><br>
			</div>
			<?php 
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (isset($_POST['addPerson'])) {
        print '<div class="msg">';
        print addPerson();
        print '</div>';
    }
}
?>

			<div style="clear: both"></div>

				<br>
				<input type="submit" name="addPerson" value="Lägg till" class="button">
		
		</form>
	</div>

</html>