Warning: include(./inc/user.inc.php) [function.include]: failed to open stream: No such file or directory in /home/a9173424/public_html/sip/algo/core/init.inc.php on line 20
Warning: include() [function.include]: Failed opening './inc/user.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a9173424/public_html/sip/algo/core/init.inc.php on line 20
here is my code
init.inc.php from core folder
<?php session_start(); $exceptions = array('register', 'login'); $page = substr(end(explode('/', $_SERVER['SCRIPT_NAME'])), 0, -4); if (in_array ($page, $exceptions) === false){ if (isset($_SESSION['username']) === false){ header('Location: ../login.php'); } } mysql_connect('mysql2.000webhost.com', 'a9173424_admin', '2a2a6262'); mysql_select_db('a9173424_mystore'); $path = dirname(_FILE_); include("{$path}/inc/user.inc.php"); ?>user.inc.php from inc foler
<?php //checks if the given username exists in the database. function user_exists($user){ $user = mysql_real_escape_string($user); /* $total = mysql_query("SELECT COUNT('user_id') FROM 'users' WHERE 'user_name' = {$user}'");*/ $total = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `user_name` = {$user}'"); return (mysql_result($total, 0) == '1') ? true : false; } //checks if the given username and password combination is valid. function valid_credentials($user, $pass){ $user = mysql_real_escape_string($user); $pass = sha1($pass); /* $total = mysql_query("SELECT COUNT('user_id') FROM 'users' WHERE 'user_name' = [$user}' AND 'user_password'= '{$pass}'");*/ $total = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `user_name` ='{$user}' AND `user_password` = '{$pass}'"); return (mysql_result($total, 0) == '1') ? true : false; } //adds a user to the database. function add_user($user, $pass){ $user = mysql_real_escape_string(htmlentities($user)); $pass = sha1($pass); /* mysql_query("INSERT INTO 'users' ('user_name', 'user_password'') VALUES ('{$user}', '{$pass}')");*/ mysql_query("INSERT INTO `users` (`user_name`,`user_password`) VALUES ('{$user}','{$pass}')"); } ?>and register.php
<?php include('core/init.inc.php'); $errors = array(); //check if form was sent. if (isset($_POST['username'], $_POST['password'], $_POST['repeat_password'])){ if (empty($_POST['username'])){ $errors[] = 'The username cannot be empty.'; } if (empty($_POST['password']) || empty($_POST['repeat_password'])){ $errors[] = 'The password cannot be empty.'; } if ($_POST['password'] !== $_POST['repeat_password']){ $errors[] = 'Password verification failed.'; } //call function user_exists() from user.inc.php if (user_exists($_POST['username'])){ $errors[] = 'The username you entered is already taken.'; } if (empty($errors)){ //call function add_user() from user.inc.php add_user($_POST['username'], $_POST['password']); $_SESSION['username'] = htmlentities($_POST['username']); header('Location: protected.php'); die(); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="ext/css/style.css" type="text/css" /> </head> <div> <?php if (empty($errors) === false){ ?> <ul> <?php foreach ($errors as $error){ echo "<li>{$error}</li>"; } ?> </ul> <?php } ?> </div> <body> <form action="" method="post"> <p> <label for="username">Username:</label> <input type="text" name="username" id="username" /> </p> <p> <label for="password">Password:</label> <input type="password" name="password" id="password" /> </p> <p> <label for="repeat_password">Repeat Password:</label> <input type="password" name="repeat_password" id="repeat_password" /> </p> <p> <input type="submit" value="Register" /> </p> </form> </body>anyway i made this link from my code if someone wanna look it
http://www.mediafire.com/?g4yazt16gqtkd02 helpme pls