When I use Qooxdoo design application system, through the need to design the login portal of the system, if the direct use of Qooxdoo to create a two drawbacks, one is the login interface is not very personalized design, and the other is the load speed issue at logon, So I usually use the Qooxdoo system when the login interface units into an HTML file, and then through the Ajax for the user name and password verification work, if the verification by using JS to point the page address to the Qooxdoo portal file. In this way, you need to pass the login user name, user ID, and other systems to Qooxdoo. I use the following methods:
Background login information is as follows:
<?phpsession_start (); include ". /options/db_settings.php "; $UserName = $_post[' UserName '); $UserPWD = $_post[' userpwd ']; $rs = $DBConn->execute (" Select User_id,login_pwd,user_name,user_role,lk_department.dept_id,dept_name,dept_kind from Lk_user_info,lk_ Department where lk_user_info.dept_id = lk_department.dept_id and Login_name= ' ". $UserName. "'"), if (! $rs->eof) {if ($rs->fields[' login_pwd ') = = Strtoupper (MD5 ($UserPWD))) {if ($rs->fields[' Dept_ Kind '] = = 1) | | ($rs->fields[' dept_kind '] = = 2)) {$arr [' status '] = 1; $arr [' Role ']= $rs->fields[' user_role ']; $arr [' msg '] = '; $_session[' logined '] =true;$_session[ ' user_id ' = $rs->fields[' user_id '];$_session[' user_name ']= $rs->fields[' user_name '];$_session[' user_role '] = $rs->fields[' user_role '];$_session[' dept_id '] = $rs->fields[' dept_id '];$_session[' dept_name ']= $rs- fields[' Dept_name ');} else {$arr [' status '] = 0; $arr [' Role ']=0; $arr [' msg '] = ' The user's unit does not have permission to log in! ';}} else {$arr [' status '] = 0; $arr [' Role ']=0; $arr [' msg '] =' Login password error, please re-enter! ';}} else {$arr [' status '] = 0; $arr [' Role ']=0; $arr [' msg '] = ' User name error, please reenter! ';} echo Json_encode ($arr);? >
And application.php is Qooxdoo's import file index.html to be modified, the specific content is as follows:
<?phpsession_start (); if (Isset ($_session[' logined ') && ($_session[' logined ') = = True)) {? ><! DOCTYPE html>
The use of this file in the PHP session to determine whether to log on, and after logging in using the $ $environment parameter to the user's user information to the Qooxdoo system. The code for the parameters in the Qooxdoo system is as follows:This.setuserid (Qx.core.Environment.get ("UserID")); This.setusername (Qx.core.Environment.get ("UserName")); This.setdeptid (Qx.core.Environment.get ("DeptID")); This.setdeptname (Qx.core.Environment.get ("Deptname")); This.setuserrole (parseint (Qx.core.Environment.get ("userrole"));
Passing external parameters to the Qooxdoo application system with environment variable settings