Example #1
0
<?php

$msc = microtime(true);
include_once 'model.php';
//Γενικές πληροφορίες***********************************************************************************************
$userid = isset($_SESSION['userid']) ? $_SESSION['userid'] : 0;
if (isset($_POST['chk1']) && $userid) {
    $name = isset($_POST['name']) ? $_POST['name'] : 0;
    $surname = isset($_POST['surname']) ? $_POST['surname'] : 0;
    $aliases = isset($_POST['aliases']) ? $_POST['aliases'] : 0;
    $sex = isset($_POST['sex']) ? $_POST['sex'] : 0;
    $birthday = isset($_POST['birthday']) ? $_POST['birthday'] : 0;
    $acquaintance = isset($_POST['acquaintance']) ? $_POST['acquaintance'] : 0;
    $comments = isset($_POST['comments']) ? $_POST['comments'] : 0;
    if (NULL == ($personid = exists_person_for_user($name, $surname, $sex, $birthday, $acquaintance, $userid))) {
        $personid = insert_person($name, $surname, $sex, $birthday, $acquaintance, $comments, $userid);
    }
    // update_field_from_table( "persons" , "got_alias", 1 , "personid" , $personid );
    // update_field_from_table( "persons" , "got_phone", 1 , "personid" , $personid );
    // update_field_from_table( "persons" , "got_email", 1 , "personid" , $personid );
    // update_field_from_table( "persons" , "got_website", 1 , "personid" , $personid );
    // update_field_from_table( "persons" , "got_address", 1 , "personid" , $personid );
    foreach ($aliases as $alias) {
        if ($alias && $personid) {
            insert_relation("persons", "aliases", $personid, insert_alias($alias));
        }
    }
    // $reltypes = isset($_POST['reltypes']) ? $_POST['reltypes'] : 0;
    // $persons  = isset($_POST['persons']) ? $_POST['persons'] : 0;
    // $row = 0;
    // foreach ($reltypes as $reltype) {
Example #2
0
function insert_db_row($dbh, $row)
{
    $name = $row['Name'];
    $email = $row['E-mail'];
    # check if they are in the people table first
    $pid = person_exists($dbh, $name, $email);
    if (is_null($pid)) {
        $pid = insert_person($dbh, $name, $email);
        $oid = insert_order($dbh, $pid, $row['Spaces'], '', 1, $pid);
    }
    # check number of tickets
    $tickets = get_tickets($dbh, $pid);
    if (count($tickets) != $row['Spaces']) {
        # Delete and regenerate all tickets
        delete_tickets($dbh, $pid);
        generate_tickets_pdf($dbh, $pid, $pid, $row);
    }
    # Return something useful to indicate what we just did
}