Esempio n. 1
0
    if ($res['msg'] == 'OK') {
        $user = $_SESSION['userid'];
    }
}
$postdata = file_get_contents("php://input");
if (!empty($postdata)) {
    $_POST = json_decode($postdata, TRUE);
}
if (!empty($_GET['search'])) {
    $res = search(urldecode($_GET['search']));
} elseif (!empty($_GET['show'])) {
    $res = getShow($_GET['show'], isset($_GET['force']), isset($_GET['q']));
} elseif (isset($_GET['usershows'])) {
    $res = getUserShows();
} elseif (!empty($_POST['addshow'])) {
    $res = addShow($_POST['addshow']);
} elseif (!empty($_POST['delshow'])) {
    $res = delShow($_POST['delshow']);
} elseif (!empty($_POST['updateshow'])) {
    $res = updateShow($_POST['updateshow']);
} elseif (!empty($_POST['username']) && !empty($_POST['password'])) {
    $res = login($_POST['username'], $_POST['password'], isset($_POST['stay']) && $_POST['stay']);
} elseif (!empty($_POST['token'])) {
    $res = login2($_POST['password']);
} elseif (isset($_POST['logout'])) {
    $res = logout();
} elseif (!empty($_POST['registername']) && !empty($_POST['password'])) {
    $res = register($_POST['registername'], $_POST['password']);
} else {
    $res = array('msg' => 'Command not set', 'post' => $_POST, 'get' => $_GET);
}
Esempio n. 2
0
    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;
    }
    $video = formatVideo($p[3]);
    $videotitle = trim(cleanString($p[4]));
    $q = sprintf("INSERT INTO media (appearfk,medtype,medid,medtitle) VALUES (%d,%d,'%s','%s')\n\t\tON DUPLICATE KEY UPDATE medtype=%d, medid='%s', medtitle='%s'\n\t\t", $appearance, $video[0], $video[1], addslashes($videotitle), $video[0], $video[1], addslashes($videotitle));
    echo $q . "<br>";
Esempio n. 3
0
<?php

//require_once ('Edit.php');
//if (isset($_POST['submit'])) {
// php();
//header("Refresh:0");
//}
//
require_once '/var/www/html/app/model/connect.php';
require_once 'addShow.php';
if (isset($_POST['submit'])) {
    addShow();
    //header("Location:Add.php");
}
?>
<html lang="en"><head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=1024, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Edit</title>

    
    <style type="text/css">
    .container .form-horizontal .form-group .col-sm-10 {
	font-family: Consolas, Andale Mono, Lucida Console, Lucida Sans Typewriter, Monaco, Courier New, monospace;
}
    </style>
Esempio n. 4
0
        header("location:show-page.php?page=" . $_GET['page']);
    } else {
        $_SESSION['edit-show'] = 'failed';
        header("location:show-page.php?page=" . $_GET['page']);
    }
}
if (isset($_POST['delete'])) {
    removeShow($_POST['showid']);
    $_SESSION['delete-show'] = 'success';
    header("location:show-page.php?page=" . $_GET['page']);
}
if (isset($_POST['add'])) {
    $idTrain = getIdTrainByNameClass($_POST['train'], $_POST['class']);
    $show = checkShow($_POST['from_venue'], $_POST['to_venue'], $_POST['departure'], $idTrain, $_POST['seat']);
    if ($show == 0) {
        addShow($_POST['from_venue'], $_POST['to_venue'], $_POST['departure'], $idTrain, $_POST['seat']);
        $_SESSION['add-show'] = 'success';
        header("location:show-page.php?page=" . $_GET['page']);
    } else {
        $_SESSION['add-show'] = 'failed';
        header("location:show-page.php?page=" . $_GET['page']);
    }
}
?>

<script src="../js/jquery-2.1.1.min.js"></script>
<script src="../js/show-page.js"></script>
<script>
  var length = $('#class-edit > option').length;
    if (length == 1){
      $('#class-edit').removeAttr('disabled');