function DeletePerson($family, $PersonID) { // Abort deletion if person is parent in some family with children (must remove the children first) if ($family->ElementExists("Family[ChildID and (ParentID = {$PersonID})]")) { // Actually, we could allow this, but the spouses of the families would have to be deleted also. // Currently this restriction means that we cannot delete root-ancestors. throw new Exception("Person has families with children in database. Cannot delete."); } // Delete the person itself, references to him as child and all empty families he is in $family->RemoveElements("Person[@id = '{$PersonID}']"); $family->RemoveElements("Family/ChildID[. = '{$PersonID}']"); $family->RemoveElements("Family[ParentID = '{$PersonID}']"); } //-------------------------- MAIN -------------------------- try { VerifyPassword(); $family = LoadFamilyData(); $PersonID = $_REQUEST["PersonID"]; if ($family->ElementExists("Family[ChildID = '{$PersonID}']")) { // redirect to first parent when this person has been deleted $parentID = $family->Element("Family[ChildID = '{$PersonID}']/ParentID[1]")->InnerText; } DeletePerson($family, $PersonID); SaveFamilyData($family); if (isset($parentID)) { Redirect("person.php?PersonID={$parentID}"); } else { Redirect("index.php"); } } catch (Exception $e) { ReportException($e);
<?php /** * @application Automatical Judging System * @author deltamaster * @copyright Softrank Research Center * @version 2.0.0.0 */ require_once "./include/common.inc.php"; if ($sys_uid) { showmessage("Logged in already.", 'index.php'); } if (submitcheck('registersubmit')) { if (VerifyUsername($_POST['inputusername']) && VerifyPassword($_POST['inputpassword']) && VerifyRealName($_POST['inputrealname']) && VerifyEmail($_POST['inputemail']) && VerifyMobile($_POST['inputmobile']) && VerifyStudentId($_POST['studentid'])) { if ($_POST['inputpassword'] == $_POST['confirmpassword']) { $inputpassword = md5($_POST['inputpassword']); $query = $db->query("INSERT INTO `{$tablepre}user` (`username`, `password`, `email`, `mobile`, `realname`, `studentid`) VALUES ('{$_POST['inputusername']}', '{$inputpassword}', '{$_POST['inputemail']}', '{$_POST['inputmobile']}', '{$_POST['inputrealname']}', '{$_POST['studentid']}')"); $last_insert_id = $db->insert_id(); $query = $db->query("insert into `{$tablepre}record` (`uid`, `pid`, `type`, `event`) values ('{$last_insert_id}', '0', 'notice', '{$lang['welcome']}')"); showmessage($lang['register_success'], 'login.php'); } } showmessage($lang['register_fail'], 'register.php'); } include template('register');
public function loginAction() { if (Tools::isPost()) { $email = Tools::getValue('email'); $password = Tools::getValue('password'); $sql = "select ID, UniversalID, PasswordHash from Users where (UniversalType = 1) and (email = '{$email}');"; $user = GetMainConnection()->query($sql)->fetch(); if (!empty($user['ID'])) { if (VerifyPassword($password, $user['PasswordHash'])) { unset($password); $sql = "update Users " . "set RememberMe = '" . POSTBoolAsSQLStr('RememberMeEdt') . "' " . "where (ID = " . $user['ID'] . ");"; GetMainConnection()->exec($sql); if (LoginUsingUniversalID($user['UniversalID'])) { if (empty($_SESSION['login_redirect'])) { return AddAlertMessage('success', 'Добро пожаловать!', '/'); } else { $vRedirect = $_SESSION['login_redirect']; unset($_SESSION['login_redirect']); Redirect($vRedirect); } } } else { unset($password); AddAlertMessage('danger', 'Неверный e-mail или пароль.'); } } else { unset($password); AddAlertMessage('danger', 'E-mail не найден.'); } } // https://developers.facebook.com/docs/php/gettingstarted/5.0.0 // https://developers.facebook.com/docs/php/Facebook/5.0.0 // http://25labs.com/tutorial-integrate-facebook-connect-to-your-website-using-php-sdk-v-3-x-x-which-uses-graph-api/ require_once PATH_SITE_ROOT . 'core/facebook-php-sdk-v4-5.0-dev/src/Facebook/autoload.php'; $facebook = new Facebook\Facebook(['app_id' => facebook_app_id, 'app_secret' => facebook_app_secret, 'default_graph_version' => facebook_graph_version]); $helper = $facebook->getRedirectLoginHelper(); $permissions = ['email']; // optional $FB_LoginUrl = $helper->getLoginUrl('http://karapuz.life/app/common/facebook_login_callback.php', $permissions); $VK_LoginUrl = 'https://oauth.vk.com/authorize?client_id=' . vk_app_id . '&scope=offline,email&redirect_uri=' . urlencode('http://karapuz.life/app/common/vk_login_callback.php') . '&response_type=code'; $this->view->setVars(array('FB_LoginUrl' => $FB_LoginUrl, 'VK_LoginUrl' => $VK_LoginUrl)); $this->view->breadcrumbs = array(array('url' => '/auth/login', 'title' => 'Вход на сайт')); $this->view->meta = array('meta_title' => 'Войти на сайт', 'meta_description' => 'Войти на сайт', 'meta_keywords' => ''); $this->view->generate(); }
/** * @application Automatical Judging System * @author deltamaster * @copyright Softrank Research Center * @version 2.0.0.0 */ require_once "./include/common.inc.php"; if (!$uid) { showmessage($lang['invalid_operation']); } if (submitcheck('changepassword')) { $originpassword = md5($originpassword); $query = $db->query("select * from `{$tablepre}user` where `id`='{$uid}' and `password`='{$originpassword}'"); if ($db->num_rows($query)) { if (VerifyPassword($newpassword)) { $newpassword = md5($newpassword); $db->query("update `{$tablepre}user` set `password`='{$newpassword}' where `id`='{$uid}'"); showmessage($lang['change_password_success'], 'index.php'); } else { showmessage($lang['password_request'], 'usercp.php'); } } else { showmessage($lang['password_incorrect'], 'usercp.php'); } } if (submitcheck('sendclarification')) { $clarification = sjaddslashes($clarification); $db->query("insert into `{$tablepre}record` (`uid`, `pid`, `type`, `event`) values ('{$uid}', '0', 'clarify', '{$clarification}')"); showmessage($lang['clarify_success'], 'index.php'); }
function SaveFamilyData($family) { global $familyXmlFile, $dataDir; VerifyPassword(); Validate($family); $bakFile = $dataDir . "/xml/bak/Brotherus-" . date("Y-m-d", filemtime($familyXmlFile)) . ".xml"; if (!copy($familyXmlFile, $bakFile)) { die("failed to make backup"); } $family->save($familyXmlFile); trace("Family xml saved to file"); }
* @copyright Softrank Research Center * @version 2.0.0.0 */ require_once "./include/common.inc.php"; if (isset($_GET['username'])) { if ($_GET['username']) { if (VerifyUsername($_GET['username'])) { echo $lang['valid']; } else { echo $lang['invalid'] . ': ' . $lang['username_request']; } } else { echo 'No input'; } } elseif (isset($_GET['password'])) { if (VerifyPassword($_GET['password'])) { echo $lang['valid']; } else { echo $lang['invalid'] . ': ' . $lang['password_request']; } } elseif (isset($_GET['realname'])) { if (VerifyRealName($_GET['realname'])) { echo $lang['valid']; } else { echo $lang['invalid'] . ': ' . $lang['realname_request']; } } elseif (isset($_GET['email'])) { if (VerifyEmail($_GET['email'])) { echo $lang['valid']; } else { echo $lang['invalid'] . ': ' . $lang['email_request'];