Hi Guys hope that you are all well.
I have statred to use the bootstrap framework to create my website, I have got all of my pages working and linking correctly using bootstrap and its looking pritty awesome now!
I have found a video on youtube to help me to crreate my register form (this is the link) Click Here
Below is my bootstrap code
<!DOCTYPE html>
<html>
<head>
<title>Richard Hemmings </title>
<meta name="viewpoint" content="width=device-width, intail-scale=1.0">
<link href = "css/bootstrap.min.css"rel = "stylesheet">
<link href = "css/stylesheet.css" rel = "stlesheet">
</head>
<body>
<div class = "navbar navbar-inverse navbar-static-top">
<div class = "contrainer">
<?php
include('inc/header.php'); ?>
<div class="container padding-top-10">
<div class="panel panel-deafult">
<div class "panel-heading">Registration</div>
<P> Please fill in the form below to register for an account with this website,you need to fill in ALL feilds to enable to register!</P>
</div>
<form>
<div class= "row">
<input type="text" class="form control;" id= "UserName" placeholder="User Name"/></input>
<input type="password" class="form control;" id= "Password" placeholder="Password"/></input>
<input type="password" class="form control;" id= "Confirm Password" placeholder="Confirm Password"/></input>
<input type="text" class="form control;" id= "Name" placeholder="Name"/></input>
</div>
<input type="submit" value="Register">
<input type="hidden" name="token" value="<?php echo Token::generate(); ?>">
</form>
<div class = "navbar navbar-default navbar-fixed-bottom">
<div class = "container">
<P class = "navbar-text">Site build and belongs to Richard Hemmings (C) 2015</P>
</div>
</div>
<script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src = "js/bootstrap/js" ></script>
</body>
</html>
Here is the PHP code that I want to use but I get an error message everytime I want to use it, this is the code that I used when I crated a regsiter page for another website that I created a few months ago. Please note that the form feilds are not the same as in the code above!
<?php
if(Input::exists()) {
if(Token::check(Input::get('token'))) {
$validate = new Validate();
$validation = $validate->check($_POST, array(
'username' => array(
'required' => true,
'min' => 2,
'max' => 20,
'unique' => 'users'),
'password' => array(
'required' => true,
'min' => 6),
'password_again' => array(
'required' => true,
'matches' => 'password'),
'name' => array(
'required' => false,
'min' => 2,
'max' => 50)
));
if($validation->passed()) {
$user = new User();
$salt = Hash::salt(32);
try {
$user->create(array(
'username' => Input::get('username'),
'password' => Hash::make(Input::get('password'), $salt),
'salt' => $salt,
'name' => Input::get('name'),
'joined' => date('Y-m-d H:i:s'),
'group' => 1
));
Session::flash('home', 'You have been registered and can now log in!');
Redirect::to('index.php');
} catch(Exception $e) {
die($e->getMessage());
}
} else {
foreach($validate->errors() as $error) {
echo $error, '<br>';
}
}
}
}
?>
<form action="" method="post">
<div class="field">
<label for="username">Choose a username</label>
<input type="text" name="username" id="username" value="<?php echo escape(Input::get('username')); ?>">
</div>
<div class="field">
<label for="password">Choose a password</label>
<input type="password" name="password" id="password">
</div>
<div class="field">
<label for="password_again">Enter your password again</label>
<input type="password" name="password_again" id="password_again">
</div>
<div class="field">
<label for="name">Your name</label>
<input type="text" name="name" id="name" value="<?php echo escape(Input::get('name')); ?>">
</div>
<input type="submit" value="Register">
<input type="hidden" name="token" value="<?php echo Token::generate(); ?>">
</form>
If anyone could help me it would be much appreicated as I really want to try and get this done asap.
Sorry again for been such apain
Regards
Richard