so mal 2 fragen oder auch 3

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • so mal 2 fragen oder auch 3

      also hallo GL!
      habe das volgende problem:kann in der phpmyadmin db keine queris einbauen um den master hero changer ein zu fügen wenn er in der db mit drinn is und ich die db importiere dan macht er mir beim query ne fehler meldung :(!
      meine db leuft über plesk wegen mysql zu dem habe ich heute rausgefunden wenn die db importiert wurde im plesk was 2std dauert :( und ich im nachhinein navicat installe die daten eingebe die ich für plesk nutze zeigt er mir auch die db bei navicat.
      meine frage is nu habe den query (master_hero+skills) über navicat hinzugefügt aber wirkt nicht es kann trotzdem niemand nach relogg master oder hero werden.
      was kann ich machen das es geht?

      dan hab ich noch folgendes problem mit meinem forum da ich von einem schlechten aber denoch teuren root umgezogen binn auf eine empfehlung von Valron "danke noch mal der server is geil" (root)
      bekomme ich das forum nicht zum laufen da er mir einen fehler der php datei ansagt wegen passwort aber ich von anfang bis ende der zeilen schaute aber nix fand bzw nix stand konnte ich auch nix machen da ich mich nich mit php auskenne aber langsam lerne da ich fast alles eigentlich alleine versuche aber nach genau 28std und 34 min vielen mir die augen zu und meine geduld wa am ende jetzt versuche ich mir hier hilfe zu holen da ich i einem anderen forum "nich der rede wert" kennt jeder den stall da keine hlfe bekam.

      nun hoffe ich hier bei euch auf reichlicher nützliger antworten :)
    • Werbung zur Unterstützung des Forums ( Bitte AddBlocker deaktivieren )

    • [COLOR="Cyan"]Zum 1. Problem:
      Connecte mit Navicat, mach ein Rechtsklick auf characters und
      geh auf Design Table (Bei englischen version) bzw Tabelle entwerfen
      (deutsche Version).
      Dann geh zu Trigger und lösch die Abfrage, die da Höchswahrscheinlich
      steht.
      Dann speichern und schließen.

      Nun gehst du auf Abfragen, wählst die Abfrage / den Trigger aus
      und drückst oben auf start.
      Nun sollte er das ganz normal starten!

      Zum 2. Problem:

      Welches Forum CMS benutzt du?

      mfg
      Valron[/COLOR]
    • [COLOR="Cyan"]Da müsste eigentlich eine Config Datei sein (config.php)
      die so aussieht:

      PHP-Quellcode

      1. <?php
      2. // phpBB 3.0.x auto-generated configuration file
      3. // Do not change anything in this file!
      4. $dbms = 'mysql';
      5. $dbhost = 'localhost';
      6. $dbport = '';
      7. $dbname = 'proflyffers';
      8. $dbuser = 'root';
      9. $dbpasswd = '1234';
      10. $table_prefix = 'phpbb_';
      11. $acm_type = 'file';
      12. $load_extensions = '';
      13. @define('PHPBB_INSTALLED', true);
      14. // @define('DEBUG', true);
      15. // @define('DEBUG_EXTRA', true);
      16. ?>
      Alles anzeigen


      Dies einfach anpassen und fertig.

      Nochmal zum Trigger Problem:
      Kommt irgendeine Fehlermeldung, wenn du den
      Trigger versuchst wieder zu starten?

      mfg
      Valron[/COLOR]
    • das is es ja in der zeile steht ja leider nix darüber das is ja mein riesen proiblem :( das sin die einzigen 2fehler die ich atm noch aufm root habe :(

      hier die sql:


      Quellcode

      1. <?php
      2. /**
      3. * MyBB 1.4
      4. * Copyright © 2008 MyBB Group, All Rights Reserved
      5. *
      6. * Website: [url=http://www.mybboard.net]MyBB - Free PHP and MySQL Forum Software[/url]
      7. * License: [url=http://www.mybboard.net/about/license]MyBB - License Agreement[/url]
      8. *
      9. * $Id: db_mysql.php 4304 2009-01-02 01:11:56Z chris $
      10. */
      11. class DB_MySQL
      12. {
      13. /**
      14. * The title of this layer.
      15. *
      16. * @var string
      17. */
      18. var $title = "MySQL";
      19. /**
      20. * The short title of this layer.
      21. *
      22. * @var string
      23. */
      24. var $short_title = "MySQL";
      25. /**
      26. * The type of db software being used.
      27. *
      28. * @var string
      29. */
      30. var $type;
      31. /**
      32. * A count of the number of queries.
      33. *
      34. * @var int
      35. */
      36. var $query_count = 0;
      37. /**
      38. * A list of the performed queries.
      39. *
      40. * @var array
      41. */
      42. var $querylist = array();
      43. /**
      44. * 1 if error reporting enabled, 0 if disabled.
      45. *
      46. * @var boolean
      47. */
      48. var $error_reporting = 1;
      49. /**
      50. * The read database connection resource.
      51. *
      52. * @var resource
      53. */
      54. var $read_link;
      55. /**
      56. * The write database connection resource
      57. *
      58. * @var resource
      59. */
      60. var $write_link;
      61. /**
      62. * Reference to the last database connection resource used.
      63. *
      64. * @var resource
      65. */
      66. var $current_link;
      67. /**
      68. * Explanation of a query.
      69. *
      70. * @var string
      71. */
      72. var $explain;
      73. /**
      74. * The current version of MySQL.
      75. *
      76. * @var string
      77. */
      78. var $version;
      79. /**
      80. * The current table type in use (myisam/innodb)
      81. *
      82. * @var string
      83. */
      84. var $table_type = "myisam";
      85. /**
      86. * The table prefix used for simple select, update, insert and delete queries
      87. *
      88. * @var string
      89. */
      90. var $table_prefix;
      91. /**
      92. * The extension used to run the SQL database
      93. *
      94. * @var string
      95. */
      96. var $engine = "mysql";
      97. /**
      98. * Weather or not this engine can use the search functionality
      99. *
      100. * @var boolean
      101. */
      102. var $can_search = true;
      103. /**
      104. * The database encoding currently in use (if supported)
      105. *
      106. * @var string
      107. */
      108. var $db_encoding = "utf8";
      109. /**
      110. * The time spent performing queries
      111. *
      112. * @var float
      113. */
      114. var $query_time = 0;
      115. /**
      116. * Connect to the database server.
      117. *
      118. * @param array Array of DBMS connection details.
      119. * @return resource The DB connection resource.
      120. */
      121. function connect($config)
      122. {
      123. // Simple connection to one server
      124. if(array_key_exists('hostname', $config))
      125. {
      126. $connections['read'][] = $config;
      127. }
      128. else
      129. // Connecting to more than one server
      130. {
      131. // Specified multiple servers, but no specific read/write servers
      132. if(!array_key_exists('read', $config))
      133. {
      134. foreach($config as $key => $settings)
      135. {
      136. if(is_int($key)) $connections['read'][] = $settings;
      137. }
      138. }
      139. // Specified both read & write servers
      140. else
      141. {
      142. $connections = $config;
      143. }
      144. }
      145. $this->db_encoding = $config['encoding'];
      146. // Actually connect to the specified servers
      147. foreach(array('read', 'write') as $type)
      148. {
      149. if(!is_array($connections[$type]))
      150. {
      151. break;
      152. }
      153. if(array_key_exists('hostname', $connections[$type]))
      154. {
      155. $details = $connections[$type];
      156. unset($connections);
      157. $connections[$type][] = $details;
      158. }
      159. // Shuffle the connections
      160. shuffle($connections[$type]);
      161. // Loop-de-loop
      162. foreach($connections[$type] as $single_connection)
      163. {
      164. $connect_function = "mysql_connect";
      165. if($single_connection['pconnect'])
      166. {
      167. $connect_function = "mysql_pconnect";
      168. }
      169. $link = $type."_link";
      170. $this->get_execution_time();
      171. $this->$link = @$connect_function($single_connection['hostname'], $single_connection['username'], $single_connection['password'], 1);
      172. $time_spent = $this->get_execution_time();
      173. $this->query_time += $time_spent;
      174. // Successful connection? break down brother!
      175. if($this->$link)
      176. {
      177. $this->connections[] = "[".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']} (Connected in ".number_format($time_spent, 0)."s)";
      178. break;
      179. }
      180. else
      181. {
      182. $this->connections[] = "<span style=\"color: red\">[FAILED] [".strtoupper($type)."] {$single_connection['username']}@{$single_connection['hostname']}</span>";
      183. }
      184. }
      185. }
      186. // No write server was specified (simple connection or just multiple servers) - mirror write link
      187. if(!array_key_exists('write', $connections))
      188. {
      189. $this->write_link = &$this->read_link;
      190. }
      191. // Have no read connection?
      192. if(!$this->read_link)
      193. {
      194. $this->error("[READ] Unable to connect to MySQL server");
      195. }
      196. // No write?
      197. else if(!$this->write_link)
      198. {
      199. $this->error("[WRITE] Unable to connect to MySQL server");
      200. }
      201. // Select databases
      202. if(!$this->select_db($config['database']))
      203. {
      204. return false;
      205. }
      206. $this->current_link = &$this->read_link;
      207. return $this->read_link;
      208. }
      209. /**
      210. * Selects the database to use.
      211. *
      212. * @param string The database name.
      213. * @return boolean True when successfully connected, false if not.
      214. */
      215. function select_db($database)
      216. {
      217. global $mybb;
      218. $this->current_link = &$this->read_link;
      219. $read_success = @mysql_select_db($database, $this->read_link) or $this->error("[READ] Unable to select database", $this->read_link);
      220. if($this->write_link)
      221. {
      222. $this->current_link = &$this->write_link;
      223. $write_success = @mysql_select_db($database, $this->write_link) or $this->error("[WRITE] Unable to select database", $this->write_link);
      224. $success = ($read_success && $write_success ? true : false);
      225. }
      226. else
      227. {
      228. $success = $read_success;
      229. }
      230. if($success && $this->db_encoding)
      231. {
      232. $this->query("SET NAMES '{$this->db_encoding}'");
      233. if($write_success && count($this->connections) > 1)
      234. {
      235. $this->write_query("SET NAMES '{$this->db_encoding}'");
      236. }
      237. }
      238. return $success;
      239. }
      240. /**
      241. * Query the database.
      242. *
      243. * @param string The query SQL.
      244. * @param integer 1 if hide errors, 0 if not.
      245. * @param integer 1 if executes on slave database, 0 if not.
      246. * @return resource The query data.
      247. */
      248. function query($string, $hide_errors=0, $write_query=0)
      249. {
      250. global $pagestarttime, $db, $mybb;
      251. $this->get_execution_time();
      252. // Only execute write queries on slave database
      253. if($write_query && $this->write_link)
      254. {
      255. $this->current_link = &$this->write_link;
      256. $query = @mysql_query($string, $this->write_link);
      257. }
      258. else
      259. {
      260. $this->current_link = &$this->read_link;
      261. $query = @mysql_query($string, $this->read_link);
      262. }
      263. if($this->error_number() && !$hide_errors)
      264. {
      265. $this->error($string);
      266. exit;
      267. }
      268. $query_time = $this->get_execution_time();
      269. $this->query_time += $query_time;
      270. $this->query_count++;
      271. if($mybb->debug_mode)
      272. {
      273. $this->explain_query($string, $query_time);
      274. }
      275. return $query;
      276. }
      277. /**
      278. * Execute a write query on the slave database
      279. *
      280. * @param string The query SQL.
      281. * @param boolean 1 if hide errors, 0 if not.
      282. * @return resource The query data.
      283. */
      284. function write_query($query, $hide_errors=0)
      285. {
      286. return $this->query($query, $hide_errors, 1);
      287. }
      288. /**
      289. * Explain a query on the database.
      290. *
      291. * @param string The query SQL.
      292. * @param string The time it took to perform the query.
      293. */
      294. function explain_query($string, $qtime)
      295. {
      296. global $plugins;
      297. if($plugins->current_hook)
      298. {
      299. $debug_extra = "<div style=\"float_right\">(Plugin Hook: {$plugins->current_hook})</div>";
      300. }
      301. if(preg_match("#^\s*select#i", $string))
      302. {
      303. $query = mysql_query("EXPLAIN $string", $this->current_link);
      304. $this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
      305. "<tr>\n".
      306. "<td colspan=\"8\" style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Select Query</strong></div></td>\n".
      307. "</tr>\n".
      308. "<tr>\n".
      309. "<td colspan=\"8\" style=\"background-color: #fefefe;\"><span style=\"font-family: Courier; font-size: 14px;\">".$string."</span></td>\n".
      310. "</tr>\n".
      311. "<tr style=\"background-color: #efefef;\">\n".
      312. "<td><strong>table</strong></td>\n".
      313. "<td><strong>type</strong></td>\n".
      314. "<td><strong>possible_keys</strong></td>\n".
      315. "<td><strong>key</strong></td>\n".
      316. "<td><strong>key_len</strong></td>\n".
      317. "<td><strong>ref</strong></td>\n".
      318. "<td><strong>rows</strong></td>\n".
      319. "<td><strong>Extra</strong></td>\n".
      320. "</tr>\n";
      321. while($table = mysql_fetch_array($query))
      322. {
      323. $this->explain .=
      324. "<tr bgcolor=\"#ffffff\">\n".
      325. "<td>".$table['table']."</td>\n".
      326. "<td>".$table['type']."</td>\n".
      327. "<td>".$table['possible_keys']."</td>\n".
      328. "<td>".$table['key']."</td>\n".
      329. "<td>".$table['key_len']."</td>\n".
      330. "<td>".$table['ref']."</td>\n".
      331. "<td>".$table['rows']."</td>\n".
      332. "<td>".$table['Extra']."</td>\n".
      333. "</tr>\n";
      334. }
      335. $this->explain .=
      336. "<tr>\n".
      337. "<td colspan=\"8\" style=\"background-color: #fff;\">Query Time: ".$qtime."</td>\n".
      338. "</tr>\n".
      339. "</table>\n".
      340. "<br />\n";
      341. }
      342. else
      343. {
      344. $this->explain .= "<table style=\"background-color: #666;\" width=\"95%\" cellpadding=\"4\" cellspacing=\"1\" align=\"center\">\n".
      345. "<tr>\n".
      346. "<td style=\"background-color: #ccc;\">{$debug_extra}<div><strong>#".$this->query_count." - Write Query</strong></div></td>\n".
      347. "</tr>\n".
      348. "<tr style=\"background-color: #fefefe;\">\n".
      349. "<td><span style=\"font-family: Courier; font-size: 14px;\">".htmlspecialchars_uni($string)."</span></td>\n".
      350. "</tr>\n".
      351. "<tr>\n".
      352. "<td bgcolor=\"#ffffff\">Query Time: ".$qtime."</td>\n".
      353. "</tr>\n".
      354. "</table>\n".
      355. "<br />\n";
      356. }
      357. $this->querylist[$this->query_count]['query'] = $string;
      358. $this->querylist[$this->query_count]['time'] = $qtime;
      359. }
      360. /**
      361. * Return a result array for a query.
      362. *
      363. * @param resource The query ID.
      364. * @param constant The type of array to return.
      365. * @return array The array of results.
      366. */
      367. function fetch_array($query)
      368. {
      369. $array = mysql_fetch_assoc($query);
      370. return $array;
      371. }
      372. /**
      373. * Return a specific field from a query.
      374. *
      375. * @param resource The query ID.
      376. * @param string The name of the field to return.
      377. * @param int The number of the row to fetch it from.
      378. */
      379. function fetch_field($query, $field, $row=false)
      380. {
      381. if($row === false)
      382. {
      383. $array = $this->fetch_array($query);
      384. return $array[$field];
      385. }
      386. else
      387. {
      388. return mysql_result($query, $row, $field);
      389. }
      390. }
      391. /**
      392. * Moves internal row pointer to the next row
      393. *
      394. * @param resource The query ID.
      395. * @param int The pointer to move the row to.
      396. */
      397. function data_seek($query, $row)
      398. {
      399. return mysql_data_seek($query, $row);
      400. }
      401. /**
      402. * Return the number of rows resulting from a query.
      403. *
      404. * @param resource The query ID.
      405. * @return int The number of rows in the result.
      406. */
      407. function num_rows($query)
      408. {
      409. return mysql_num_rows($query);
      410. }
      411. /**
      412. * Return the last id number of inserted data.
      413. *
      414. * @return int The id number.
      415. */
      416. function insert_id()
      417. {
      418. return mysql_insert_id($this->current_link);
      419. }
      420. /**
      421. * Close the connection with the DBMS.
      422. *
      423. */
      424. function close()
      425. {
      426. @mysql_close($this->read_link);
      427. if($this->write_link)
      428. {
      429. @mysql_close($this->write_link);
      430. }
      431. }
      432. /**
      433. * Return an error number.
      434. *
      435. * @return int The error number of the current error.
      436. */
      437. function error_number()
      438. {
      439. if($this->current_link)
      440. {
      441. return @mysql_errno($this->current_link);
      442. }
      443. else
      444. {
      445. return @mysql_errno();
      446. }
      447. }
      448. /**
      449. * Return an error string.
      450. *
      451. * @return string The explanation for the current error.
      452. */
      453. function error_string()
      454. {
      455. if($this->current_link)
      456. {
      457. return @mysql_error($this->current_link);
      458. }
      459. else
      460. {
      461. return @mysql_error();
      462. }
      463. }
      464. /**
      465. * Output a database error.
      466. *
      467. * @param string The string to present as an error.
      468. */
      469. function error($string="")
      470. {
      471. if($this->error_reporting)
      472. {
      473. if(class_exists("errorHandler"))
      474. {
      475. global $error_handler;
      476. if(!is_object($error_handler))
      477. {
      478. require_once MYBB_ROOT."inc/class_error.php";
      479. $error_handler = new errorHandler();
      480. }
      481. $error = array(
      482. "error_no" => $this->error_number(),
      483. "error" => $this->error_string(),
      484. "query" => $string
      485. );
      486. $error_handler->error(MYBB_SQL, $error);
      487. }
      488. else
      489. {
      490. trigger_error("<strong>[SQL] [".$this->error_number()."] ".$this->error_string()."</strong><br />{$string}", E_USER_ERROR);
      491. }
      492. }
      493. else
      494. {
      495. return false;
      496. }
      497. }
      498. /**
      499. * Returns the number of affected rows in a query.
      500. *
      501. * @return int The number of affected rows.
      502. */
      503. function affected_rows()
      504. {
      505. return mysql_affected_rows($this->current_link);
      506. }
      507. /**
      508. * Return the number of fields.
      509. *
      510. * @param resource The query ID.
      511. * @return int The number of fields.
      512. */
      513. function num_fields($query)
      514. {
      515. return mysql_num_fields($query);
      516. }
      517. /**
      518. * Lists all functions in the database.
      519. *
      520. * @param string The database name.
      521. * @param string Prefix of the table (optional)
      522. * @return array The table list.
      523. */
      524. function list_tables($database, $prefix='')
      525. {
      526. if($prefix)
      527. {
      528. $query = $this->query("SHOW TABLES FROM `$database` LIKE '".$this->escape_string($prefix)."%'");
      529. }
      530. else
      531. {
      532. $query = $this->query("SHOW TABLES FROM `$database`");
      533. }
      534. while(list($table) = mysql_fetch_array($query))
      535. {
      536. $tables[] = $table;
      537. }
      538. return $tables;
      539. }
      540. /**
      541. * Check if a table exists in a database.
      542. *
      543. * @param string The table name.
      544. * @return boolean True when exists, false if not.
      545. */
      546. function table_exists($table)
      547. {
      548. $err = $this->error_reporting;
      549. $this->error_reporting = 0;
      550. // Execute on slave server to ensure if we've just created a table that we get the correct result
      551. $query = $this->write_query("
      552. SHOW TABLES
      553. LIKE '{$this->table_prefix}$table'
      554. ");
      555. $exists = $this->num_rows($query);
      556. $this->error_reporting = $err;
      557. if($exists > 0)
      558. {
      559. return true;
      560. }
      561. else
      562. {
      563. return false;
      564. }
      565. }
      566. /**
      567. * Check if a field exists in a database.
      568. *
      569. * @param string The field name.
      570. * @param string The table name.
      571. * @return boolean True when exists, false if not.
      572. */
      573. function field_exists($field, $table)
      574. {
      575. $err = $this->error_reporting;
      576. $this->error_reporting = 0;
      577. $query = $this->write_query("
      578. SHOW COLUMNS
      579. FROM {$this->table_prefix}$table
      580. LIKE '$field'
      581. ");
      582. $exists = $this->num_rows($query);
      583. $this->error_reporting = $err;
      584. if($exists > 0)
      585. {
      586. return true;
      587. }
      588. else
      589. {
      590. return false;
      591. }
      592. }
      593. /**
      594. * Add a shutdown query.
      595. *
      596. * @param resource The query data.
      597. * @param string An optional name for the query.
      598. */
      599. function shutdown_query($query, $name=0)
      600. {
      601. global $shutdown_queries;
      602. if($name)
      603. {
      604. $shutdown_queries[$name] = $query;
      605. }
      606. else
      607. {
      608. $shutdown_queries[] = $query;
      609. }
      610. }
      611. /**
      612. * Performs a simple select query.
      613. *
      614. * @param string The table name to be queried.
      615. * @param string Comma delimetered list of fields to be selected.
      616. * @param string SQL formatted list of conditions to be matched.
      617. * @param array List of options, order by, order direction, limit, limit start
      618. */
      619. function simple_select($table, $fields="*", $conditions="", $options=array())
      620. {
      621. $query = "SELECT ".$fields." FROM {$this->table_prefix}{$table}";
      622. if($conditions != "")
      623. {
      624. $query .= " WHERE ".$conditions;
      625. }
      626. if(isset($options['order_by']))
      627. {
      628. $query .= " ORDER BY ".$options['order_by'];
      629. if(isset($options['order_dir']))
      630. {
      631. $query .= " ".my_strtoupper($options['order_dir']);
      632. }
      633. }
      634. if(isset($options['limit_start']) && isset($options['limit']))
      635. {
      636. $query .= " LIMIT ".$options['limit_start'].", ".$options['limit'];
      637. }
      638. elseif(isset($options['limit']))
      639. {
      640. $query .= " LIMIT ".$options['limit'];
      641. }
      642. return $this->query($query);
      643. }
      644. /**
      645. * Build an insert query from an array.
      646. *
      647. * @param string The table name to perform the query on.
      648. * @param array An array of fields and their values.
      649. * @return int The insert ID if available
      650. */
      651. function insert_query($table, $array)
      652. {
      653. if(!is_array($array))
      654. {
      655. return false;
      656. }
      657. $fields = "`".implode("`,`", array_keys($array))."`";
      658. $values = implode("','", $array);
      659. $this->write_query("
      660. INSERT
      661. INTO {$this->table_prefix}{$table} (".$fields.")
      662. VALUES ('".$values."')
      663. ");
      664. return $this->insert_id();
      665. }
      666. /**
      667. * Build one query for multiple inserts from a multidimensional array.
      668. *
      669. * @param string The table name to perform the query on.
      670. * @param array An array of inserts.
      671. * @return int The insert ID if available
      672. */
      673. function insert_query_multiple($table, $array)
      674. {
      675. if(!is_array($array))
      676. {
      677. return false;
      678. }
      679. // Field names
      680. $fields = array_keys($array[0]);
      681. $fields = "`".implode("`,`", $fields)."`";
      682. $insert_rows = array();
      683. foreach($array as $values)
      684. {
      685. $insert_rows[] = "('".implode("','", $values)."')";
      686. }
      687. $insert_rows = implode(", ", $insert_rows);
      688. $this->write_query("
      689. INSERT
      690. INTO {$this->table_prefix}{$table} ({$fields})
      691. VALUES {$insert_rows}
      692. ");
      693. }
      694. /**
      695. * Build an update query from an array.
      696. *
      697. * @param string The table name to perform the query on.
      698. * @param array An array of fields and their values.
      699. * @param string An optional where clause for the query.
      700. * @param string An optional limit clause for the query.
      701. * @return resource The query data.
      702. */
      703. function update_query($table, $array, $where="", $limit="", $no_quote=false)
      704. {
      705. if(!is_array($array))
      706. {
      707. return false;
      708. }
      709. $comma = "";
      710. $query = "";
      711. $quote = "'";
      712. if($no_quote == true)
      713. {
      714. $quote = "";
      715. }
      716. foreach($array as $field => $value)
      717. {
      718. $query .= $comma."`".$field."`={$quote}{$value}{$quote}";
      719. $comma = ", ";
      720. }
      721. if(!empty($where))
      722. {
      723. $query .= " WHERE $where";
      724. }
      725. if(!empty($limit))
      726. {
      727. $query .= " LIMIT $limit";
      728. }
      729. return $this->write_query("
      730. UPDATE {$this->table_prefix}$table
      731. SET $query
      732. ");
      733. }
      734. /**
      735. * Build a delete query.
      736. *
      737. * @param string The table name to perform the query on.
      738. * @param string An optional where clause for the query.
      739. * @param string An optional limit clause for the query.
      740. * @return resource The query data.
      741. */
      742. function delete_query($table, $where="", $limit="")
      743. {
      744. $query = "";
      745. if(!empty($where))
      746. {
      747. $query .= " WHERE $where";
      748. }
      749. if(!empty($limit))
      750. {
      751. $query .= " LIMIT $limit";
      752. }
      753. return $this->write_query("
      754. DELETE
      755. FROM {$this->table_prefix}$table
      756. $query
      757. ");
      758. }
      759. /**
      760. * Escape a string according to the MySQL escape format.
      761. *
      762. * @param string The string to be escaped.
      763. * @return string The escaped string.
      764. */
      765. function escape_string($string)
      766. {
      767. if(function_exists("mysql_real_escape_string") && $this->read_link)
      768. {
      769. $string = mysql_real_escape_string($string, $this->read_link);
      770. }
      771. else
      772. {
      773. $string = addslashes($string);
      774. }
      775. return $string;
      776. }
      777. /**
      778. * Frees the resources of a MySQLi query.
      779. *
      780. * @param object The query to destroy.
      781. * @return boolean Returns true on success, false on faliure
      782. */
      783. function free_result($query)
      784. {
      785. return mysql_free_result($query);
      786. }
      787. /**
      788. * Escape a string used within a like command.
      789. *
      790. * @param string The string to be escaped.
      791. * @return string The escaped string.
      792. */
      793. function escape_string_like($string)
      794. {
      795. return $this->escape_string(str_replace(array('%', '_') , array('\\%' , '\\_') , $string));
      796. }
      797. /**
      798. * Gets the current version of MySQL.
      799. *
      800. * @return string Version of MySQL.
      801. */
      802. function get_version()
      803. {
      804. if($this->version)
      805. {
      806. return $this->version;
      807. }
      808. $query = $this->query("SELECT VERSION() as version");
      809. $ver = $this->fetch_array($query);
      810. if($ver['version'])
      811. {
      812. $version = explode(".", $ver['version'], 3);
      813. $this->version = intval($version[0]).".".intval($version[1]).".".intval($version[2]);
      814. }
      815. return $this->version;
      816. }
      817. /**
      818. * Optimizes a specific table.
      819. *
      820. * @param string The name of the table to be optimized.
      821. */
      822. function optimize_table($table)
      823. {
      824. $this->write_query("OPTIMIZE TABLE {$this->table_prefix}{$table}");
      825. }
      826. /**
      827. * Analyzes a specific table.
      828. *
      829. * @param string The name of the table to be analyzed.
      830. */
      831. function analyze_table($table)
      832. {
      833. $this->write_query("ANALYZE TABLE {$this->table_prefix}{$table}");
      834. }
      835. /**
      836. * Show the "create table" command for a specific table.
      837. *
      838. * @param string The name of the table.
      839. * @return string The MySQL command to create the specified table.
      840. */
      841. function show_create_table($table)
      842. {
      843. $query = $this->write_query("SHOW CREATE TABLE {$this->table_prefix}{$table}");
      844. $structure = $this->fetch_array($query);
      845. return $structure['Create Table'];
      846. }
      847. /**
      848. * Show the "show fields from" command for a specific table.
      849. *
      850. * @param string The name of the table.
      851. * @return string Field info for that table
      852. */
      853. function show_fields_from($table)
      854. {
      855. $query = $this->write_query("SHOW FIELDS FROM {$this->table_prefix}{$table}");
      856. while($field = $this->fetch_array($query))
      857. {
      858. $field_info[] = $field;
      859. }
      860. return $field_info;
      861. }
      862. /**
      863. * Returns whether or not the table contains a fulltext index.
      864. *
      865. * @param string The name of the table.
      866. * @param string Optionally specify the name of the index.
      867. * @return boolean True or false if the table has a fulltext index or not.
      868. */
      869. function is_fulltext($table, $index="")
      870. {
      871. $structure = $this->show_create_table($table);
      872. if($index != "")
      873. {
      874. if(preg_match("#FULLTEXT KEY (`?)$index(`?)#i", $structure))
      875. {
      876. return true;
      877. }
      878. else
      879. {
      880. return false;
      881. }
      882. }
      883. if(preg_match('#FULLTEXT KEY#i', $structure))
      884. {
      885. return true;
      886. }
      887. return false;
      888. }
      889. /**
      890. * Returns whether or not this database engine supports fulltext indexing.
      891. *
      892. * @param string The table to be checked.
      893. * @return boolean True or false if supported or not.
      894. */
      895. function supports_fulltext($table)
      896. {
      897. $version = $this->get_version();
      898. $query = $this->write_query("SHOW TABLE STATUS LIKE '{$this->table_prefix}$table'");
      899. $status = $this->fetch_array($query);
      900. if($status['Engine'])
      901. {
      902. $table_type = my_strtoupper($status['Engine']);
      903. }
      904. else
      905. {
      906. $table_type = my_strtoupper($status['Type']);
      907. }
      908. if($version >= '3.23.23' && $table_type == 'MYISAM')
      909. {
      910. return true;
      911. }
      912. return false;
      913. }
      914. /**
      915. * Returns whether or not this database engine supports boolean fulltext matching.
      916. *
      917. * @param string The table to be checked.
      918. * @return boolean True or false if supported or not.
      919. */
      920. function supports_fulltext_boolean($table)
      921. {
      922. $version = $this->get_version();
      923. $supports_fulltext = $this->supports_fulltext($table);
      924. if($version >= '4.0.1' && $supports_fulltext == true)
      925. {
      926. return true;
      927. }
      928. return false;
      929. }
      930. /**
      931. * Creates a fulltext index on the specified column in the specified table with optional index name.
      932. *
      933. * @param string The name of the table.
      934. * @param string Name of the column to be indexed.
      935. * @param string The index name, optional.
      936. */
      937. function create_fulltext_index($table, $column, $name="")
      938. {
      939. $this->write_query("
      940. ALTER TABLE {$this->table_prefix}$table
      941. ADD FULLTEXT $name ($column)
      942. ");
      943. }
      944. /**
      945. * Drop an index with the specified name from the specified table
      946. *
      947. * @param string The name of the table.
      948. * @param string The name of the index.
      949. */
      950. function drop_index($table, $name)
      951. {
      952. $this->write_query("
      953. ALTER TABLE {$this->table_prefix}$table
      954. DROP INDEX $name
      955. ");
      956. }
      957. /**
      958. * Checks to see if an index exists on a specified table
      959. *
      960. * @param string The name of the table.
      961. * @param string The name of the index.
      962. */
      963. function index_exists($table, $index)
      964. {
      965. $index_exists = false;
      966. $query = $this->write_query("SHOW INDEX FROM {$this->table_prefix}{$table}");
      967. while($ukey = $this->fetch_array($query))
      968. {
      969. if($ukey['Key_name'] == $index)
      970. {
      971. $index_exists = true;
      972. break;
      973. }
      974. }
      975. if($index_exists)
      976. {
      977. return true;
      978. }
      979. return false;
      980. }
      981. /**
      982. * Drop an table with the specified table
      983. *
      984. * @param boolean hard drop - no checking
      985. * @param boolean use table prefix
      986. */
      987. function drop_table($table, $hard=false, $table_prefix=true)
      988. {
      989. if($table_prefix == false)
      990. {
      991. $table_prefix = "";
      992. }
      993. else
      994. {
      995. $table_prefix = $this->table_prefix;
      996. }
      997. if($hard == false)
      998. {
      999. $this->write_query('DROP TABLE IF EXISTS '.$table_prefix.$table);
      1000. }
      1001. else
      1002. {
      1003. $this->write_query('DROP TABLE '.$table_prefix.$table);
      1004. }
      1005. }
      1006. /**
      1007. * Replace contents of table with values
      1008. *
      1009. * @param string The table
      1010. * @param array The replacements
      1011. */
      1012. function replace_query($table, $replacements=array())
      1013. {
      1014. $values = '';
      1015. $comma = '';
      1016. foreach($replacements as $column => $value)
      1017. {
      1018. $values .= $comma."`".$column."`='".$value."'";
      1019. $comma = ',';
      1020. }
      1021. if(empty($replacements))
      1022. {
      1023. return false;
      1024. }
      1025. return $this->write_query("REPLACE INTO {$this->table_prefix}{$table} SET {$values}");
      1026. }
      1027. /**
      1028. * Sets the table prefix used by the simple select, insert, update and delete functions
      1029. *
      1030. * @param string The new table prefix
      1031. */
      1032. function set_table_prefix($prefix)
      1033. {
      1034. $this->table_prefix = $prefix;
      1035. }
      1036. /**
      1037. * Fetched the total size of all mysql tables or a specific table
      1038. *
      1039. * @param string The table (optional)
      1040. * @return integer the total size of all mysql tables or a specific table
      1041. */
      1042. function fetch_size($table='')
      1043. {
      1044. if($table != '')
      1045. {
      1046. $query = $this->query("SHOW TABLE STATUS LIKE '".$this->table_prefix.$table."'");
      1047. }
      1048. else
      1049. {
      1050. $query = $this->query("SHOW TABLE STATUS");
      1051. }
      1052. $total = 0;
      1053. while($table = $this->fetch_array($query))
      1054. {
      1055. $total += $table['Data_length']+$table['Index_length'];
      1056. }
      1057. return $total;
      1058. }
      1059. /**
      1060. * Fetch a list of database character sets this DBMS supports
      1061. *
      1062. * @return array Array of supported character sets with array key being the name, array value being display name. False if unsupported
      1063. */
      1064. function fetch_db_charsets()
      1065. {
      1066. if($this->link && version_compare($this->get_version(), "4.1", "<"))
      1067. {
      1068. return false;
      1069. }
      1070. return array(
      1071. 'big5' => 'Big5 Traditional Chinese',
      1072. 'dec8' => 'DEC West European',
      1073. 'cp850' => 'DOS West European',
      1074. 'hp8' => 'HP West European',
      1075. 'koi8r' => 'KOI8-R Relcom Russian',
      1076. 'latin1' => 'cp1252 West European',
      1077. 'latin2' => 'ISO 8859-2 Central European',
      1078. 'swe7' => '7bit Swedish',
      1079. 'ascii' => 'US ASCII',
      1080. 'ujis' => 'EUC-JP Japanese',
      1081. 'sjis' => 'Shift-JIS Japanese',
      1082. 'hebrew' => 'ISO 8859-8 Hebrew',
      1083. 'tis620' => 'TIS620 Thai',
      1084. 'euckr' => 'EUC-KR Korean',
      1085. 'koi8u' => 'KOI8-U Ukrainian',
      1086. 'gb2312' => 'GB2312 Simplified Chinese',
      1087. 'greek' => 'ISO 8859-7 Greek',
      1088. 'cp1250' => 'Windows Central European',
      1089. 'gbk' => 'GBK Simplified Chinese',
      1090. 'latin5' => 'ISO 8859-9 Turkish',
      1091. 'armscii8' => 'ARMSCII-8 Armenian',
      1092. 'utf8' => 'UTF-8 Unicode',
      1093. 'ucs2' => 'UCS-2 Unicode',
      1094. 'cp866' => 'DOS Russian',
      1095. 'keybcs2' => 'DOS Kamenicky Czech-Slovak',
      1096. 'macce' => 'Mac Central European',
      1097. 'macroman' => 'Mac West European',
      1098. 'cp852' => 'DOS Central European',
      1099. 'latin7' => 'ISO 8859-13 Baltic',
      1100. 'cp1251' => 'Windows Cyrillic',
      1101. 'cp1256' => 'Windows Arabic',
      1102. 'cp1257' => 'Windows Baltic',
      1103. 'binary' => 'Binary pseudo charset',
      1104. 'geostd8' => 'GEOSTD8 Georgian',
      1105. 'cp932' => 'SJIS for Windows Japanese',
      1106. 'eucjpms' => 'UJIS for Windows Japanese',
      1107. );
      1108. }
      1109. /**
      1110. * Fetch a database collation for a particular database character set
      1111. *
      1112. * @param string The database character set
      1113. * @return string The matching database collation, false if unsupported
      1114. */
      1115. function fetch_charset_collation($charset)
      1116. {
      1117. $collations = array(
      1118. 'big5' => 'big5_chinese_ci',
      1119. 'dec8' => 'dec8_swedish_ci',
      1120. 'cp850' => 'cp850_general_ci',
      1121. 'hp8' => 'hp8_english_ci',
      1122. 'koi8r' => 'koi8r_general_ci',
      1123. 'latin1' => 'latin1_swedish_ci',
      1124. 'latin2' => 'latin2_general_ci',
      1125. 'swe7' => 'swe7_swedish_ci',
      1126. 'ascii' => 'ascii_general_ci',
      1127. 'ujis' => 'ujis_japanese_ci',
      1128. 'sjis' => 'sjis_japanese_ci',
      1129. 'hebrew' => 'hebrew_general_ci',
      1130. 'tis620' => 'tis620_thai_ci',
      1131. 'euckr' => 'euckr_korean_ci',
      1132. 'koi8u' => 'koi8u_general_ci',
      1133. 'gb2312' => 'gb2312_chinese_ci',
      1134. 'greek' => 'greek_general_ci',
      1135. 'cp1250' => 'cp1250_general_ci',
      1136. 'gbk' => 'gbk_chinese_ci',
      1137. 'latin5' => 'latin5_turkish_ci',
      1138. 'armscii8' => 'armscii8_general_ci',
      1139. 'utf8' => 'utf8_general_ci',
      1140. 'ucs2' => 'ucs2_general_ci',
      1141. 'cp866' => 'cp866_general_ci',
      1142. 'keybcs2' => 'keybcs2_general_ci',
      1143. 'macce' => 'macce_general_ci',
      1144. 'macroman' => 'macroman_general_ci',
      1145. 'cp852' => 'cp852_general_ci',
      1146. 'latin7' => 'latin7_general_ci',
      1147. 'cp1251' => 'cp1251_general_ci',
      1148. 'cp1256' => 'cp1256_general_ci',
      1149. 'cp1257' => 'cp1257_general_ci',
      1150. 'binary' => 'binary',
      1151. 'geostd8' => 'geostd8_general_ci',
      1152. 'cp932' => 'cp932_japanese_ci',
      1153. 'eucjpms' => 'eucjpms_japanese_ci',
      1154. );
      1155. if($collations[$charset])
      1156. {
      1157. return $collations[$charset];
      1158. }
      1159. return false;
      1160. }
      1161. /**
      1162. * Fetch a character set/collation string for use with CREATE TABLE statements. Uses current DB encoding
      1163. *
      1164. * @return string The built string, empty if unsupported
      1165. */
      1166. function build_create_table_collation()
      1167. {
      1168. if(!$this->db_encoding)
      1169. {
      1170. return '';
      1171. }
      1172. $collation = $this->fetch_charset_collation($this->db_encoding);
      1173. if(!$collation)
      1174. {
      1175. return '';
      1176. }
      1177. return " CHARACTER SET {$this->db_encoding} COLLATE {$collation}";
      1178. }
      1179. /**
      1180. * Time how long it takes for a particular piece of code to run. Place calls above & below the block of code.
      1181. *
      1182. * @return float The time taken
      1183. */
      1184. function get_execution_time()
      1185. {
      1186. static $time_start;
      1187. $time = strtok(microtime(), ' ') + strtok('');
      1188. // Just starting timer, init and return
      1189. if(!$time_start)
      1190. {
      1191. $time_start = $time;
      1192. return;
      1193. }
      1194. // Timer has run, return execution time
      1195. else
      1196. {
      1197. $total = $time-$time_start;
      1198. $time_start = 0;
      1199. if($total < 0) $total = 0;
      1200. return $total;
      1201. }
      1202. }
      1203. }
      1204. ?>
      Alles anzeigen


      das is nu die .php wo er agt fehler aber wo ich nix definieren kann allein mit mein paar php kenntnissen :(
      komme da irgend wie nicht weiter
    • [COLOR="Cyan"]Hm, das ist dann die Falsche Datei. :o

      Irgendwo muss eine Datei liegen, die genau
      config.php
      ODER
      config.inc
      heist.

      Diese Datei sieht bei MyBB normalerweise so aus:

      PHP-Quellcode

      1. <?php
      2. /* Datenbankkonfiguration */
      3. $config['database']['type'] = "mysql";
      4. $config['database']['database'] = "database-name";
      5. $config['database']['table_prefix'] = "mybb_";
      6. $config['database']['hostname'] = "localhost";
      7. $config['database']['username'] = "mysql-username";
      8. $config['database']['password'] = "mysql-password";
      9. /* Admin-CP URL / Ordnername des Admin-CPs */
      10. $config['admindir'] = "admin";
      11. /* Links zum Admin-CP zeigen? */
      12. $config['hide_admin_links'] = 0;
      13. /* Cache-Konfiguration */
      14. /* files = Speichert Cache im Ordner /inc/cache/ (muss beschreibbar sein!) */
      15. /* db = Speichert Cache in der Datenbank */
      16. $config['cachestore'] = "db";
      17. /* Memcache-Konfiguration */
      18. /* Nur wichtig, wenn Memcache eingesetzt wird */
      19. $config['memcache_host'] = 'localhost';
      20. $config['memcache_port'] = 11211;
      21. /* Super-Administratoren; mehere IDs durch Kommas trennen */
      22. $config['super_admins'] = '1';
      23. /* Datenbank-Kodierung */
      24. $config['database']['encoding'] = 'utf8';
      25. /* Automatische Logbereinigung */
      26. $config['log_pruning'] = array(
      27. 'admin_logs' => 365, // Administrator logs
      28. 'mod_logs' => 0, // Moderator logs
      29. 'task_logs' => 30, // Scheduled task logs
      30. 'mail_logs' => 180, // Mail error logs
      31. 'user_mail_logs' => 180, // User mail logs
      32. 'promotion_logs' => 180 // Promotion logs
      33. );
      34. ?>
      Alles anzeigen


      Die musst du finden und editieren, die muss irgendwo da liegen.

      mfg
      Valron[/COLOR]