本文整理汇总了PHP中relocate函数的典型用法代码示例。如果您正苦于以下问题:PHP relocate函数的具体用法?PHP relocate怎么用?PHP relocate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了relocate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
header('location: ' . $url);
}
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
// Generate password
if (isset($_POST['generatePassword'])) {
$generatedPassword = generateRandomString();
$_SESSION['generatedPassword'] = $generatedPassword;
relocate('oplossing-CRUD-CMS-registratie-form.php');
}
// Registreer
if (isset($_POST['submit'])) {
$email = $_POST['email'];
$password = $_POST['password'];
if ($email !== '' && $password !== '') {
$db = new PDO('mysql:host=localhost;dbname=oplossing_crud_cms', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
$user = $user->register($email, $password);
if ($user) {
unset($_SESSION['generatedPassword']);
relocate('oplossing-CRUD-CMS-dashboard.php');
} else {
$error = new Message("Er ging iets mis tijdens het registreren, probeer opnieuw", "error");
relocate('oplossing-CRUD-CMS-registratie-form.php');
}
} else {
$error = new Message("Vul een e-mailadres of een paswoord in", "error");
relocate('oplossing-CRUD-CMS-registratie-form.php');
}
}
示例2: spl_autoload_register
include 'classes/' . $class . '.php';
}
spl_autoload_register('my_autoloader');
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define('HOST', dirname(BASE_URL) . '/');
$message = false;
if (Message::hasMessage()) {
$message = Message::getMessage();
Message::remove();
}
$db = new PDO('mysql:host=localhost;dbname=oplossing_crud_cms', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
if ($user->validate()) {
relocate("oplossing-CRUD-CMS-dashboard.php");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Oplossing CRUD CMS login</title>
<style>
html
{
font-family:sans-serif;
}
示例3: spl_autoload_register
spl_autoload_register('my_autoloader');
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define('HOST', dirname(BASE_URL) . '/');
$message = false;
if (Message::hasMessage()) {
$message = Message::getMessage();
Message::remove();
}
$db = new PDO('mysql:host=localhost;dbname=oplossing_crud_cms', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
if (!$user->validate()) {
new Message("U moet eerst inloggen", "error");
relocate("oplossing-CRUD-CMS-login-form.php");
}
var_dump($_POST);
if (isset($_POST['submit'])) {
$id = $_POST['id'];
$titel = $_POST['titel'];
$artikelTekst = $_POST['artikel'];
$kernwoorden = $_POST['kernwoorden'];
$datum = $_POST['datum'];
$is_active = isset($_POST['is_active']) ? 1 : 0;
$artikel = new Artikel($databaseWrapper);
$artikelEdited = $artikel->edit($id, $titel, $artikelTekst, $kernwoorden, $datum, $is_active);
if ($artikelEdited) {
new Message('Het artikel met titel "' . $titel . '" werd gewijzigd.', 'success');
relocate("oplossing-CRUD-CMS-artikels-overzicht.php");
}
}
开发者ID:erwin-mi,项目名称:web-backend-oplossingen,代码行数:31,代码来源:oplossing-CRUD-CMS-artikel-wijzigen-process.php
示例4: while
// end for loop
?>
</tr>
<?php
}
} while ($row_brewer = mysql_fetch_assoc($brewer));
?>
</tbody>
</table>
<p><input type="submit" class="button" name="Submit" value="Assign to Table #<?php
echo $row_tables_edit['tableNumber'];
?>
" /></p>
<input type="hidden" name="relocate" value="<?php
echo relocate($_SERVER['HTTP_REFERER'], "default", $msg, $row_tables_edit['id']);
if ($msg != "default") {
echo "&id=" . $row_tables_edit['id'];
}
?>
">
</form>
<?php
//mysql_free_result($styles);
mysql_free_result($tables);
mysql_free_result($tables_edit);
} else {
if ($_SESSION['jPrefsQueued'] == "N") {
"<p>Flights from this table have not been assigned to rounds yet. <a href='index.php?section=admin&go=judging_flights&action=assign&filter=rounds'>Assign flights to rounds?</a></p>";
} else {
echo "<p>This table has not been assigned to a round yet. <a href='index.php?section=admin&go=judging_flights&action=assign&filter=rounds'>Assign to a round?</a></p>";
示例5: spl_autoload_register
}
spl_autoload_register('my_autoloader');
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define('HOST', dirname(BASE_URL) . '/');
$message = false;
if (Message::hasMessage()) {
$message = Message::getMessage();
Message::remove();
}
$db = new PDO('mysql:host=localhost;dbname=oplossing_crud_cms', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
if (!$user->validate()) {
new Message("U moet eerst inloggen", "error");
relocate("oplossing-CRUD-CMS-login-form.php");
}
//upload file
$message = false;
try {
if (isset($_POST['submit'])) {
var_dump($_FILES);
if (($_FILES["profile_picture"]["type"] == "image/gif" || $_FILES["profile_picture"]["type"] == "image/jpeg" || $_FILES["profile_picture"]["type"] == "image/png") && $_FILES["profile_picture"]["size"] < 2000000) {
if ($_FILES["profile_picture"]["error"] > 0) {
throw new Exception("Return Code: " . $_FILES["file"]["error"]);
} else {
define('ROOT', dirname(__FILE__));
if (file_exists(ROOT . "/img/" . $_FILES["profile_picture"]["name"])) {
throw new Exception($_FILES["profile_picture"]["name"] . " bestaat al. ");
} else {
move_uploaded_file($_FILES["profile_picture"]["tmp_name"], ROOT . "/img/" . $_FILES["profile_picture"]["name"]);
示例6: relocate
echo $row_styles['brewStyleActive'];
} else {
echo "Y";
}
?>
">
<input type="hidden" name="brewStyleOwn" value="<?php
if ($action == "edit") {
echo $row_styles['brewStyleOwn'];
} else {
echo "custom";
}
?>
">
<input type="hidden" name="relocate" value="<?php
echo relocate($_SERVER['HTTP_REFERER'], "default", $msg, $id);
?>
">
</form>
<?php
}
?>
<?php
if ($action == "default" && $filter == "judging" && $bid == "default") {
?>
<table>
<tr>
示例7: spl_autoload_register
include 'classes/' . $class . '.php';
}
spl_autoload_register('my_autoloader');
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define('HOST', dirname(BASE_URL) . '/');
$message = false;
if (Message::hasMessage()) {
$message = Message::getMessage();
Message::remove();
}
$db = new PDO('mysql:host=localhost;dbname=opdracht_file_upload', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
if ($user->validate()) {
relocate("dashboard.php");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Opdracht file upload</title>
<style>
html
{
font-family:sans-serif;
}
示例8: time
} else {
$filename = time() . '_' . $_FILES['profilePicture']['name'];
while (file_exists(SERVER_PATH . 'img\\' . $filename)) {
$filename = time() . '_' . $_FILES['profilePicture']['name'];
}
move_uploaded_file($_FILES['profilePicture']['tmp_name'], SERVER_PATH . 'img\\' . $filename);
}
}
} else {
new Message("Ongeldig bestand");
header("location: gegevens-wijzigen-form.php");
}
if ($filename) {
$queriegeg = 'UPDATE users SET profile_picture = :profile_picture WHERE id = :id';
$placeholders = array(':profile_picture' => $filename, ':id' => $user->getId());
$databaseWrapper->query($queriegeg, $placeholders);
new Message("De gegevens zijn gewijzigd!", "success");
header("location: gegevens-wijzigen-form.php");
}
if (isset($_POST['email'])) {
$email = $_POST['email'];
$querie = 'UPDATE users SET email = :email WHERE id = :id';
$db->prepare($querie);
$db->binvalue(':id', $user->getId());
$db->binvalue(':email', $email);
$db->execute();
} else {
$error = new Message("Vul een e-mailadres of een paswoord in", "error");
relocate('registratie-form.php');
}
}
示例9: session_start
<?php
session_start();
function my_autoloader($class)
{
include 'classes/' . $class . '.php';
}
spl_autoload_register('my_autoloader');
function relocate($url)
{
header('location: ' . $url);
}
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define('HOST', dirname(BASE_URL) . '/');
$db = new PDO('mysql:host=localhost;dbname=opdracht_file_upload', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
$userLoggedOut = $user->logout();
if ($userLoggedOut) {
new Message("Bedankt en tot de volgende!", "success");
relocate('login-form.php');
}
示例10: escape
<?php
function escape($v)
{
$v = str_replace(" ", "\\ ", $v);
$v = str_replace("'", "\\'", $v);
return $v;
}
$dest = escape($_REQUEST['dest']);
$source = escape($_REQUEST['sourc']);
if ($_REQUEST['force']) {
$args = 'f';
} else {
$args = '';
}
function relocate($source, $dest, $args)
{
if (isset($source) && isset($dest)) {
echo "Success: ln -s" . $args . " " . $dest . " " . $source . "";
return shell_exec("ln -s" . $args . " " . $dest . " " . $source . "");
}
return false;
}
echo relocate($source, $dest, $args);
示例11: spl_autoload_register
}
spl_autoload_register('my_autoloader');
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define('HOST', dirname(BASE_URL) . '/');
$message = false;
if (Message::hasMessage()) {
$message = Message::getMessage();
Message::remove();
}
$db = new PDO('mysql:host=localhost;dbname=opdracht_file_upload', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
if (!$user->validate()) {
new Message("U moet eerst inloggen", "error");
relocate("gegevens-wijzigen-form.php");
}
$email = $_SESSION['registration']['email'];
var_dump($_SESSION);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>opdraht file upload</title>
<style>
html
{
示例12: Message
++$isValid;
}
// Extensie (gif, png, jpeg)
if ($_FILES['profilePicture']['type'] !== 'image/jpeg' && $_FILES['profilePicture']['type'] !== 'image/png' && $_FILES['profilePicture']['type'] !== 'image/gif') {
++$isValid;
}
if ($isValid > 0) {
new Message("Het bestand is niet geldig, probeer een ander bestand", "error");
relocate("oplossing-file-upload-gegevens-form.php");
} else {
// Nieuwe naam aanmaken
$newFileName = createNewFileName($user->getId(), $_FILES['profilePicture']['name']);
// Controle of naam reeds in map voorkomt
while (file_exists(SERVER_PATH . 'img\\' . $newFileName)) {
$newFileName = createNewFileName($user->getId(), $_FILES['profilePicture']['name']);
}
// Verplaatsen
move_uploaded_file($_FILES['profilePicture']['tmp_name'], SERVER_PATH . 'img\\' . $newFileName);
}
}
// Toevoegen aan db
if ($newFileName) {
$editGegevensQuery = 'UPDATE users
SET profile_picture = :profile_picture
WHERE id = :id';
$editGegevensPlaceholders = array(':profile_picture' => $newFileName, ':id' => $user->getId());
$databaseWrapper->query($editGegevensQuery, $editGegevensPlaceholders);
new Message("De gegevens zijn gewijzigd!", "success");
relocate("oplossing-file-upload-gegevens-form.php");
}
}
示例13: spl_autoload_register
}
spl_autoload_register('my_autoloader');
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define('HOST', dirname(BASE_URL) . '/');
$message = false;
if (Message::hasMessage()) {
$message = Message::getMessage();
Message::remove();
}
$db = new PDO('mysql:host=localhost;dbname=oplossing_file_upload', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
if (!$user->validate()) {
new Message("U moet eerst inloggen", "error");
relocate("oplossing-file-upload-login-form.php");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Oplossing file upload</title>
<style>
html
{
font-family:sans-serif;
}
示例14: spl_autoload_register
include 'classes/' . $class . '.php';
}
spl_autoload_register('my_autoloader');
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define('HOST', dirname(BASE_URL) . '/');
$message = false;
if (Message::hasMessage()) {
$message = Message::getMessage();
Message::remove();
}
$db = new PDO('mysql:host=localhost;dbname=oplossing_file_upload', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
if ($user->validate()) {
relocate("oplossing-file-upload-dashboard.php");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Oplossing file upload login</title>
<style>
html
{
font-family:sans-serif;
}
示例15: header
{
header('location: ' . $url);
}
function my_autoloader($class)
{
include 'classes/' . $class . '.php';
}
spl_autoload_register('my_autoloader');
define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
define('HOST', dirname(BASE_URL) . '/');
$message = false;
if (Message::hasMessage()) {
$message = Message::getMessage();
Message::remove();
}
$db = new PDO('mysql:host=localhost;dbname=oplossing_file_upload', 'root', '');
// Connectie maken
$databaseWrapper = new Database($db);
$user = new User($databaseWrapper);
if (!$user->validate()) {
new Message("U moet eerst inloggen", "error");
relocate("oplossing-file-upload-login-form.php");
}
if (isset($_POST['activate'])) {
$artikel = new Artikel($databaseWrapper);
$id = $_POST['activate'];
var_dump($_POST);
$artikel->toggle($id);
new Message('Het artikel is succesvol van activatiestatus veranderd', 'success');
relocate("oplossing-file-upload-artikels-overzicht.php");
}