C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$R30CG93\tcpro\verify.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php
/**
 * verify.php
 * 
 * Verifies a user registration 
 * 
 * @package TeamCalPro
 * @version 3.3.001 
 * @author George Lewe
 * @copyright Copyright (c) 2004-2010 by George Lewe
 * @link http://www.lewe.com
 * @license http://www.lewe.com/tcpro/doc/license.txt Extended GNU Public License
 */

//echo "<script type=\"text/javascript\">alert(\"Debug: \");</script>";

/**
 * Set parent flag to control access to child scripts 
 */
define'_VALID_TCPRO');

/**
 * Includes 
 */
require ("config.tcpro.php");
require_once (
"includes/functions.tcpro.php");
getOptions();
if (
strlen($CONF['options']['lang'])) require ("includes/lang/" $CONF['options']['lang'] . ".tcpro.php");
else                                  require (
"includes/lang/english.tcpro.php");

require_once (
"includes/tcconfig.class.php");
require_once (
"includes/tclog.class.php");
require_once (
"includes/tcuser.class.php");
require_once (
"includes/tcuseroption.class.php");

$C = new tcConfig;
$LOG = new tcLog;
$U = new tcUser;
$UA = new tcUser;
$UO = new tcUserOption;

$error false;
$info false;

/**
 * Check URL request parameter 
 */
if (!isset ($_REQUEST['verify']) || !isset ($_REQUEST['username']) || strlen($_REQUEST['verify'])<>32 ) {
   
/*
    * Link is incomplete or corrupt 
    */
   
$error $LANG['verify_err_link'];
}
else {
   
$rverify trim($_REQUEST['verify']);
   
$ruser trim($_REQUEST['username']);
   if (
$fverify $UO->find($ruser"verifycode")) {
      if (
$fverify == $rverify) {
         
/**
          * Found the user and a matching verify code 
          */
         
$UO->deleteUserOption($ruser"verifycode");
         
$info $LANG['verify_info_success'];
         
$U->findByName($ruser);
         
$fullname $U->firstname " " $U->lastname;
         if (
$C->readConfig("adminApproval")) {
            
/**
             * Success but admin needs to approve 
             */
            
$UA->findByName("admin");
            
$subject $LANG['verify_mail_subject'];
            
$message $LANG['verify_mail_greeting'];
            
$message .= $LANG['verify_mail_message'];
            
$message str_replace("[USERNAME]",$U->username,$message);
            
$to $UA->email;
            
$headers "From: " $C->readConfig("mailFrom") . "\r\n" "Reply-To: " $C->readConfig("mailReply") . "\r\n";
            
mail($tostripslashes($subject), stripslashes($message), $headers);
            
            
$info .= $LANG['verify_info_approval'];
            
$LOG->log("logRegistration"$U->username"User verified, approval needed: " $U->username " (" $fullname ")");
         }
         else {
            
/**
             * Success and no approval needed. Unlock and unhide user. 
             */
            
$U->clearStatus($CONF['USLOCKED']);
            
$U->clearStatus($CONF['USHIDDEN']);
            
$U->update($U->username);
            
$LOG->log("logRegistration"$U->username"User verified, unlocked and unhidden: " $U->username " (" $fullname ")");
         }  
      }
      else {
         
/**
          * Found the user but verify code does not match 
          */
         
$error $LANG['verify_err_match'];
         
$LOG->log("logRegistration"$U->username"User verification code does not match: " $U->username " (" $fullname "): ".$rverify);
      }
   }
   else {
      
/**
       * Found no verify code or there is none for this user 
       */
      
if (!$U->findByName($ruser)) {
         
/**
          * No surprise, the user dos not exist 
          */
         
$error $LANG['verify_err_user'];
         
$LOG->log("logRegistration"$ruser"User does not exist: " $ruser." : ".$rverify);
      }
      else {
         
/**
          * Verfiy code does not exist 
          */
         
$error $LANG['verify_err_code'];
         
$LOG->log("logRegistration"$ruser"Verification code does not exist: " $ruser " : ".$rverify);
      }
   }
}

/**
 * Show HTML header
 * Use this file to adjust your meta tags and such
 */
require("includes/header.html.inc.php");

echo 
"<body>\r\n";
echo 
"<div id=\"overDiv\" style=\"position:absolute; visibility:hidden; z-index:1000;\"></div>\r\n";

/**
 * Show application header
 * This is the file to change in order to put different images at the top
 * of the main page.
 */
require("includes/header.application.inc.php");

/**
 * Show menu header
 * This is the file containing the TeamCal menu
 */
require("includes/menu.inc.php");
?>
   <table class="dlg">
      <tr>
         <td class="dlg-header" colspan="3">
            <?php printDialogTop($LANG['verify_title'],"","ico_register.png"); ?>
         </td>
      </tr>
   </table>
   <table class="dlg">
      <tr>
         <td class="dlg-body" style="padding-left: 8px;">
            <?php if ( strlen($error) ) { ?>
               <?php printDialogFrameTop($LANG['verify_result'],"0"); ?>
               <table class="dlg-frame">
                  <tr>
                     <td class="dlg-body" colspan="2">
                        <div class="erraction">
                        <?=$error?>
                        </div>
                     </td>
                  </tr>
               </table>
               <?php printDialogFrameBottom(); ?>
            <?php } elseif (strlen($info)) { ?>
               <?php printDialogFrameTop($LANG['verify_result'],"0"); ?>
               <table class="dlg-frame">
                  <tr>
                     <td class="dlg-body" colspan="2">
                        <div class="class">
                        <?=$info?>
                        </div>
                     </td>
                  </tr>
               </table>
               <?php printDialogFrameBottom(); ?>
            <?php ?>
            <br>

         </td>
      </tr>
   </table>
    
<?php
require("includes/footer.html.inc.php");
?>