function userData($user) { echo json_encode(array('id' => $user->getId(), 'name' => $user->getName())); } /* User logging in with POST? */ if (isset($_POST["user"]) && isset($_POST["password"])) { $user = User::newFromName($_POST["user"]); if ($user && $user->checkPassword($_POST["password"]) && $user->getId() !== 0) { /* login ok */ //$_SESSION["wsUserID"] = $user->getId(); //$_SESSION["wsUserName"] = $user->getName(); $user->setCookies(); userData($user); } else { /* login failed */ echo json_encode("fail"); } /* User logging in with session? */ } else { $user = User::newFromSession(); if ($user->getId() !== 0) { if (isset($_POST["logout"])) { $user->logout(); echo json_encode("logout"); } else { userData($user); } } else { echo json_encode("no"); } }
<?php require "androidLib.php"; if (debug) { include 'logging.php'; $log = new logging(); $log->write("get_adress:\n" . print_r($_POST, true)); } else { $log = false; } $dbA = authDB(); $auth = userData($dbA, $_POST["sessid"], $_POST["ip"], $_POST['mandant'], $_POST["login"], $_POST["password"], $f); if ($log) { $log->write("Auth:" . print_r($auth, true)); } function mkwort($txt) { $txt = strtr($txt, '?*', '_%'); if (substr($txt, 0, 1) == '!') { return substr($txt, 1); } return '%' . $txt; } if ($auth["db"]) { $postarray = array("name", "city", "street", "phone"); $custsql = array(); $vendsql = array(); $contsql = array(); $rs = false; $db = $auth["db"]; foreach ($postarray as $key) {
<?php ob_start(); include 'core.php'; $queryEdit = userData(); while ($row = mysqli_fetch_assoc($queryEdit)) { $dbPPhoto = $row['user_photo']; $userRating = $row['user_rating']; } ?> <div class="my_main col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div class="my_profile_leftside col-xs-2 col-sm-2 col-md-2 col-lg-2"> <center><div class="pp" style="background:url('<?php echo $dbPPhoto; ?> ');background-size:cover"> </div></center><br> <form class="addPhotoForm" action="profile\upload.php" method="POST" enctype="multipart/form-data"> <!-- <input type="file" accept="image/*"> --> <ul class="uploadBtn"> <li class="pull-left"> <input type="file" name="pphoto" accept="image/*" class="filestyle" data-classButton="btn btn-primary" data-input="false" data-classIcon="icon-plus" data-buttonText=" Sekil seçin"> </li> <li class="pull-left"> <button type="submit" class="btn btn-success"> <span class="glyphicon glyphicon-ok"></span> OK </button> </li> </ul> </form><br>