Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/loginout_wp.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 80 - (show annotations) (download) (as text)
Tue Jul 16 01:09:57 2013 UTC (10 years, 10 months ago) by isao-hara
File MIME type: application/x-httpd-php
File size: 2042 byte(s)
Update Siwiki, many bug fixed.... on 2013/07/16
1 <?php
2 include("siwiki.header.php");
3
4 ChkVal($cmd,'cmd','');
5 if(isset($_SESSION['uid'])){
6 ChkVal($uid,'uid', $_SESSION['uid']);
7 }else{
8 ChkVal($uid,'uid', "");
9 }
10 ChkVal($passwd,'passwd','');
11 ChkVal($is_ajax,'ajax',0);
12
13 $check_user = check_user($uid, $passwd, "system");
14 if($check_user < SYSTEM_ADMIN){
15 $check_user = check_user($uid, $passwd);
16 }
17
18 $menu = "";
19
20 if(!$cmd){
21 }else if($cmd == "logout"){
22 $_SESSION['tally'] = "";
23 $_SESSION['uid'] = "";
24 $check_user = 0;
25
26 }else if($cmd == "register"){
27 if( registerUser($uid, $passwd) ) $check_user= -1;
28 else $check_user= 0;
29
30 }else if($cmd == "login"){
31 if($check_user < GUEST_USER){
32 $check_user = check_user($uid, $passwd);
33
34 if($check_user >= GUEST_USER){
35 $_SESSION['uid']=$uid;
36 }else if($check_user == -1){
37 $content .= "$uid is not activated.<br> ";
38 }else if($check_user == -2){
39 $content .= "$uid is not registerd.<br> ";
40 }else if($check_user == -3){
41 $content .= "DB error.<br> ";
42 }else{
43 if($uid) $content .= "$uid ($passwd) authrization failed.<br> ";
44 }
45 }else{
46 ;
47 }
48 }else if($cmd == "activate"){
49 activateUser($uid);
50 $content .= "$uid, user account is activated.<br>";
51 }else{
52 }
53
54 if($check_user != 1) $passwd='';
55
56 if($is_ajax==0){
57 $topdir=$_SIWIKI['top'];
58 $content .=<<<_HTML
59 <script type="text/javascript" src="$topdir/themes/default/style.js"></script>
60 <script type="text/javascript" src="$topdir/themes/siwiki.js"></script>
61 <div id="login">
62 _HTML;
63 }
64
65 $content .= loginPrompt_ajax_wp($_SIWIKI['top']."/loginout_wp.php", $uid, $passwd, $check_user);
66 if($is_ajax==0){
67 $content .= "</div>";
68 }
69
70 $login_content = urlencode($content);
71
72 if($check_user >= 1){
73 $current= getCurrentPage();
74 $menu .= "<hr>".siwiki_menu($current);
75 $menu_content = urlencode($menu);
76 }else{
77 $menu_content = "";
78 }
79
80 $json = "{\"login\":\"$login_content\", \"menu\":\"$menu_content\"}";
81
82 if($is_ajax==1){
83 header("Content-type: application/json; charset=\"UTF-8\"");
84 print $json;
85 }else{
86 include($_SIWIKI['template']);
87 }
88 ?>

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26