<?php /* Prototype : bool unlink(string filename[, context context]) * Description: Delete a file * Source code: ext/standard/file.c * Alias to functions: */ echo "*** Testing unlink() : variation: contexts and relative files ***\n"; // test relative directories and stream contexts. $subdir = 'subdir'; $testfile = $subdir . '/testfile.txt'; mkdir($subdir); touch($testfile); f_exists($testfile); $context = stream_context_create(); var_dump(unlink($testfile, $context)); f_exists($testfile); rmdir($subdir); function f_exists($file) { if (file_exists($file) == true) { echo "{$file} exists\n"; } else { echo "{$file} doesn't exist\n"; } } ?> ===DONE===
<?php $title = 'Swift Airlines | Login Error'; include $_SERVER["DOCUMENT_ROOT"] . '/swift/core/init.php'; if (empty($_POST) === false) { $f_uname = $_POST['f_uname']; $f_password = $_POST['f_password']; if (empty($f_uname) === true || empty($f_password) === true) { $errors[] = 'You need to enter both, the username and the password!'; } else { if (f_exists($f_uname) === false) { $errors[] = 'No such user exists! Please register!'; } else { if (f_active($f_uname) === false) { $errors[] = 'Please activate your account!'; } else { if (strlen($f_password) > 32) { $errors[] = 'Password too long!'; } $f_login = f_login($f_uname, $f_password); if ($f_login === false) { $errors[] = 'Username and Password do not match!'; } else { $_SESSION['f_id'] = $f_login; header('Location: http://localhost/swift/index.php'); exit; } } } } } else {
<?php $title = 'Swift Airlines | User Registration'; include $_SERVER["DOCUMENT_ROOT"] . '/swift/core/init.php'; f_logged_in_redirect(); include $_SERVER["DOCUMENT_ROOT"] . '/swift/includes/overall/header.php'; if (empty($_POST) === false) { $required_fields = array('f_uname', 'f_password', 'f_password_again', 'f_fname', 'f_lname', 'f_mailid', 'f_sex', 'f_address', 'f_phone'); foreach ($_POST as $key => $value) { if (empty($value) && in_array($key, $required_fields) === true) { $errors[] = 'All the fields are required!'; break 1; } } if (empty($errors) === true) { if (f_exists($_POST['f_uname']) === true) { $errors[] = 'Sorry, such a username has already been taken by another user!'; } if (preg_match("/\\s/", $_POST['f_uname']) == true) { $errors[] = 'Your username cannot contain any spaces!'; } if (!preg_match('/^[a-z][0-9a-z]{1,31}$/i', $_POST['f_uname'])) { $errors[] = 'Your username can contain only alphabets and numbers!'; } if (!preg_match('/^[a-z]{2,30}$/i', $_POST['f_fname'])) { $errors[] = 'Your first name can contain only alphabets'; } if (!preg_match('/^[a-z]{2,30}$/i', $_POST['f_lname'])) { $errors[] = 'Your last name can contain only alphabets'; } if (strlen($_POST['f_password']) < 6) {
<?php $title = 'Swift Airlines | Profile'; include $_SERVER["DOCUMENT_ROOT"] . '/swift/core/init.php'; user_protect_page(); include $_SERVER["DOCUMENT_ROOT"] . '/swift/includes/overall/header.php'; if (isset($_GET['f_uname']) === true && empty($_GET['f_uname']) === false) { $f_uname = $_GET['f_uname']; if (f_exists($f_uname) === true) { $f_id = f_id_from_username($f_uname); $profile_data = f_data($f_id, 'f_fname', 'f_lname', 'f_mailid', 'f_sex', 'f_regdate'); ?> <h4><?php echo $profile_data['f_fname']; ?> 's Profile</h4> <br/> <div class="container"> <img src="http://localhost/<?php echo $profile_data['f_dp']; ?> " height="150" width="150" /> </div> <hr> <strong>Name:</strong> <?php echo $profile_data['f_fname'] . ' ' . $profile_data['f_lname']; ?> <br/><br/>