W folderze public_html w Index.php mam tak:
<?php
// Powered by Zyro
include dirname(__FILE__).'/zyro/config.php'; db_connect();
W folderze tym /zyro/ ten config.php:
<?php
// Powered by Zyro
include dirname(__FILE__).'/zyro/index.php'; db_connect();
// definiujemy dane do połączenia z bazą danych
function db_connect() {
// połączenie z mysql
mysql_connect(DBHOST
, DBUSER
, DBPASS
) or
die('<h2>ERROR</h2> MySQL Server is not responding');
// wybór bazy danych
}
function db_close() {
}
function clear($text) {
// jeśli serwer automatycznie dodaje slashe to je usuwamy
}
$text = trim($text); // usuwamy białe znaki na początku i na końcu return $text;
}
function codepass($password) {
// kodujemy hasło (losowe znaki można zmienić lub całkowicie usunąć
return sha1
(md5($password).'#!%Rgd64'); }
// funkcja na sprawdzanie czy user jest zalogowany, jeśli nie to wyświetlamy komunikat
function check_login() {
if(!$_SESSION['logged']) {
die('<p>To jest strefa tylko dla użytkowników.</p> <p>[<a href="login.php">Logowanie</a>] [<a href="register.php">Zarejestruj się</a>]</p>');
}
}
// funkcja na pobranie danych usera
function get_user_data($user_id = -1) {
// jeśli nie podamy id usera to podstawiamy id aktualnie zalogowanego
if($user_id == -1) {
$user_id = $_SESSION['user_id'];
}
$result = mysql_query("SELECT * FROM `users` WHERE `user_id` = '{$user_id}' LIMIT 1"); return false;
}
}
// startujemy sesje
// jeśli nie ma jeszcze sesji "logged" i "user_id" to wypełniamy je domyślnymi danymi
if(!isset($_SESSION['logged'])) { $_SESSION['logged'] = false;
$_SESSION['user_id'] = -1;
}
?>
Posiadam również jeszcze jeden plik Index.php, tym razem w folderze /zyro/, nie w public_html
<?php
'0' => array('id' => '1', 'alias' => 'STRONA-GŁÓWNA', 'file' => '1.php'), '1' => array('id' => '2', 'alias' => 'O-NAS', 'file' => '2.php'), '2' => array('id' => '3', 'alias' => 'KONTAKT', 'file' => '3.php'), '3' => array('id' => '7', 'alias' => 'MATEMATYKA', 'file' => '7.php'), '4' => array('id' => '8', 'alias' => 'LICZBY-I-DZIAŁANIA', 'file' => '8.php'), '5' => array('id' => '10', 'alias' => 'UŁAMKI-ZWYKŁE', 'file' => '10.php'), '6' => array('id' => '9', 'alias' => 'UŁAMKI-DZIESIĘTNE', 'file' => '9.php'), '7' => array('id' => '11', 'alias' => 'LICZBY-UJEMNE', 'file' => '11.php'), '8' => array('id' => '12', 'alias' => 'PROCENTY', 'file' => '12.php'), '9' => array('id' => '4', 'alias' => 'WYRAZENIA-ALGEBRAICZNE', 'file' => '4.php'), '10' => array('id' => '5', 'alias' => 'RÓWNANIA-I-NIERÓWNOŚCI', 'file' => '5.php'), '11' => array('id' => '13', 'alias' => 'POTĘGI-I-PIERWIASTKI', 'file' => '13.php'), '12' => array('id' => '14', 'alias' => 'FUNKCJE', 'file' => '14.php'), '13' => array('id' => '15', 'alias' => 'ZBIORY-I-PRZEDZIAŁY', 'file' => '15.php'), '14' => array('id' => '16', 'alias' => 'WARTOŚĆ-BEZWZGLĘDNA', 'file' => '16.php'), '15' => array('id' => '17', 'alias' => 'FUNKCJA-LINIOWA', 'file' => '17.php'), '16' => array('id' => '18', 'alias' => 'FUNKCJA-KWADRATOWA', 'file' => '18.php'), '17' => array('id' => '19', 'alias' => 'LOGARYTMY', 'file' => '19.php'), '18' => array('id' => '20', 'alias' => 'TRYGONOMETRIA', 'file' => '20.php'), '19' => array('id' => '21', 'alias' => 'PLANIMETRIA', 'file' => '21.php'), '20' => array('id' => '6', 'alias' => 'UKŁADY-RÓWNAŃ', 'file' => '6.php'), '21' => array('id' => '22', 'alias' => 'BIOLOGIA', 'file' => '22.php'), '22' => array('id' => '24', 'alias' => 'Przegląd-organizmów', 'file' => '24.php'), '23' => array('id' => '23', 'alias' => 'Struktura-i-funkcje-organizmu', 'file' => '23.php'), '24' => array('id' => '25', 'alias' => 'Wybrane-czynności-życiowe-organizmów', 'file' => '25.php'), '25' => array('id' => '26', 'alias' => 'Ewolucja-organizmów', 'file' => '26.php'), '26' => array('id' => '27', 'alias' => 'Człowiek-jako-istota-biologiczna-i-społeczna', 'file' => '27.php'), '27' => array('id' => '29', 'alias' => 'Ochrona-środowiska-a-zdrowie-człowieka', 'file' => '29.php'), '28' => array('id' => '30', 'alias' => 'Dziedziczność', 'file' => '30.php'), '29' => array('id' => '31', 'alias' => 'Ekologia-i-ochrona-środowiska', 'file' => '31.php'), '30' => array('id' => '28', 'alias' => 'Budowa-i-funkcjonowanie-organizmu-człowieka', 'file' => '28.php') );
'cf710345' => Array( 'email' => 'sciagaweczka@gmail.com', 'subject' => 'ZAMÓWIENIE', 'sentMessage' => 'Zamówienie zostało wysłane! W ciągu 12H dostaniesz link zwrotny z formularzem płatności, a następnie ściągą. KOSZT 3,69 PLN', 'fields' => array( array( 'fidx' => '0', 'name' => 'Przedmiot', 'type' => 'input', 'options' => '' ), array( 'fidx' => '1', 'name' => 'Dział', 'type' => 'input', 'options' => '' ), array( 'fidx' => '2', 'name' => 'Klasa', 'type' => 'input', 'options' => '' ), array( 'fidx' => '3', 'name' => 'E-Mail', 'type' => 'input', 'options' => '' ), array( 'fidx' => '4', 'name' => 'Dodatkowo', 'type' => 'textarea', 'options' => '' ) ) ) ),
'339deee3' => Array( 'email' => 'sciagaweczka@gmail.com', 'subject' => 'ZAMÓWIENIE', 'sentMessage' => 'Zamówienie zostało wysłane! W ciągu 12H dostaniesz link zwrotny z formularzem płatności, a następnie ściągą. KOSZT 3,69 PLN', 'fields' => array( array( 'fidx' => '0', 'name' => 'Przedmiot', 'type' => 'input', 'options' => '' ), array( 'fidx' => '1', 'name' => 'Dział', 'type' => 'input', 'options' => '' ), array( 'fidx' => '2', 'name' => 'Klasa', 'type' => 'input', 'options' => '' ), array( 'fidx' => '3', 'name' => 'E-Mail', 'type' => 'input', 'options' => '' ), array( 'fidx' => '4', 'name' => 'Dodatkowo', 'type' => 'textarea', 'options' => '' ) ) ) ),
'946a57f2' => Array( 'email' => 'sciagaweczka@gmail.com', 'subject' => 'ZAMÓWIENIE', 'sentMessage' => 'Zamówienie zostało wysłane! W ciągu 12H dostaniesz link zwrotny z formularzem płatności, a następnie ściągą. KOSZT 3,69 PLN', 'fields' => array( array( 'fidx' => '0', 'name' => 'Przedmiot', 'type' => 'input', 'options' => '' ), array( 'fidx' => '1', 'name' => 'Dział', 'type' => 'input', 'options' => '' ), array( 'fidx' => '2', 'name' => 'Klasa', 'type' => 'input', 'options' => '' ), array( 'fidx' => '3', 'name' => 'E-Mail', 'type' => 'input', 'options' => '' ), array( 'fidx' => '4', 'name' => 'Dodatkowo', 'type' => 'textarea', 'options' => '' ) ) ) )
);
$base_url = '/';
$show_comments = false;
include dirname(__FILE__).'/functions.inc.php'; $home_page = '1';
$page_id = parse_uri();
$user_key = "CTqCyqSjmE4N+MNkmqOuP/776S0=";
$user_hash = "5251b6f1c08a5a17";
$comment_callback = "http://us.zyro.com/pl-PL/comment_callback/";
$preview = false;
$mod_rewrite = true;
handleComments($pages[$page_id]['id']);
if (isset($_POST["wb_form_id"])) handleForms
($pages[$page_id]['id']); if (isset($_REQUEST['view']) && $_REQUEST['view'] == 'news') include dirname(__FILE__).'/news.php'; else if (isset($_REQUEST['view']) && $_REQUEST['view'] == 'blog') include dirname(__FILE__).'/blog.php'; else {
$fl = dirname(__FILE__).'/'.$pages[$page_id]['file']; if (is_file($fl)) include $fl; else echo '404 Not found'; }
Po tym wyskakuje mi bląd :
Fatal error: Call to undefined function db_connect() in /home/u620211347/public_html/index.php on line 4