echo "\n"; echo "Welcome, guest."; echo "</p>\n"; } ?> --> <?php // Check the form was filled in correctly if (!isset($_GET['username'])) { die("No user specified."); } //include ("/export/home/mclaug67/source_html/public_html/awp/PhotoSite/Connect-webuser.php"); //include ("DB_Functions.php"); $dbh = ConnectDB(); $photodata = ListAllPix($dbh, $_GET['username']); $userid = CheckUsername($dbh, $_GET['username']); if ($_SESSION['username'] == 'Admin') { echo '<div style="text-align:center"><input type="button" value="Delete This Account" onclick="adminDeleteAccount(' . $userid . ')"></div>'; } if ($_GET['username'] != null) { echo '<h2 style="text-align:center;"> ' . $_GET['username'] . ' has ' . count($photodata) . ' picture(s) (Note: Some pictures may be hidden).</h2>'; } if (isset($_SESSION['username'])) { echo '<div style="text-align:center"><input type="button" value="Delete Account" onclick="deleteAccount(' . $_SESSION['user_id'] . ')"></div>'; } echo "<dl>\n"; foreach ($photodata as $thisone) { if (htmlspecialchars($thisone->view) == '0' && !isset($_SESSION['username'])) { // Do nothing if the profile is private and the user is a guest // Private pictures can only be seen by someone who is logged in
<?php // register.php // // D Provine, 2 August 2013 session_name('reglogin'); session_start(); // Check the form was filled in correctly if (!isset($_POST['username']) || !isset($_POST['password1']) || !isset($_POST['password2'])) { die("You did not fill in the form correctly. Try again."); } if (!preg_match('/^[A-Za-z0-9_]+$/', $_POST['username'])) { die("Username must consist only of letters, numbers, underscore."); } if ($_POST['password1'] != $_POST['password2']) { die("Passwords don't match. Try again."); } include "/export/home/mclaug67/source_html/public_html/awp/PhotoSite/Connect-webuser.php"; include "DB_Functions.php"; $dbh = ConnectDB(); // make sure not already in use $user_id = CheckUsername($dbh, $_POST['username']); if ($user_id != -1) { die("that username is already in use"); } // add new user and get userid $user_id = AddNewUser($dbh, $_POST['username'], $_POST['password1']); // log them in $_SESSION['username'] = $_POST['username']; $_SESSION['user_id'] = $user_id; header("Location: user_page.php");
} else { if ($_REQUEST['method'] == 'del') { mysql_query("DELETE FROM favorites WHERE uid = " . $user->uid . " AND tid = " . $_REQUEST['tid'] . " LIMIT 1"); } } break; case 'SwitchReliable': if (!is_numeric($_REQUEST['rid'])) { exit; } if (!in_array($_REQUEST['reliable'], array('i', 'n', '?', 'e'))) { exit; } $remark = new Remark($_REQUEST['rid']); $remark->changeReliability($_REQUEST['reliable']); break; case 'CheckUsername': if (CheckUsername($_REQUEST['text'])) { echo 1; } else { echo 0; } break; case 'Exit': quit(); addMessage('Sikeresen kiléptünk!', 'info'); break; default: return json_encode($_REQUEST); //code to be executed if n is different from all labels; }