We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
php login problem
Topic Started: Jun 22 2005, 12:44 PM (701 Views)
Gimliisadwarf
Member Avatar
Member
[ * ]
well i found some site where it shows you how to make a php login thing and make it work and all :P
http://www.free2code.net/plugins/articles/read.php?id=99

well i saved everything i should have i uploaded it to the webhost
and i get this problem on every page

Code:
 
Warning: main(DB.php): failed to open stream: No such file or directory in /usr/export/www/hosting/gimliisadwarf/db_connect.php on line 5

Fatal error: main(): Failed opening required 'DB.php' (include_path='.:') in /usr/export/www/hosting/gimliisadwarf/db_connect.php on line 5


http://gimliisadwarf.gi.funpic.org/
yea there is the site on and all the documents required to make it work... but it doesnt :P

here is an example of one of them that doesnt work

Code:
 
<?php

//require the PEAR::DB classes.

require_once 'DB.php';


$db_engine = 'mysql';
$db_user = 'username';
$db_pass = 'password';
$db_host = 'localhost';
$db_name = 'database';

$datasource = $db_engine.'://'.
    $db_user.':'.
    $db_pass.'@'.
     $db_host.'/'.
      $db_name;


$db_object = DB::connect($datasource, TRUE);

/* assign database object in $db_object,

if the connection fails $db_object will contain

the error message. */

// If $db_object contains an error:

// error and exit.

if(DB::isError($db_object)) {
die($db_object->getMessage());
}

$db_object->setFetchMode(DB_FETCHMODE_ASSOC);

// we write this later on, ignore for now.

include('check_login.php');

?>


can someone please help?
Offline Profile Quote Post Goto Top
 
Ben
Member Avatar
Quantum-locked when observed.

You need to upload DB.php. ;)
Offline Profile Quote Post Goto Top
 
Gimliisadwarf
Member Avatar
Member
[ * ]
I have uploaded all the files i should have done...
lol or atleast thats what the site said :P
Code:
 
$db_engine = 'mysql';
$db_user = 'username';
$db_pass = 'password';
$db_host = 'localhost';
$db_name = 'database';

but I read on the site that you had to fill in
that ^

like with your username password and all...
Not sure if that is it but what do i put under db_host??
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
Just put
Code:
 
$db_engine = 'mysql';
$db_user = 'username';
$db_pass = 'password';
$db_host = 'localhost';
$db_name = 'database';
in the file DB.php and remove the lines from the other files.
db_host should be where the database is hosted.
(When creating a database, they should tell you. Though localhost will be it a lot of times)
Offline Profile Quote Post Goto Top
 
Ben
Member Avatar
Quantum-locked when observed.

Gimliisadwarf
June 22, 2005 12:15 PM
but I read on the site that you had to fill in
that ^

like with your username password and all...
Not sure if that is it but what do i put under db_host??

Yes, you need to fill in your username and password to the MySQL database, as well as the database you would like to access.

The db_host is almost always "localhost".

Quote:
 
I have uploaded all the files i should have done...
lol or atleast thats what the site said

Ah, I see that DB.php is the PEAR library's database file. . . .

Check if your webhost supports the PEAR library, because then it should have that file. . . . :blink:
Offline Profile Quote Post Goto Top
 
Gimliisadwarf
Member Avatar
Member
[ * ]
hmm i changed the username and password but that doesnt seem to be the problem... lol this is allot harder then i expected

i dont think the website can support pear library... does anyone know of another way to do the same thing?
(make a login thing and make it work)
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
*Qj feels like he is being ignored.

Go 3 posts up, read, do, have a loggin script.
(Assuming you did the rest right ;) )
Offline Profile Quote Post Goto Top
 
Ben
Member Avatar
Quantum-locked when observed.

Qj
June 22, 2005 01:37 PM
*Qj feels like he is being ignored.

Go 3 posts up, read, do, have a loggin script.
(Assuming you did the rest right ;) )

The DB.php file is apparently the PEAR file for DB classes. As you can see in the rest of the script, the class "DB" is constantly being used. So putting the aforementioned information into a file and calling it DB.php will be no use, because one would still have to write the DB class.

The alternative is to not use PEAR at all, which would mean to completely rewrite the existing login script because it is dependent upon PEAR. It is perfectly possible, however I do not have a suitable example on hand at the moment.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply