Форум программистов, компьютерный форум, киберфорум
PHP для начинающих
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.80/5: Рейтинг темы: голосов - 5, средняя оценка - 4.80
0 / 0 / 2
Регистрация: 13.04.2013
Сообщений: 12
1

Ошибка в синтаксисе

13.04.2013, 22:03. Показов 963. Ответов 2
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Здравствуйте! такой вопрос устанавливаем скрипт на хостинг и парсер выдаёт ошибку
C++
1
Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in /home/bkono426/public_html/install/include/database.php on line 56
Вот сам файл database.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
<?php
class MYSQLi_DB {
 
    var $connection;
 
    function MYSQLi_DB() {
        $this->connection = mysqli_connect(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB) or die(mysqli_error());
    }
        function query($query) {
        return $this->connection->query($query);
        }
 
};
 
class MYSQL_DB {
 
    var $connection;
 
    function MYSQL_DB() {
        $this->connection = mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS) or die(mysql_error());
        mysql_select_db(SQL_DB, $this->connection) or die(mysql_error());
    }
 
    function mysql_exec_batch ($p_query, $p_transaction_safe = true) {
  if ($p_transaction_safe) {
      $p_query = 'START TRANSACTION;' . $p_query . '; COMMIT;';
    };
  $query_split = preg_split ("/[;]+/", $p_query);
  foreach ($query_split as $command_line) {
    $command_line = trim($command_line);
    if ($command_line != '') {
      $query_result = mysql_query($command_line);
      if ($query_result == 0) {
        break;
     };
    };
  };
  return $query_result;
}
 
    function query($query) {
        return mysql_query($query, $this->connection);
    }
 
 
if(DB_TYPE) {
    $database = new MYSQLi_DB;
}
else {
    $database = new MYSQL_DB;
}
?>

Может подскажите в чём трабла??
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
13.04.2013, 22:03
Ответы с готовыми решениями:

Ошибка в синтаксисе
&lt;?php if (isset($siteuri)) {$siteuri=&quot;da&quot;;} else {$siteuri=&quot;nu&quot;;} if (isset($carti))...

ошибка в синтаксисе sql
Здравствуйте, помогите, ошибка в синтаксисе sql. Вот ошибка: &quot;You have an error in your SQL...

не понятная ошибка в синтаксисе
http://www.atmcom.ru/setcurrall.php в чем может быть ошибка? Запрашиваемая страница не...

ошибка в синтаксисе sql
у меня выходит ошибка: &quot;You have an error in your SQL syntax; check the manual that corresponds to...

2
2432 / 2282 / 594
Регистрация: 27.05.2011
Сообщений: 7,801
13.04.2013, 22:23 2
Цитата Сообщение от kreiven Посмотреть сообщение
class MYSQL_DB {
где этот класс закрывается ?
1
0 / 0 / 2
Регистрация: 13.04.2013
Сообщений: 12
13.04.2013, 22:50  [ТС] 3
Спасибо вылезла другая ошибка=)) код не мой а ковырять чужой код это писец

Добавлено через 12 минут
C++
1
Fatal error: Call to undefined method MYSQL_DB::mysql_exec_batch() in /home/bkono426/public_html/install/process.php on line 118
Вообщем вылетела ещё одна ошибка фатал не подскажите как его побороть мб кто сталкивался с подобным??
сам файл process.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
<?php
if(file_exists("include/constant.php")) {
    include ("include/database.php");
}
class Process {
 
    function Process() {
        if(isset($_POST['subconst'])) {
            $this->constForm();
        } else
            if(isset($_POST['substruc'])) {
                $this->createStruc();
            } else
                if(isset($_POST['subwdata'])) {
                    $this->createWdata();
                } else
                    if(isset($_POST['subacc'])) {
                        $this->createAcc();
                        } else {
                            header("Location: index.php");
                        }
    }
 
    function constForm() {
        $myFile = "include/constant.php";
        $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: install\include\constant.php");
        $text = file_get_contents("data/constant_format.tpl");
        $text = preg_replace("'%SERVERNAME%'", $_POST['servername'], $text);
        $text = preg_replace("'%SSTARTDATE%'", $_POST['start_date'], $text);
        $text = preg_replace("'%SSTARTTIME%'", $_POST['start_time'], $text);
        $text = preg_replace("'%LANG%'", $_POST['lang'], $text);
        $text = preg_replace("'%SPEED%'", $_POST['speed'], $text);
        $text = preg_replace("'%INCSPEED%'", $_POST['incspeed'], $text);
        $text = preg_replace("'%EVASIONSPEED%'", $_POST['evasionspeed'], $text);
        $text = preg_replace("'%TRADERCAP%'", $_POST['tradercap'], $text);
        $text = preg_replace("'%STORAGE_MULTIPLIER%'", $_POST['storage_multiplier'], $text);
        $text = preg_replace("'%UTRACK%'", $_POST['trackusers'], $text);
        $text = preg_replace("'%UTOUT%'", $_POST['timeout'], $text);
        $text = preg_replace("'%AUTOD%'", $_POST['autodel'], $text);
        $text = preg_replace("'%AUTODT%'", $_POST['autodeltime'], $text);
        $text = preg_replace("'%MAX%'", $_POST['wmax'], $text);
        $text = preg_replace("'%GP%'", $_POST['gpack'], $text);
        $text = preg_replace("'%SSERVER%'", $_POST['sserver'], $text);
        $text = preg_replace("'%SUSER%'", $_POST['suser'], $text);
        $text = preg_replace("'%SPASS%'", $_POST['spass'], $text);
        $text = preg_replace("'%SDB%'", $_POST['sdb'], $text);
        $text = preg_replace("'%PREFIX%'", $_POST['prefix'], $text);
        $text = preg_replace("'%CONNECTT%'", $_POST['connectt'], $text);
        $text = preg_replace("'%AEMAIL%'", $_POST['aemail'], $text);
        $text = preg_replace("'%ANAME%'", $_POST['aname'], $text);
        $text = preg_replace("'%SUBDOM%'", $_POST['subdom'], $text);
        $text = preg_replace("'%LOGBUILD%'", $_POST['log_build'], $text);
        $text = preg_replace("'%LOGTECH%'", $_POST['log_tech'], $text);
        $text = preg_replace("'%LOGLOGIN%'", $_POST['log_login'], $text);
        $text = preg_replace("'%LOGGOLDFIN%'", $_POST['log_gold_fin'], $text);
        $text = preg_replace("'%LOGADMIN%'", $_POST['log_admin'], $text);
        $text = preg_replace("'%LOGWAR%'", $_POST['log_war'], $text);
        $text = preg_replace("'%LOGMARKET%'", $_POST['log_market'], $text);
        $text = preg_replace("'%LOGILLEGAL%'", $_POST['log_illegal'], $text);
        $text = preg_replace("'%MINUSERLENGTH%'", $_POST['userlength'], $text);
        $text = preg_replace("'%MINPASSLENGTH%'", $_POST['passlength'], $text);
        $text = preg_replace("'%SPECIALCHARS%'", $_POST['specialchars'], $text);
        $text = preg_replace("'%ACTIVATE%'", $_POST['activate'], $text);
        $text = preg_replace("'%ARANK%'", $_POST['admin_rank'], $text);
        $text = preg_replace("'%QUEST%'", $_POST['quest'], $text);
        $text = preg_replace("'%BEGINNER%'", $_POST['beginner'], $text);
        $text = preg_replace("'%STARTTIME%'", time(), $text);
        $text = preg_replace("'%DOMAIN%'", $_POST['domain'], $text);
        $text = preg_replace("'%HOMEPAGE%'", $_POST['homepage'], $text);
        $text = preg_replace("'%SERVER%'", $_POST['server'], $text);
        $text = preg_replace("'%LIMIT_MAILBOX%'", $_POST['limit_mailbox'], $text);
        $text = preg_replace("'%MAX_MAILS%'", $_POST['max_mails'], $text);
        $text = preg_replace("'%DEMOLISH%'", $_POST['demolish'], $text);
        $text = preg_replace("'%BOX1%'", $_POST['box1'], $text);
        $text = preg_replace("'%BOX2%'", $_POST['box2'], $text);
        $text = preg_replace("'%BOX3%'", $_POST['box3'], $text);
        $text = preg_replace("'%VILLAGE_EXPAND%'", $_POST['village_expand'], $text);
        $text = preg_replace("'%ERROR%'", $_POST['error'], $text);
        $text = preg_replace("'%GP_LOCATE%'", $_POST['gp_locate'], $text);
        $text = preg_replace("'%PLUS_TIME%'", $_POST['plus_time'], $text);
        $text = preg_replace("'%PLUS_PRODUCTION%'", $_POST['plus_production'], $text);
        $text = preg_replace("'%GREAT_WKS%'", $_POST['great_wks'], $text);
        $text = preg_replace("'%TS_THRESHOLD%'", $_POST['ts_threshold'], $text);
        $text = preg_replace("'%WW%'", $_POST['ww'], $text);
        $text = preg_replace("'%T4_COMING%'", $_POST['t4_coming'], $text);
        $text = preg_replace("'%REG_OPEN%'", $_POST['reg_open'], $text);
        $text = preg_replace("'%PEACE%'", $_POST['peace'], $text);
 
        fwrite($fh, $text);
 
        if(file_exists("include/constant.php")) {
            header("Location: index.php?s=2");
        } else {
            header("Location: index.php?s=1&c=1");
        }
 
        fclose($fh);
    }
 
    function createStruc() {
        global $database;
        $str = file_get_contents("data/sql.sql");
        $str = preg_replace("'%PREFIX%'", TB_PREFIX, $str);
        if(DB_TYPE) {
            $result = $database->connection->multi_query($str);
        }
        else {
            $result = $database->mysql_exec_batch($str);
        }
        if($result) {
            header("Location: index.php?s=3");
        } else {
            header("Location: index.php?s=2&c=1");
        }
    }
 
    function createWdata() {
        header("Location: include/wdata.php");
    }
 
}
;
 
$process = new Process;
 
?>
0
13.04.2013, 22:50
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
13.04.2013, 22:50
Помогаю со студенческими работами здесь

Ошибка в синтаксисе. Как найти?
Не работает функция out(); Ошибка Parse error: syntax error, unexpected T_ECHO echo &quot;&lt;p...

не могу понять в чем ошибка (в синтаксисе)!
Суть проблемы в том, что почемуто не сравнивается пароль илогин введёные в форму с теми которые...

Не могу запустить скрипт (ошибка в синтаксисе)
Для эксперимента решил сделать PHP-скрипт Image4Skype(да-да, такие сервисы уже есть, но мне нужно...

Не могу найти ошибку в синтаксисе.Ошибка указывает на строку 192
if ($page != 1){ $pstr_prev = '&lt;li&gt;&lt;a class=&quot;pstr-prev&quot; href=&quot;index.php?page='.($page -...


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

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