- Messages
- 5,534
- Reaction score
- 43
- Points
- 48
Dear readers,
I am posting this because i am not understanding a few things got to do with this php stuff, i am very new to php and am just learning about SQL and login/register pages and stuff, i will provide the code that is being used, and ask for some help about this error:
Code:
[B]Warning[/B]: require_once(/home/sexylist/public_htmlconfig.php) [[URL="http://sheeplist.exofire.net/function.require-once"]function.require-once[/URL]]: failed to open stream: No such file or directory in [B]/home/sexylist/public_html/login.php[/B] on line [B]5[/B]
[B]Fatal error[/B]: require_once() [[URL="http://sheeplist.exofire.net/function.require"]function.require[/URL]]: Failed opening required '/home/sexylist/public_htmlconfig.php' (include_path='.:/x10hosting/php1/lib/php') in [B]/home/sexylist/public_html/login.php[/B] on line [B]5[/B]
This is the error i am getting, this error i get when i try to view "login.php". I am unsure of what is causing it, i edited the rest of my php code to get it working, i have the register page working, the success page working and register_process and config pages all work aswell, it's just this page that doesn't seem to be working, the code for the login.php page is this:
PHP:
<?php
session_start();
// Require once the DB script
require_once ($_SERVER['DOCUMENT_ROOT']. 'config.php');
if ($_POST['loginSubmit']) {
// You *always!* need to validate user-supplied data when using it in MySQL queries!!
// This isn't 100% secure, but it's definitely better than having nothing and being vulnerable to SQL injection.
if(get_magic_quotes_gpc()) {
if(ini_get('magic_quotes_sybase')) {
$username = str_replace("''", "'", $_POST['username']);
$password = str_replace("''", "'", $_POST['password']);
} else {
$username = stripslashes($_POST['username']);
$password = stripslashes($_POST['password']);
}
} else {
$username = $_POST['username'];
$password = $_POST['password'];
}
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);
$check = mysql_query("SELECT * FROM `users` WHERE `users` = '$username' and `password` = '$password' LIMIT 1");
// Counting the table row
// If the result is matched then $username, $password must be row 1
$count = @mysql_num_rows($check);
// Logged in!
if ($count == (int) 1) {
$_SESSION['site_username'] = $username;
$_SESSION['site_password'] = $password;
echo '
<div align="center">
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>
Welcome '. $_SESSION['site_username'] .'. You are now logged in!<br /><a href="members">Click Here to Continue</a><br /><a href="logout.php">Click here to logout if you want to now!</a>
</td>
</tr>
</table>
</div>
';
$_GET['do'] = 'manualUnset';
// Do whatever ?
}
else {
echo 'Error: Wrong username or password specified. <br />';
}
}
// If $_GET['do'] is set to 'manualUnset', do not show login form, user already logged in.
switch ($_GET['do']) {
case 'manualUnset':
break;
default:
?>
<div align="center">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table width="90%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>Username:</td>
<td>Password:</td>
</tr>
<tr>
<td><input type="text" name="username" /></td>
<td><input type="password" name="password" /> <input name="loginSubmit" type="submit" value="Login" class="button" />
</tr>
<tr>
<td>
<?php
break;
}
?>
</td>
</tr>
</table>
</form>
</div>
Thanks in advance for any help, and thank you to Zenax for supplying me with this login/register script.
Kind Regards, HeLLshEEp