Форум программистов, компьютерный форум, киберфорум
PHP
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
8 / 8 / 3
Регистрация: 15.08.2009
Сообщений: 132
1

Нужна помощь с Social Engine в системе регистрации

09.09.2009, 15:49. Показов 2474. Ответов 0
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Привет всем!
Дали мне задачку в этом движке в процессе регистрации добавить форму загрузки документов. Добиться отображение этой формы мне удалось. Но при попытке загрузить меня бросает на страницу где отображается все поля разных категорий пользователей. И не могу понять в чем дело. Я сделал так же само как при загрузки обычной фотографии только подправил поля где хранить имя файла и номера шагов.
signup.tpl
HTML5
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
.......
 
{elseif $step == 500433}
<img src='./images/icons/signup48.gif' border='0' class='icon_big'>
  <div class='page_header'>{lang_print id=710}</div>
  <div>{lang_print id=1100037}</div><br>
  <br><br>
<table cellpadding='0' cellspacing='0' align='center' width='450'>
<tr><td class='signup_header1'>{lang_print id=500439}</td></tr>
    <tr>
        <td class='signup_photo'>
            <form action='signup.php' method='POST' enctype='multipart/form-data'>
            <table cellpadding='0' cellspacing='0'>
                <tr>
                    <td class='form1' width='100'>
                        {lang_print id=1100038}*
                    </td>
                    <td class='form2'>
                        <input type="file" class="Text" size="40" name="diplom" />
                    </td>
                </tr>
                <td class='form1' width='100'>
                    {lang_print id=1100039}*
                </td>
                <td class='form2'>
                    <input type="file" class="Text" size="40" name="svidotstvo" />
                </td>
            </table>
            <input type='submit' class='button' value='{lang_print id=714}'>
            <input type='hidden' name='step' value='{$step}'>
            <input type='hidden' name='task' value='{$next_task}'>
            <input type='hidden' name='MAX_FILE_SIZE' value='5000000'>
            </form>
            
        </td>
</table>
<br>
{* SHOW USER PHOTO IF ONE HAS BEEN UPLOADED, OTHERWISE SHOW SKIP BUTTON *} {if $new_user->user_photo_document1()
!= "" || $new_user->user_photo_document2() !=""}
<div class='center'>
{lang_print id=1100038}<br>
    <img src='{$new_user->user_photo_document1()}' border='0' class='photo'><br>
    {lang_print id=1100039}<br />
    <img src='{$new_user->user_photo_document2()}' border='0' class='photo'><br>
    <br>
    <form action='signup.php' method='POST'>
    <input type='submit' class='button' value='{lang_print id=716}'>
    <input type='hidden' name='task' value='{$last_task}'>
    </form>
</div>
{/if}
.....
signup.php
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
......
 
if($task == "step1" || $task == "step1do" || $task == "step2" || $task == "step2do" || $task = "step500433"  || $task = "step500433do")
{
    if($database->database_num_rows($database->database_query("SELECT NULL FROM se_profilecats WHERE profilecat_id='$signup_cat' AND profilecat_dependency='0'")) != 1)
    {
        $cat_info = $database->database_fetch_assoc($database->database_query("SELECT profilecat_id FROM se_profilecats WHERE profilecat_dependency='0' ORDER BY profilecat_order LIMIT 1"));
        $signup_cat = $cat_info['profilecat_id'];
    }
    if($task == "step2do") { $validate = 1; } else { $validate = 0; }
    if($task != "step1") { $cat_where = "profilecat_signup='1' AND profilecat_id='$signup_cat'"; } else { $cat_where = "profilecat_signup='1'"; }
    $field = new se_field("profile");
    $field->cat_list($validate, 0, 0, $cat_where, "", "profilefield_signup='1'");
    $cat_array = $field->cats;
    if($task != "step1" && count($cat_array) == 0) { $task = "step1"; }
    if($validate == 1) { $is_error = $field->is_error; }
    if($task != "step1" && count($field->fields_all) == 0) { $task = "step2do"; }
}
 
 
if($task == "step2do")
{
    // PROFILE FIELD INPUTS PROCESSED AND CHECKED FOR ERRORS ABOVE
    // IF THERE IS NO ERROR, ADD USER AND USER PROFILE AND CONTINUE TO STEP 3
    if($is_error == 0)
    {
        $new_user->user_create($signup_email, $signup_username, $signup_password, $signup_timezone, $signup_lang, $signup_cat, $signup_country, $signup_region, $signup_city, $field->field_query);
        
        // INVITE CODE FEATURES
        if($setting['setting_signup_invite'] != 0)
        {
            if($setting['setting_signup_invite_checkemail'] != 0)
            {
                $invitation = $database->database_fetch_assoc($database->database_query("SELECT * FROM se_invites WHERE invite_code='$signup_invite' AND invite_email='$signup_email' LIMIT 1"));
            }
            else
            {
                $invitation = $database->database_fetch_assoc($database->database_query("SELECT * FROM se_invites WHERE invite_code='$signup_invite' LIMIT 1"));
            }
 
            // ADD USER TO INVITER'S FRIENDLIST
            $friend = new se_user(Array($invitation['invite_user_id']));
            if($friend->user_exists == 1)
            {
                if($setting['setting_connection_allow'] == 3 || $setting['setting_connection_allow'] == 1 || ($setting['setting_connection_allow'] == 2 && $new_user->user_info['user_subnet_id'] == $friend->user_info['user_subnet_id']))
                {
                    // SET RESULT, DIRECTION, STATUS
                    switch($setting['setting_connection_framework'])
                    {
                        case "0":
                            $direction = 2;
                            $friend_status = 0;
                            break;
                        case "1":
                            $direction = 1;
                            $friend_status = 0;
                            break;
                        case "2": 
                            $direction = 2;
                            $friend_status = 1;
                            break;
                        case "3":
                            $direction = 1;
                            $friend_status = 1;
                            break;      
                    } 
                    
                    // INSERT FRIENDS INTO FRIEND TABLE AND EXPLANATION INTO EXPLAIN TABLE            
                    $friend->user_friend_add($new_user->user_info['user_id'], $friend_status, '', '');
                    
                    // IF TWO-WAY CONNECTION AND NON-CONFIRMED, INSERT OTHER DIRECTION
                    if($direction == 2 && $friend_status == 1) { $new_user->user_friend_add($friend->user_info['user_id'], $friend_status, '', ''); }
                }
            }
            
            // DELETE INVITE CODE
            $database->database_query("DELETE FROM se_invites WHERE invite_id='$invitation[invite_id]' LIMIT 1");
        }
        
        // SET SIGNUP COOKIE
        $new_user->user_salt = $new_user->user_info['user_code'];
        $id = $new_user->user_info['user_id'];
        $em = $new_user->user_password_crypt($new_user->user_info['user_email']);
        $pass = $new_user->user_info['user_password'];
        setcookie("signup_id", "$id", 0, "/");
        setcookie("signup_email", "$em", 0, "/");
        setcookie("signup_password", "$pass", 0, "/");
        
        // SEND USER TO PHOTO UPLOAD IF SPECIFIED BY ADMIN
        // OR TO USER INVITE IF NO PHOTO UPLOAD
        /*if( !$setting['setting_signup_photo'] )
        { 
            if( !$setting['setting_signup_invitepage'] )
            {
                $task = "step5";
            }
            else
            {
                $task = "step4"; 
            }
        }
        else
        { 
            $task = "step3"; 
        }*/
        switch($signup_cat)
        {
            case "1":
                $task = "step3";
                break;
            case "10":
                $task = "step500433";
                break;
            case "2":
                $task = "step500363";
                break;
            case "11":
                $task = "step500434";
                break;
            case "12":
                $task = "step500435";
                break;
            case "22":
                $task = "step500555";
                break;          
        }
        
    }
    
    // IF THERE WAS AN ERROR, GO BACK TO STEP 2
    else
    {
        $task = "step2";
    }
}
 
 
 
if($task == "step500433")
{
    $step = 500433;
    $next_task = "step500433do";
    if($setting['setting_signup_invitepage'] == 0) { $last_task = "step5"; } else { $last_task = "step4"; }
}
 
if($task == "step500433do")
{
    $new_user->user_photo_document1_upload("diplom");
    $new_user->user_photo_document2_upload("svidotstvo");
    $is_error = $new_user->is_error;
    $task = "step500433";       
}
 
// UPLOAD PHOTO
if($task == "step3do")
{
    $new_user->user_photo_upload("photo");
    $is_error = $new_user->is_error;
    $task = "step3";
}
 
 
// SEND INVITE EMAILS
if($task == "step4do")
{
    $invite_emails = $_POST['invite_emails'];
    $invite_message = $_POST['invite_message'];
 
    if($invite_emails != "")
    {
        send_systememail('invite', $invite_emails, Array($new_user->user_displayname, $new_user->user_info['user_email'], $invite_message, "<a href=\"".$url->url_base."signup.php\">".$url->url_base."signup.php</a>"), TRUE);
    }
 
    // SEND USER TO THANK YOU PAGE
    $task = "step5";
}
 
 
// SIGNUP TERMINAL VELOCITY POINT HOOK
($hook = SE_Hook::exists('se_signup_decide')) ? SE_Hook::call($hook, array()) : NULL; 
 
 
 
 
 
 
 
// SHOW COMPLETION PAGE
if($task == "step5")
{
    // UNSET SIGNUP COOKIES
    setcookie("signup_id", "", 0, "/");
    setcookie("signup_email", "", 0, "/");
    setcookie("signup_password", "", 0, "/");
 
    // UPDATE SIGNUP STATS
    update_stats("signups");
 
    // DISPLAY THANK YOU
    $step = 5;
}
 
 
 
 
// SHOW FOURTH STEP
if($task == "step4")
{
    $step = 4;
    $next_task = "step4do";
    if($setting['setting_signup_invitepage'] == 0) { $task = "step3"; }
}
 
 
 
 
 
// SHOW THIRD STEP
if($task == "step3")
{
    $step = 3;
    $next_task = "step3do";
    if($setting['setting_signup_invitepage'] == 0) { $last_task = "step5"; } else { $last_task = "step4"; }
    if($setting['setting_signup_photo'] == 0) { $task = "step2"; }
}
 
.....
class_user.php
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
....
 
// THIS METHOD UPLOADS A USER PHOTO ACCORDING TO SPECIFICATIONS AND RETURNS USER PHOTO
    // INPUT: $photo_name REPRESENTING THE NAME OF THE FILE INPUT
    // OUTPUT: 
    
    function user_photo_upload($photo_name)
    {
        global $database, $url;
        
        // ENSURE USER DIRECTORY IS ADDED
        $user_directory = $url->url_userdir($this->user_info['user_id']);
        $user_path_array = explode("/", $user_directory);
        array_pop($user_path_array);
        array_pop($user_path_array);
        $subdir = implode("/", $user_path_array)."/";
        if( !is_dir($subdir) )
        { 
            mkdir($subdir, 0777); 
            chmod($subdir, 0777); 
            $handle = fopen($subdir."index.php", 'x+');
            fclose($handle);
        }
        if( !is_dir($user_directory) )
        {
            mkdir($user_directory, 0777);
            chmod($user_directory, 0777);
            $handle = fopen($user_directory."/index.php", 'x+');
            fclose($handle);
        }
        
        // SET KEY VARIABLES
        $file_maxsize = "4194304";
        $file_exts = explode(",", str_replace(" ", "", strtolower($this->level_info['level_photo_exts'])));
        $file_types = explode(",", str_replace(" ", "", strtolower("image/jpeg, image/jpg, image/jpe, image/pjpeg, image/pjpg, image/x-jpeg, x-jpg, image/gif, image/x-gif, image/png, image/x-png")));
        $file_maxwidth = $this->level_info['level_photo_width'];
        $file_maxheight = $this->level_info['level_photo_height'];
        $photo_newname = "0_".rand(1000, 9999).".jpg";
        $file_dest = $url->url_userdir($this->user_info['user_id']).$photo_newname;
        $thumb_dest = substr($file_dest, 0, strrpos($file_dest, "."))."_thumb".substr($file_dest, strrpos($file_dest, "."));
        
        $new_photo = new se_upload();
        $new_photo->new_upload($photo_name, $file_maxsize, $file_exts, $file_types, $file_maxwidth, $file_maxheight);
        
        // UPLOAD AND RESIZE PHOTO IF NO ERROR
        if( !$new_photo->is_error )
        {
            // DELETE OLD AVATAR IF EXISTS
            $this->user_photo_delete();
            
            // UPLOAD THUMB
            $new_photo->upload_thumb($thumb_dest);
            
            // CHECK IF IMAGE RESIZING IS AVAILABLE, OTHERWISE MOVE UPLOADED IMAGE
            if( $new_photo->is_image )
            {
                $new_photo->upload_photo($file_dest);
            }
            else
            {
                $new_photo->upload_file($file_dest);
            }
            
            // UPDATE USER INFO WITH IMAGE IF STILL NO ERROR
            if( !$new_photo->is_error )
            {
                $database->database_query("UPDATE se_users SET user_photo='{$photo_newname}' WHERE user_id='{$this->user_info['user_id']}' LIMIT 1");
                $this->user_info['user_photo'] = $photo_newname;
            }
        }
        
        $this->is_error = $new_photo->is_error;
    }
    
    // END user_photo_upload() METHOD
 
    ////Метод загрузка фотокопии документа
    function user_photo_document1_upload($photo_name)
    {
        global $database, $url;
        
        // ENSURE USER DIRECTORY IS ADDED
        $user_directory = $url->url_userdir($this->user_info['user_id']);
        $user_path_array = explode("/", $user_directory);
        array_pop($user_path_array);
        array_pop($user_path_array);
        $subdir = implode("/", $user_path_array)."/";
        if( !is_dir($subdir) )
        { 
            mkdir($subdir, 0777); 
            chmod($subdir, 0777); 
            $handle = fopen($subdir."index.php", 'x+');
            fclose($handle);
        }
        if( !is_dir($user_directory) )
        {
            mkdir($user_directory, 0777);
            chmod($user_directory, 0777);
            $handle = fopen($user_directory."/index.php", 'x+');
            fclose($handle);
        }
        
        // SET KEY VARIABLES
        $file_maxsize = "4194304";
        $file_exts = explode(",", str_replace(" ", "", strtolower($this->level_info['level_photo_exts'])));
        $file_types = explode(",", str_replace(" ", "", strtolower("image/jpeg, image/jpg, image/jpe, image/pjpeg, image/pjpg, image/x-jpeg, x-jpg, image/gif, image/x-gif, image/png, image/x-png")));
        $file_maxwidth = $this->level_info['level_photo_width'];
        $file_maxheight = $this->level_info['level_photo_height'];
        $photo_newname = "document1.jpg";
        $file_dest = $url->url_userdir($this->user_info['user_id']).$photo_newname;
        $thumb_dest = substr($file_dest, 0, strrpos($file_dest, "."))."_thumb".substr($file_dest, strrpos($file_dest, "."));
        
        $new_photo = new se_upload();
        $new_photo->new_upload($photo_name, $file_maxsize, $file_exts, $file_types, $file_maxwidth, $file_maxheight);
        
        // UPLOAD AND RESIZE PHOTO IF NO ERROR
        if( !$new_photo->is_error )
        {
            // DELETE OLD AVATAR IF EXISTS
            $this->user_photo_delete();
            
            // UPLOAD THUMB
            $new_photo->upload_thumb($thumb_dest);
            
            // CHECK IF IMAGE RESIZING IS AVAILABLE, OTHERWISE MOVE UPLOADED IMAGE
            if( $new_photo->is_image )
            {
                $new_photo->upload_photo($file_dest);
            }
            else
            {
                $new_photo->upload_file($file_dest);
            }
            
            // UPDATE USER INFO WITH IMAGE IF STILL NO ERROR
            if( !$new_photo->is_error )
            {
                
                $database->database_query("UPDATE se_users SET document1='{$photo_newname}' WHERE user_id='{$this->user_info['user_id']}' LIMIT 1");
 
                $this->user_info['document1'] = $photo_newname;
            }
        }
        
        $this->is_error = $new_photo->is_error;
    }
    ////Конец метода загрузки фотокопии документа
 
 
    ////Метод загрузка фотокопии документа
    function user_photo_document2_upload($photo_name)
    {
        global $database, $url;
        
        // ENSURE USER DIRECTORY IS ADDED
        $user_directory = $url->url_userdir($this->user_info['user_id']);
        $user_path_array = explode("/", $user_directory);
        array_pop($user_path_array);
        array_pop($user_path_array);
        $subdir = implode("/", $user_path_array)."/";
        if( !is_dir($subdir) )
        { 
            mkdir($subdir, 0777); 
            chmod($subdir, 0777); 
            $handle = fopen($subdir."index.php", 'x+');
            fclose($handle);
        }
        if( !is_dir($user_directory) )
        {
            mkdir($user_directory, 0777);
            chmod($user_directory, 0777);
            $handle = fopen($user_directory."/index.php", 'x+');
            fclose($handle);
        }
        
        // SET KEY VARIABLES
        $file_maxsize = "4194304";
        $file_exts = explode(",", str_replace(" ", "", strtolower($this->level_info['level_photo_exts'])));
        $file_types = explode(",", str_replace(" ", "", strtolower("image/jpeg, image/jpg, image/jpe, image/pjpeg, image/pjpg, image/x-jpeg, x-jpg, image/gif, image/x-gif, image/png, image/x-png")));
        $file_maxwidth = $this->level_info['level_photo_width'];
        $file_maxheight = $this->level_info['level_photo_height'];
        $photo_newname = "document2.jpg";
        $file_dest = $url->url_userdir($this->user_info['user_id']).$photo_newname;
        $thumb_dest = substr($file_dest, 0, strrpos($file_dest, "."))."_thumb".substr($file_dest, strrpos($file_dest, "."));
        
        $new_photo = new se_upload();
        $new_photo->new_upload($photo_name, $file_maxsize, $file_exts, $file_types, $file_maxwidth, $file_maxheight);
        
        // UPLOAD AND RESIZE PHOTO IF NO ERROR
        if( !$new_photo->is_error )
        {
            // DELETE OLD AVATAR IF EXISTS
            $this->user_photo_delete();
            
            // UPLOAD THUMB
            $new_photo->upload_thumb($thumb_dest);
            
            // CHECK IF IMAGE RESIZING IS AVAILABLE, OTHERWISE MOVE UPLOADED IMAGE
            if( $new_photo->is_image )
            {
                $new_photo->upload_photo($file_dest);
            }
            else
            {
                $new_photo->upload_file($file_dest);
            }
            
            // UPDATE USER INFO WITH IMAGE IF STILL NO ERROR
            if( !$new_photo->is_error )
            {
                
                $database->database_query("UPDATE se_users SET document2='{$photo_newname}' WHERE user_id='{$this->user_info['user_id']}' LIMIT 1");
                    $this->user_info['document2'] = $photo_newname;
            }
        }
        
        $this->is_error = $new_photo->is_error;
    }
    ////Конец метода загрузки фотокопии документа
 
......
Я вообще-то в рнр не силен, но руководству захотелось чтобы я занимался этим проектом.
Надеюсь на ввашу помощь
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
09.09.2009, 15:49
Ответы с готовыми решениями:

Engine Social
Не нашол раздела для Socialengine, но разработчик один. Поэтому спрашиваю. Подходят ли модули и...

Нужна помощь добавление регистрации
Здравствуйте все! У меня есть сайт написан на html и там есть отдельное поле под авторизацию, я с...

Social Engine 4.3.0 шаблоны и т.д
Есть ли у кого шаблоны или плагины , что там еще бывает...дополнения какие-нибудь? только не...

Навигационная панель в Social Engine
http://s1.ipicture.ru/uploads/20110625/X66eFWW3.png Ребят, вот картинка, на ней выделил...

0
09.09.2009, 15:49
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
09.09.2009, 15:49
Помогаю со студенческими работами здесь

Нужна помощь по системе шифрования
Коллеги, предложите, пожалуйста, систему шифрования, - в которой КАЖДЫЙ символ шифрограммы...

Jom Social (отправка писем при регистрации)
Подскажите, как настроить Jom Social чтобы при регистрации нового пользователя ему отправлялся мой...

Смысл регистрации dll в системе?
Добрый день. Кто-нибудь может доступно объяснить смысл регистрации dll-библиотек в системе? Зачем...

Требуется помощь с формой регистрации.
Здравствуйте, недавно решил создать сайт, и вот пришло время для создания регистрации. Решил...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
1
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru