Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.Make a config file:
- 2.download rb.php file (https://github.com/yeriomin/redbean-single-file/blob/master/rb.php) or from official site.
- config.php
- ----------------------
- include"rb.php";
- $username = "root";
- $userpass = "";
- $db = "shift";
- $host = "localhost";
- include "rb.php";
- R::setup("mysql:host=$host;dbname=$db", "$username", "$userpass"); //for both mysql or mariaDB
- R::ext('xdispense', function( $type ) { return R::getRedBean()->dispense($type);});
- R::freeze(true);
- //R::debug(true) ; put it true if you want to debug your query
- 2.
- include "config.php";
- $signin=isset($_POST['signin'])?$_POST['signin']:"";
- $username=isset($_POST['username'])?$_POST['username']:"";
- $pw=isset($_POST['pw'])?$_POST['pw']:"";
- if($username=="")
- {
- $error="fill in username to sign in "
- }
- else if($pw=="")
- {
- $error="fill in password to sign in "
- }
- else if($error=="")
- {
- $Query=R::getRow("SELECT pw FROM users WHERE username =:username",array(":username"=>$username));
- if(count($Query)>0)
- {
- if($pw===$Query["pw"])
- {
- print("Password match");
- //do what every you want here after password match
- }
- }
- else
- {
- echo $error;
- }
- R::freeze(true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement