php require_once bootstrap php if isset _POST submit _POST submit newU

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
require_once("bootstrap.php");
if(isset($_POST['submit']) && $_POST['submit']) {
$newUserName = $_POST['username'];
$newUserPassword = $_POST['password'];;
$newUserEmail = $_POST['email'];
$newUser = new User();
$newUser->username = $newUserName;
$newUser->password = $newUserPassword;
$newUser->username = $newUserEmail;
$newUser->save();
}
$query = Doctrine_Query::create()->from('User u');
$users = $query->execute();
$out = '<html>
<head>
<title>Mutagolo Initial</title>
</head>
<body>';
foreach($users as $user) {
$out .= '<strong>Username:</strong>'.$user->username.'<br/><strong>Password:</strong>'.$user->password.'<br/><strong>E-Mail:</strong>'.$user->email."<br/><br/>";
}
$out .= '<br/><br/>';
$out .= 'To get this users doctrine gnerated the following SQL query (You can copy\paste it to SQLYog and run by pressing F8):<br/><pre>'.$query->getSql().'</pre>';
$out .= '<hr>
<form id="userForm" name="userForm" method="post" action="'.$_SERVER['PHP_SELF'].'">
<strong>Username:</strong><input type="text" name="username" value="'.$newUserName.'">
<strong>Password:</strong><input type="text" name="password" value="'.$newUserPassword.'">
<strong>Email:</strong><input type="text" name="email" value="'.$newUserEmail.'">
<input type="submit" value="Add User" name="submit">';
$out .= '</body>
</html>';
echo $out;
?>