Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********************* WEB INTERFACE *********************/
- <div id="dialog_login" title="Login">
- <form style="height: 100px;">
- <div>
- Username
- </div>
- <div>
- <input type="text" name="diabox_username" class="text ui-widget-content ui-corner-all" />
- </div>
- <div style="padding-top: 5px;">
- Password
- </div>
- <div>
- <span><input type="password" name="diabox_password" value="" class="text ui-widget-content ui-corner-all" /></span>
- </div>
- <div id="diabox_information">sdf</div>
- </form>
- </div>
- /************* JQUERY *****************/
- <script type="text/javascript">
- $(function(){
- $( "#dialog_login" ).dialog({
- autoOpen: false,
- height: 253,
- width: 250,
- resizable: true,
- draggable: false,
- modal: true,
- buttons: {
- "Login": function() {
- $data = "do=validateLogin";
- $data += "&username=" + $("#dialog_login input:[name=diabox_username]").val();
- $data += "&password=" + $("#dialog_login input:[name=diabox_password]").val();
- $.ajax({
- url: "/inc/user.bridge.php",
- type: "POST",
- data: $data,
- success: function(msg){
- alert(msg);
- //$("#diabox_information").html(msg);
- }
- });
- }
- }
- });
- // Dialog Link
- $('#bt_login').click(function(){
- $('#dialog_login').dialog('open');
- return false;
- });
- });
- </script>
- /*********** BRIDGE ****************/
- if ($_POST['do'] == "validateLogin")
- {
- echo "test";
- /*$db_connection->connect();
- $username = $_POST['username'];
- $password = $_POST['password'];
- $usertype = $user->checkLogin($username, $password);
- echo $usertype;
- switch($usertype)
- {
- case 1: //Tipe user 'EXPERT
- break;
- case 2: //Tipe user 'ADMIN'
- break;
- case 3: //Tipe user 'CUSTOMER'
- echo "<script>window.location.href='/user/index.php'</script>";
- break;
- default: echo "wrong username or password";
- }
- $db_connection->disconnect();
- */
- }
- /********************* PHP CLASS *********************/
- function checkLogin ($username, $password)
- {
- $this->query = "SELECT user_type
- FROM user
- WHERE username = $username
- AND password = $password;";
- $this->result = mysql_query ($this->query);
- $result = mysql_result($this->result, 0, 'user_type');
- if ($this->result) //Username tersebut ada
- return $result;
- else //Username tersebut ga ada
- return 0;
- }
Add Comment
Please, Sign In to add comment