@ 2014-05-18T12:11:18Z <?php
session_start();
$before = $_SESSION['before'];
if($before == 'http://medalwars.url.ph/'){
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$username = $_POST['username'];
$password = $_POST['password'];
}else{
$_SESSION['foutcode'] = 'foutcode 001';
header("location: $before");
exit();
}
require_once 'db_config.php';
$sql = "SELECT username, password FROM users WHERE username = '$username' AND password = '$password'";
if(!mysql_query($sql)){
$_SESSION['foutcode'] = 'foutcode 004';
header("location: $before");
exit();
}
$mysqli = new mysqli($db['host'], $db['user'], $db['pass'], $db['dbname']);
$result = $mysqli->query($sql);
$row = $result->fetch_assoc();
if($username == htmlentities($row['username']) AND $password == htmlentities($row['password'])){
$_SESSION['logged_in'] = 'true';
$_SESSION['gebruiker'] = $username;
$_SESSION['foutcode'] = 'foutcode 011';
header("location: /ingame");
exit();
}else{
$_SESSION['foutcode'] = 'foutcode 008';
header("location: $before");
exit();
}
}elseif($before == 'http://medalwars.url.ph/create_account/'){
if($_SERVER['REQUEST_METHOD'] == 'POST'){
$username = $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$email = $_POST['e-mail'];
}else{
$_SESSION['foutcode'] = 'foutcode 001';
header("location: $before");
exit();
}
require_once 'db_config.php';
$ip = $_SERVER['REMOTE_ADDR'];
$sql = "INSERT INTO users (username, password, ip, email) VALUES (\"$username\",\"$password\",\"$ip\",\"$email\")";
if(!mysql_query($sql)){
$_SESSION['foutcode'] = 'foutcode 004';
header("location: $before");
exit();
}else{
$mysqli = new mysqli($db['host'], $db['user'], $db['pass'], $db['dbname']);
$query = mysql_query($sql, $mysqli);
$_SESSION['logged_in'] = 'create';
$_SESSION['gebruiker'] = $username;
$naam_verzender = 'MedalWars';
$email_verzender = 'noreply@medalwars.url.ph';
$onderwerp = 'Accountregistratie MedalWars';
$headers = "From: ".$naam_verzender." <".$email_verzender."> ";
$bericht = "
Beste $username,
Hierbij ontvangt u de bevestiging voor het aanmaken van uw account.
Uw inloggegevens zijn:
Gebruikersnaam: $username.
Wachtwoord: $password.
Let op: u ontvangt deze gegevens eenmalig per e-mail.
Als u uw wachtwoord vergeet zullen wij deze niet via e-mail verstrekken.
Bewaar deze e-mail dus goed.
Geef ook wijzigingen van uw e-mailadres tijdig aan onder instellingen op de website.
Wij hopen dat u veel plezier zult hebben met het spelen van dit spel.
mvg,
Het MedalWars team - www.medalwars.url.ph
";
mail($email, $onderwerp, $bericht, $headers);
header("location: $before");
exit();
}
}elseif($before == ''){
$_SESSION['foutcode'] = 'foutcode 009';
header("location: http://medalwars.url.ph/");
}else{
$_SESSION['foutcode'] = 'foutcode 010';
header("location: http://medalwars.url.ph/");
}
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for git.master , git.master_jit , rfc.property-hooks Warning: Undefined array key "before" in /in/IQgF1 on line 3
Warning: Cannot modify header information - headers already sent by (output started at /in/IQgF1:3) in /in/IQgF1 on line 91
This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches Archived branches Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:dark mode live preview
37.55 ms | 401 KiB | 8 Q