Форум программистов, компьютерный форум, киберфорум
PHP для начинающих
Войти
Регистрация
Восстановить пароль
Другие темы раздела
PHP Как отобразить переменную в другом файле? https://www.cyberforum.ru/ php-beginners/ thread829003.html
т.к в php я почти ноль я бы хотел разобраться с: $_wptuts_timeplace_time_output = wp_kses($_wptuts_timeplace_time, $allowed_html); мне нужно вывести в index.php $_wptuts_timeplace_time пытался вывести ее с помощью <?php echo "$_wptuts_timeplace_storyline" ?> ничего не происходит...сама переменная описывается в другом файле
Потери при чтении файла PHP
Есть текстовый файл с записанными адресами почтовых ящиков вида "Имя Фамилия <ящик@домен.ru>\n" читаю файл и получаю только "Имя Фамилия". Что не так? $f = fopen($fname='sourceaddress.txt',"rt"); $file = explode("\n", fread($f,filesize($fname))); var_dump($file);
PHP Есть здесь ошибка? <img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $postimageurl; ?> Когда убираю апострафы 'template_directory' ошибка пропадает но не работает https://www.cyberforum.ru/ php-beginners/ thread828900.html PHP Передача по ссылке https://www.cyberforum.ru/ php-beginners/ thread828849.html
Что-то я совсем запутался с этим понятием. Припустим я хочу реализовать нечто подобное: function add_some_extra() { global $str; $str .= 'and something extra.'; } $str = 'This is a string, '; add_some_extra($str); echo $str;
@$_GET - это что? PHP
Столкнулся с такой вот строкой, когда перебирал чужой код:@$_GET Что это такое и чем оно отличается от обычного гета без собаки? $_GET Спросить у автора не могу, гугл молчит.
PHP Счётчик просмотров Как написать счетчик просмотров по типу: Просмотров за 24 часа: Посетителей за 24 часа: Просмотров за 7 дней: Посетителей за 7 дней: Просмотров за 30 дней: Посетителей за 30 дней: https://www.cyberforum.ru/ php-beginners/ thread828820.html
PHP Продажа копий программы, как обезопасить себя от пиратов? https://www.cyberforum.ru/ php-beginners/ thread828817.html
Продажа копий программы, как обезопасить себя от пиратов и от изменения тарифных планов по программе (чтобы код не правили)?
PHP Вывод таблицы php + firebird
Доброго времени суток! Новичок в php. Пытаюсь разобраться со связкой php и fireberd Почему код выводит только пустые строки? <?php echo 'Пытаемся соедениться с базой...'."<br>\n"; $database = '192.168.1.22:tipo-test'; $user = 'SYSDBA'; $password = 'masterkey';
PHP криво генерируется карта сайта https://www.cyberforum.ru/ php-beginners/ thread828785.html
Есть код который генерирует sitemap.xml: <?php class Sitemap { const HEAD = "<\x3Fxml version=\"1.0\" encoding=\"UTF-8\"\x3F>\n\t<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"; const FOOT = "\t</urlset>"; private $items = array(); private static function escapeEntites($var){ $entities = array(
PHP Замена первого символа в строке https://www.cyberforum.ru/ php-beginners/ thread828747.html
Народ, как поменять первый символ в строке средствами php? Строка на <span>С</span>трока ? Символ "С", естественно, может быть любым. Спасибо заранее!
PHP выбор контента
Здравствуйте, Уважаемые! есть такая страничка index.php: <!DOCTYPE html> <html> <head> <title>Мои Увлечения!</title> <link href="css/style.css" rel="stylesheet" type="text/css"> </head> <body>
PHP кнопки соц сетец доброго времени суток. есть 5 страниц. на каждой есть кнопки от гугла вк фейсбука. как сделать что в них отображалась одинаковая информация. если на 1 странице кликнул пользователь на кнопку гугла +1 то и на всех других тоже считалось +1. помогите.... Добавлено через 1 час 6 минут доброго времени суток. есть 5 страниц. на каждой есть кнопки от гугла вк фейсбука. как сделать что в них... https://www.cyberforum.ru/ php-beginners/ thread828640.html
0 / 0 / 0
Регистрация: 05.04.2013
Сообщений: 7
07.04.2013, 14:22  [ТС] 0

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING - PHP - Ответ 4374272

07.04.2013, 14:22. Показов 4353. Ответов 12
Метки (Все метки)

Ответ

весь код:

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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
<?php
/*
=====================================================
 DataLife Engine - by SoftNews Media Group 
-----------------------------------------------------
 http://dle-news.ru/
-----------------------------------------------------
 Copyright (c) 2004,2012 SoftNews Media Group
=====================================================
 Данный код защищен авторскими правами
=====================================================
 Файл: register.php
-----------------------------------------------------
 Назначение: регистрация посетителя
=====================================================
*/
 
if( ! defined( 'DATALIFEENGINE' ) ) {
    die( "Hacking attempt!" );
}
 
require_once ENGINE_DIR . '/classes/parse.class.php';
 
$ipb_dle_lan[0] = "Данное имя уже используется на форуме."; 
$db_ipb_user = "пользователь"; 
$db_ipb_password = "пароль"; 
$db_ipb_namedb = "имя_базы"; 
$db_ipb_local = "localhost"; 
$db_ipb_error = 1; // 1 - показывать ошибки в соединении с бд форума, 0 - нет 
$db_prefix_ipb = "префикс_если_его_нету_оставить_пустым"; 
$ipb = new db; 
$ipb->connect($db_ipb_user, $db_ipb_password, $db_ipb_namedb, $db_ipb_local, $db_ipb_error);
 
$parse = new ParseFilter( );
$parse->safe_mode = true;
$parse->allow_url = false;
$parse->allow_image = false;
$stopregistration = FALSE;
 
if( isset( $_REQUEST['doaction'] ) ) $doaction = $_REQUEST['doaction']; else $doaction = "";
$config['reg_group'] = intval( $config['reg_group'] ) ? intval( $config['reg_group'] ) : 4;
 
function check_reg($name, $email, $password1, $password2, $sec_code = 1, $sec_code_session = 1) {
    global $lang, $db, $banned_info, $relates_word, $ipb, $ipb_dle_lan, $db_prefix_ipb;
    $stop = "";
    
    if( $sec_code != $sec_code_session OR !$sec_code_session ) $stop .= $lang['reg_err_19'];
    if( $password1 != $password2 ) $stop .= $lang['reg_err_1'];
    if( strlen( $password1 ) < 6 ) $stop .= $lang['reg_err_2'];
    if( strlen( $name ) > 20 ) $stop .= $lang['reg_err_3'];
    if( preg_match( "/[\||\'|\<|\>|\[|\]|\"|\!|\?|\$|\@|\/|\\\|\&\~\*\{\+]/", $name ) ) $stop .= $lang['reg_err_4'];
    if( empty( $email ) OR strlen( $email ) > 50 OR @count(explode("@", $email)) != 2) $stop .= $lang['reg_err_6'];
    if( $name == "" ) $stop .= $lang['reg_err_7'];
    if (strpos( strtolower ($name) , '.php' ) !== false) $stop .= $lang['reg_err_4'];
 
    
    if( count( $banned_info['name'] ) ) foreach ( $banned_info['name'] as $banned ) {
        
        $banned['name'] = str_replace( '\*', '.*', preg_quote( $banned['name'], "#" ) );
        
        if( $banned['name'] and preg_match( "#^{$banned['name']}$#i", $name ) ) {
            
            if( $banned['descr'] ) {
                $lang['reg_err_21'] = str_replace( "{descr}", $lang['reg_err_22'], $lang['reg_err_21'] );
                $lang['reg_err_21'] = str_replace( "{descr}", $banned['descr'], $lang['reg_err_21'] );
            } else
                $lang['reg_err_21'] = str_replace( "{descr}", "", $lang['reg_err_21'] );
            
            $stop .= $lang['reg_err_21'];
        }
    }
    
    if( count( $banned_info['email'] ) ) foreach ( $banned_info['email'] as $banned ) {
        
        $banned['email'] = str_replace( '\*', '.*', preg_quote( $banned['email'], "#" ) );
        
        if( $banned['email'] and preg_match( "#^{$banned['email']}$#i", $email ) ) {
            
            if( $banned['descr'] ) {
                $lang['reg_err_23'] = str_replace( "{descr}", $lang['reg_err_22'], $lang['reg_err_23'] );
                $lang['reg_err_23'] = str_replace( "{descr}", $banned['descr'], $lang['reg_err_23'] );
            } else
                $lang['reg_err_23'] = str_replace( "{descr}", "", $lang['reg_err_23'] );
            
            $stop .= $lang['reg_err_23'];
        }
    }
    
    if( $stop == "" ) {
        $name = strtolower( $name );
        $search_name = strtr( $name, $relates_word );
        
        $row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE email = '$email' OR LOWER(name) REGEXP '[[:<:]]{$search_name}[[:>:]]' OR name = '$name'" );
        
                $ipb_test_name = $ipb->super_query ("SELECT COUNT() as count FROM {$db_prefix_ipb}members where name = '".strtolower($name)."'"); 
                if ($ipb_test_name ['count'] > 0) $stop .= $ipb_dle_lan[0]; 
 
        if( $row['count'] ) $stop .= $lang['reg_err_8'];
    }
    
    return $stop;
 
}
 
if( $config['allow_registration'] != "yes" ) {
    
    msgbox( $lang['all_info'], $lang['reg_err_9'] );
    $stopregistration = TRUE;
 
} elseif( $config['max_users'] > 0 ) {
 
    $row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users" );
 
    if ( $row['count'] >= $config['max_users'] ) {  
        msgbox( $lang['all_info'], $lang['reg_err_10'] );
        $stopregistration = TRUE;
    }
 
}
 
if( isset( $_POST['submit_reg'] ) ) {
    
    if( $config['allow_sec_code'] == "yes" ) {
 
        if ($config['allow_recaptcha']) {
 
            require_once ENGINE_DIR . '/classes/recaptcha.php';
            $sec_code = 1;
            $sec_code_session = false;
 
            if ($_POST['recaptcha_response_field'] AND $_POST['recaptcha_challenge_field']) {
            
                $resp = recaptcha_check_answer ($config['recaptcha_private_key'],
                                                 $_SERVER["REMOTE_ADDR"],
                                                 $_POST['recaptcha_challenge_field'],
                                                 $_POST['recaptcha_response_field']);
            
                    if ($resp->is_valid) {
 
                        $sec_code = 1;
                        $sec_code_session = 1;
 
                    }
            }
 
        } else {
            $sec_code = $_POST['sec_code'];
            $sec_code_session = ($_SESSION['sec_code_session'] != '') ? $_SESSION['sec_code_session'] : false;
        }
 
    } else {
        $sec_code = 1;
        $sec_code_session = 1;
    }
    
    $password1 = $_POST['password1'];
    $password2 = $_POST['password2'];
    $name = $db->safesql( $parse->process( htmlspecialchars( trim( $_POST['name'] ) ) ) );
    $name = preg_replace('#\s+#i', ' ', $name);
 
    $not_allow_symbol = array ("\x22", "\x60", "\t", '\n', '\r', "\n", "\r", '\\', ",", "/", "¬", "#", ";", ":", "~", "[", "]", "{", "}", ")", "(", "*", "^", "%", "$", "<", ">", "?", "!", '"', "'", " " );
    $email = $db->safesql(trim( str_replace( $not_allow_symbol, '', strip_tags( stripslashes( $_POST['email'] ) ) ) ) );
 
    $reg_error = check_reg( $name, $email, $password1, $password2, $sec_code, $sec_code_session );
 
    if( $config['reg_question'] ) {
 
        if ( intval($_SESSION['question']) ) {
 
            $answer = $db->super_query("SELECT id, answer FROM " . PREFIX . "_question WHERE id='".intval($_SESSION['question'])."'");
 
            $answers = explode( "\n", $answer['answer'] );
 
            $pass_answer = false;
 
            if( function_exists('mb_strtolower') ) {
                $question_answer = trim(mb_strtolower($_POST['question_answer'], $config['charset']));
            } else {
                $question_answer = trim(strtolower($_POST['question_answer']));
            }
 
            if( count($answers) AND $question_answer ) {
                foreach( $answers as $answer ){
 
                    if( function_exists('mb_strtolower') ) {
                        $answer = trim(mb_strtolower($answer, $config['charset']));
                    } else {
                        $answer = trim(strtolower($answer));
                    }
 
                    if( $answer AND $answer == $question_answer ) {
                        $pass_answer    = true;
                        break;
                    }
                }
            }
 
            if( !$pass_answer ) $reg_error .= $lang['reg_err_24'];
 
        } else $reg_error .= $lang['reg_err_24'];
    
    }
    
    if( ! $reg_error ) {
        
        if( $config['registration_type'] ) {
            
            include_once ENGINE_DIR . '/classes/mail.class.php';
            $mail = new dle_mail( $config );
            
            $row = $db->super_query( "SELECT template FROM " . PREFIX . "_email where name='reg_mail' LIMIT 0,1" );
            
            $row['template'] = stripslashes( $row['template'] );
            
            $idlink = rawurlencode( base64_encode( $name . "||" . $email . "||" . md5( $password1 ) . "||" . md5( sha1( $name . $email . DBHOST . DBNAME . $config['key'] ) ) ) );
            
            $row['template'] = str_replace( "{%username%}", $name, $row['template'] );
            $row['template'] = str_replace( "{%validationlink%}", $config['http_home_url'] . "index.php?do=register&doaction=validating&id=" . $idlink, $row['template'] );
            $row['template'] = str_replace( "{%password%}", $password1, $row['template'] );
            
            $mail->send( $email, $lang['reg_subj'], $row['template'] );
            
            if( $mail->send_error ) msgbox( $lang['all_info'], $mail->smtp_msg );
            else msgbox( $lang['reg_vhead'], $lang['reg_vtext'] );
            
            $_SESSION['sec_code_session'] = false;
            $_SESSION['question'] = false;
            
            $stopregistration = TRUE;
        
        } else {
            
            $doaction = "validating";
            $_REQUEST['id'] = rawurlencode( base64_encode( $name . "||" . $email . "||" . md5( $password1 ) . "||" . md5( sha1( $name . $email . DBHOST . DBNAME . $config['key'] ) ) ) );
        }
    
    } else {
        msgbox( $lang['reg_err_11'], "<ul>" . $reg_error . "</ul>" );
    }
 
}
 
if( $doaction != "validating" AND !$stopregistration ) {
    
    if( $_POST['dle_rules_accept'] == "yes" ) {
        
        $_SESSION['dle_rules_accept'] = "1";
    
    }
    
    if( $config['registration_rules'] and ! $_SESSION['dle_rules_accept'] ) {
        
        $_GET['page'] = "dle-rules-page";
        include ENGINE_DIR . '/modules/static.php';
    
    } else {
        
        $tpl->load_template( 'registration.tpl' );
        
        $tpl->set( '[registration]', "" );
        $tpl->set( '[/registration]', "" );
        $tpl->set_block( "'\\[validation\\](.*?)\\[/validation\\]'si", "" );
        $path = parse_url( $config['http_home_url'] );
 
        if( $config['reg_question'] ) {
 
            $tpl->set( '[question]', "" );
            $tpl->set( '[/question]', "" );
 
            $question = $db->super_query("SELECT id, question FROM " . PREFIX . "_question ORDER BY RAND() LIMIT 1");
            $tpl->set( '{question}', htmlspecialchars( stripslashes( $question['question'] ), ENT_QUOTES ) );
 
            $_SESSION['question'] = $question['id'];
 
        } else {
 
            $tpl->set_block( "'\\[question\\](.*?)\\[/question\\]'si", "" );
            $tpl->set( '{question}', "" );
 
        }
        
        if( $config['allow_sec_code'] == "yes" ) {
 
            if ( $config['allow_recaptcha'] ) {
 
                $tpl->set( '[recaptcha]', "" );
                $tpl->set( '[/recaptcha]', "" );
 
                $tpl->set( '{recaptcha}', '
<script language="javascript" type="text/javascript">
<!--
    var RecaptchaOptions = {
        theme: \''.$config['recaptcha_theme'].'\',
        lang: \''.$lang['wysiwyg_language'].'\'
    };
 
//-->
</script>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k='.$config['recaptcha_public_key'].'"></script>' );
 
                $tpl->set_block( "'\\[sec_code\\](.*?)\\[/sec_code\\]'si", "" );
                $tpl->set( '{reg_code}', "" );
 
            } else {
 
                $tpl->set( '[sec_code]', "" );
                $tpl->set( '[/sec_code]', "" );
                $tpl->set( '{reg_code}', "<span id=\"dle-captcha\"><img src=\"" . $path['path'] . "engine/modules/antibot.php\" alt=\"{$lang['sec_image']}\" border=\"0\" /><br /><a onclick=\"reload(); return false;\" href=\"#\">{$lang['reload_code']}</a></span>" );
                $tpl->set_block( "'\\[recaptcha\\](.*?)\\[/recaptcha\\]'si", "" );
                $tpl->set( '{recaptcha}', "" );
            }
 
        } else {
 
            $tpl->set( '{reg_code}', "" );
            $tpl->set( '{recaptcha}', "" );
            $tpl->set_block( "'\\[sec_code\\](.*?)\\[/sec_code\\]'si", "" );
            $tpl->set_block( "'\\[recaptcha\\](.*?)\\[/recaptcha\\]'si", "" );
        }
        
        $tpl->copy_template = "<form  method=\"post\" name=\"registration\" onsubmit=\"if (!check_reg_daten()) {return false;};\" id=\"registration\" action=\"\">\n" . $tpl->copy_template . "
<input name=\"submit_reg\" type=\"hidden\" id=\"submit_reg\" value=\"submit_reg\" />
<input name=\"do\" type=\"hidden\" id=\"do\" value=\"register\" />
</form>";
        
        $tpl->copy_template .= <<<HTML
<script language='javascript' type="text/javascript">
<!--
function reload () {
 
    var rndval = new Date().getTime(); 
 
    document.getElementById('dle-captcha').innerHTML = '<img src="{$path['path']}engine/modules/antibot.php?rndval=' + rndval + '" border="0" width="120" height="50" alt="" /><br /><a onclick="reload(); return false;" href="#">{$lang['reload_code']}</a>';
 
};
function check_reg_daten () {
 
    if(document.forms.registration.name.value == '') {
 
        DLEalert('{$lang['reg_err_30']}', dle_info);return false;
 
    }
 
    if(document.forms.registration.password1.value.length < 6) {
 
        DLEalert('{$lang['reg_err_31']}', dle_info);return false;
 
    }
 
    if(document.forms.registration.password1.value != document.forms.registration.password2.value) {
 
        DLEalert('{$lang['reg_err_32']}', dle_info);return false;
 
    }
 
    if(document.forms.registration.email.value == '') {
 
        DLEalert('{$lang['reg_err_33']}', dle_info);return false;
 
    }
 
return true;
 
};
//-->
</script>
HTML;
        $tpl->compile( 'content' );
        $tpl->clear();
    
    }
 
}
 
if( isset( $_POST['submit_val'] ) ) {
    
    $fullname = $db->safesql( $parse->process( $_POST['fullname'] ) );
    $land = $db->safesql( $parse->process( $_POST['land'] ) );
    $icq = intval( str_replace("-", "", $_POST['icq'] ) );
    if( $icq < 1 ) $icq = "";
    $info = $db->safesql( $parse->BB_Parse( $parse->process( $_POST['info'] ), false ) );
    
    $image = $_FILES['image']['tmp_name'];
    $image_name = $_FILES['image']['name'];
    $image_size = $_FILES['image']['size'];
    $image_name = str_replace( " ", "_", $image_name );
    $img_name_arr = explode( ".", $image_name );
    $type = totranslit( end( $img_name_arr ) );
 
    if( stripos ( $image_name, "php" ) !== false ) die("Hacking attempt!"); 
 
    $user_arr = explode( "||", base64_decode( @rawurldecode( $_POST['id'] ) ) );
 
    if( $user_arr[0] == "" OR  $user_arr[2]== "" ) die("Hacking attempt!");
 
    $user = $db->safesql( trim( $user_arr[0] ) );
    $email = $db->safesql( trim( $user_arr[1] ) );
    $pass = md5( $user_arr[2] );
 
    if( md5( sha1( $user . $email . DBHOST . DBNAME . $config['key'] ) ) != $user_arr[3] ) die( 'ID not valid!' );
 
    if( preg_match( "/[\||\'|\<|\>|\[|\]|\"|\!|\?|\$|\@|\/|\\\|\&\~\*\{\+]/", $user ) ) die( 'USER not valid!' );
 
    $row = $db->super_query( "SELECT * FROM " . USERPREFIX . "_users WHERE name = '$user' AND password='$pass'" );
    
    if( !$row['user_id'] ) die("Access Denied!");
    
    $db->free();
    
    if( is_uploaded_file( $image ) and ! $stop ) {
 
        if( intval( $user_group[$member_id['user_group']]['max_foto'] ) > 0 ) {
        
            if( $image_size < 100000 ) {
                
                $allowed_extensions = array ("jpg", "png", "jpe", "jpeg", "gif" );
                
                if( in_array( $type, $allowed_extensions ) AND $image_name ) {
                    
                    include_once ENGINE_DIR . '/classes/thumb.class.php';
                    
                    $res = @move_uploaded_file( $image, ROOT_DIR . "/uploads/fotos/" . $row['user_id'] . "." . $type );
                    
                    if( $res ) {
 
                        @chmod( ROOT_DIR . "/uploads/fotos/" . $row['user_id'] . "." . $type, 0666 );
                        $thumb = new thumbnail( ROOT_DIR . "/uploads/fotos/" . $row['user_id'] . "." . $type );
                        $thumb->size_auto( $user_group[$config['reg_group']]['max_foto'] );
                        $thumb->jpeg_quality( $config['jpeg_quality'] );
                        $thumb->save( ROOT_DIR . "/uploads/fotos/foto_" . $row['user_id'] . "." . $type );
                        
                        @unlink( ROOT_DIR . "/uploads/fotos/" . $row['user_id'] . "." . $type );
                        $foto_name = "foto_" . $row['user_id'] . "." . $type;
                        
                        $db->query( "UPDATE " . USERPREFIX . "_users SET foto='$foto_name' WHERE user_id='{$row['user_id']}'" );
                    
                    } else
                        $stop = $lang['reg_err_12'];
                } else
                    $stop = $lang['reg_err_13'];
            } else
                $stop = $lang['news_err_16'];
        } else
            $stop .= $lang['news_err_32'];
 
    }
    
    if( intval( $user_group[$member_id['user_group']]['max_info'] ) > 0 and dle_strlen( $info, $config['charset'] ) > $user_group[$member_id['user_group']]['max_info'] ) $stop .= $lang['reg_err_14'];
    if( dle_strlen( $fullname, $config['charset'] ) > 100 ) $stop .= $lang['reg_err_15'];
    if( dle_strlen( $land, $config['charset'] ) > 100 ) $stop .= $lang['reg_err_16'];
    if( strlen( $icq ) > 20 ) $stop .= $lang['reg_err_17'];
    if( $parse->not_allowed_tags ) $stop .= $lang['news_err_34'];
 
    if ( preg_match( "/[\||\'|\<|\>|\"|\!|\]|\?|\$|\@|\/|\\\|\&\~\*\+]/", $fullname ) ) {
 
        $stop .= $lang['news_err_35'];
    }
 
    if ( preg_match( "/[\||\'|\<|\>|\"|\!|\]|\?|\$|\@|\/|\\\|\&\~\*\+]/", $land ) ) {
 
        $stop .= $lang['news_err_36'];
    }
    
    if( $stop ) {
        msgbox( $lang['reg_err_18'], $stop );
    } else {
        
        $xfieldsaction = "init";
        $xfieldsadd = true;
        $xfieldsid = "";
        include (ENGINE_DIR . '/inc/userfields.php');
        $filecontents = array ();
        
        if( ! empty( $postedxfields ) ) {
            foreach ( $postedxfields as $xfielddataname => $xfielddatavalue ) {
                if( ! $xfielddatavalue ) {
                    continue;
                }
                
                $xfielddatavalue = $db->safesql( $parse->BB_Parse( $parse->process( $xfielddatavalue ), false ) );
                
                $xfielddataname = $db->safesql( $xfielddataname );
                
                $xfielddataname = str_replace( "|", "|", $xfielddataname );
                $xfielddatavalue = str_replace( "|", "|", $xfielddatavalue );
                $filecontents[] = "$xfielddataname|$xfielddatavalue";
            }
            
            $filecontents = implode( "||", $filecontents );
        } else
            $filecontents = '';
        
        $db->query( "UPDATE " . USERPREFIX . "_users SET fullname='$fullname', info='$info', land='$land', icq='$icq', xfields='$filecontents' WHERE user_id='{$row['user_id']}'" );
        
        msgbox( $lang['reg_ok'], $lang['reg_ok_1'] );
        
        $stopregistration = TRUE;
    }
}
 
if( $doaction == "validating" AND !$stopregistration AND !$_POST['submit_val'] ) {
    
    $user_arr = explode( "||", base64_decode( @rawurldecode( $_REQUEST['id'] ) ) );
    
    $regpassword = md5( $user_arr[2] );
    $name = trim( $db->safesql( htmlspecialchars( $parse->process( $user_arr[0] ) ) ) );
 
    $not_allow_symbol = array ("\x22", "\x60", "\t", '\n', '\r', "\n", "\r", '\\', ",", "/", "¬", "#", ";", ":", "~", "[", "]", "{", "}", ")", "(", "*", "^", "%", "$", "<", ">", "?", "!", '"', "'", " " );
    $email = $db->safesql(trim( str_replace( $not_allow_symbol, '', strip_tags( stripslashes( $user_arr[1] ) ) ) ) );
    
    if( md5( sha1( $name . $email . DBHOST . DBNAME . $config['key'] ) ) != $user_arr[3] ) die( 'ID not valid!' );
 
    $name = preg_replace('#\s+#i', ' ', $name); 
    $reg_error = check_reg( $name, $email, $regpassword, $regpassword );
    
    if( $reg_error != "" ) {
        msgbox( $lang['reg_err_11'], $reg_error );
        $stopregistration = TRUE;
    } else {
        
        if( ($_REQUEST['step'] != 2) and $config['registration_type'] ) {
            $stopregistration = TRUE;
            $lang['confirm_ok'] = str_replace( '{email}', $email, $lang['confirm_ok'] );
            $lang['confirm_ok'] = str_replace( '{login}', $name, $lang['confirm_ok'] );
            msgbox( $lang['all_info'], $lang['confirm_ok'] . "<br /><br /><a href=\"" . $config['http_home_url'] . "index.php?do=register&doaction=validating&step=2&id=" . rawurlencode( $_REQUEST['id'] ) . "\">" . $lang['reg_next'] . "</a>" );
        } else {
            
            $add_time = time() + ($config['date_adjust'] * 60);
            $_IP = $db->safesql( $_SERVER['REMOTE_ADDR'] );
            if( intval( $config['reg_group'] ) < 3 ) $config['reg_group'] = 4;
            
            $db->query( "INSERT INTO " . USERPREFIX . "_users (name, password, email, reg_date, lastdate, user_group, info, signature, favorites, xfields, logged_ip) VALUES ('$name', '$regpassword', '$email', '$add_time', '$add_time', '" . $config['reg_group'] . "', '', '', '', '', '" . $_IP . "')" );
$ipb_dle = new ipb_dle;
$salt = $ipb_dle->generate_password_salt(5);
$salt = addslashes($salt);
$ph = $ipb_dle->generate_compiled_passhash($salt, md5($_POST['password1']) );
$insert_ipb = $ipb->insert_id(); //ид вставки
$member_key = $ipb_dle->generate_auto_log_in_key();
$key_expire = $member_key * 60 * 60 * 24;
$ipb->query("INSERT INTO `{$db_prefix_ipb}members` ( 
member_id,
name,
members_l_username,
members_display_name,
members_l_display_name,
members_seo_name,
member_login_key,
member_login_key_expire,
email,
member_group_id,
joined,
ip_address,
time_offset,
allow_admin_mails,
language,
msg_show_notification,
members_auto_dst,
members_pass_hash,
members_pass_salt
)
VALUES (
0,
$name’,
‘».strtolower($name).»‘,
$name’,
‘».strtolower($name).»‘,
‘».strtolower($name).»‘,
‘».$ipb_dle->generate_auto_log_in_key().»‘,
$key_expire’,
$email’,
’3?,
‘».time().»‘,
$_IP’,
’3?,
’1?,
’1?,
’1?,
’0?,
$ph’,
$salt
)»);
$ipb_st = $ipb->super_query(«select * from {$db_prefix_ipb}cache_store where cs_key = ‘stats’»);
$st_arr  = unserialize($ipb_st['cs_value']);
$st_arr['mem_count']++;
$st_arr['last_mem_name'] = $name;
$st_arr['last_mem_id'] = $insert_ipb;
$st_arr2 = serialize($st_arr);
$ipb->query(«UPDATE {$db_prefix_ipb}cache_store set cs_value = ‘$st_arr2? where cs_key = ‘stats’»);
            $id = $db->insert_id();
            
            set_cookie( "dle_user_id", $id, 365 );
            set_cookie( "dle_password", $user_arr[2], 365 );
            
            $_SESSION['dle_user_id'] = $id;
            $_SESSION['dle_password'] = $user_arr[2];
        
        }
    
    }
 
}
 
if( $doaction == "validating" and ! $stopregistration ) {
    
    $tpl->load_template( 'registration.tpl' );
    
    $tpl->set( '[validation]', "" );
    $tpl->set( '[/validation]', "" );
    $tpl->set_block( "'\\[registration\\].*?\\[/registration\\]'si", "" );
    
    $xfieldsaction = "list";
    $xfieldsadd = true;
    include (ENGINE_DIR . '/inc/userfields.php');
    $tpl->set( '{xfields}', $output );
 
    $_REQUEST['id'] = htmlspecialchars( $_REQUEST['id'], ENT_QUOTES );
 
    $tpl->copy_template = "<form  method=\"post\" name=\"registration\" enctype=\"multipart/form-data\" action=\"\">\n" . $tpl->copy_template . "
<input name=\"submit_val\" type=\"hidden\" id=\"submit_val\" value=\"submit_val\" />
<input name=\"do\" type=\"hidden\" id=\"do\" value=\"register\" />
<input name=\"doaction\" type=\"hidden\" id=\"doaction\" value=\"validating\" />
<input name=\"id\" type=\"hidden\" id=\"id\" value=\"{$_REQUEST['id']}\" />
</form>";
    
    $tpl->compile( 'content' );
    $tpl->clear();
}
 
class ipb_dle 
{ 
function generate_password_salt($len=5) 
{ 
$salt = ''; 
 
for ( $i = 0; $i generate_password_salt( $len ); 
 
return md5($pass); 
} 
 
} 
 
?>


Вернуться к обсуждению:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING PHP
0
Заказать работу у эксперта
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
07.04.2013, 14:22
Готовые ответы и решения:

Ошибка Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
Ясно, что проблема с кавычками, но как исправить :о Parse error: syntax error, unexpected...

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING
Помогите пжлст решить проблему с этой ошибкой! &lt;?php $mytext = &quot;&lt;?php ...

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in Z:\home\script.ua\www\script_1.ph
имеется код $res = mysql_query(&quot;SELECT * FROM news&quot;); $count = mysql_num_rows($res); $res_2 =...

Ошибка в php - Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in CODE on line 9
Доброго времени суток! Есть код, в нем где-то есть ошибка (вроде кавычки), но знаний php у меня 0,...

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

Syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
Установил денвер. Запускаю файл &lt;html&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot;&gt; &lt;/head&gt; &lt;body&gt; ...

syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in
ошибка Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or...

Ошибка syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
Уважаемые знатоки... Нуждаюсь в помощи... Код писал сам, но не могу понять ошибку syntax error,...

Ошибка Parse error: syntax error, unexpected T_CLASS, expecting T_STRING or T_VARIABLE
да блин капец.. не могу понять ничего.. кто поможет? Parse error: syntax error, unexpected...

0
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru