Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsZymic Free Web HostingTutorials right
9 Pages V  < 1 2 3 4 > »    Reply to this topic Start new topic
left right
Nexus
post Mar 21 2008, 11:17 PM
Post #21


Super Ninja
****

Group: Members
Posts: 384
Joined: 19-September 07
From: New Zealand
Member No.: 110



I am so trying this script out. And if it works, then friggin own. This thing will be absolutely perfect for what I'm hoping to achieve...

*cough*WORLDDOMINATION*cough*

xD
Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 22 2008, 01:15 AM
Post #22


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



lol, for a live exaple of what you can do with it, just go to my site. its in my sig.
Go to the top of the page 
 
  + Quote Post
ORiOn
post Mar 22 2008, 06:12 PM
Post #23


Newbie
*

Group: Members
Posts: 11
Joined: 2-December 07
From: Suisse
Member No.: 3,981



Fatal error: Class 'DB' not found in /home/orion/public_html/testes/members system/db_connect.php on line 17

What's wrong??? wacko.gif wink.gif sad.gif


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

Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 22 2008, 07:51 PM
Post #24


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



are you using zymic hosting?
Go to the top of the page 
 
  + Quote Post
ORiOn
post Mar 22 2008, 09:13 PM
Post #25


Newbie
*

Group: Members
Posts: 11
Joined: 2-December 07
From: Suisse
Member No.: 3,981



QUOTE(uncled1023 @ Mar 22 2008, 07:51 PM) *
are you using zymic hosting?



No unsure.gif
Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 22 2008, 09:19 PM
Post #26


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



ok, does your hosting have PEAR installed?
Go to the top of the page 
 
  + Quote Post
ORiOn
post Mar 22 2008, 09:26 PM
Post #27


Newbie
*

Group: Members
Posts: 11
Joined: 2-December 07
From: Suisse
Member No.: 3,981



QUOTE(uncled1023 @ Mar 22 2008, 09:19 PM) *
ok, does your hosting have PEAR installed?



humm.. i don't know, yes i supose...
Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 22 2008, 09:29 PM
Post #28


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



ok, cause the DB.php is in the PEAR system. and without it, the user system will not work. i have not figured out a way to get it to work without it yet. but i should have a solution soon.
Go to the top of the page 
 
  + Quote Post
ORiOn
post Mar 22 2008, 09:29 PM
Post #29


Newbie
*

Group: Members
Posts: 11
Joined: 2-December 07
From: Suisse
Member No.: 3,981



i had erase the require_once 'DB.php'; , and naw i writ ir again
ad i receive this error:

CODE
Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in /home/orion/public_html/testes/members system/db_connect.php on line 5

Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/orion/public_html/testes/members system/db_connect.php on line 5


Line 5:
CODE
require_once 'DB.php';
Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 22 2008, 09:32 PM
Post #30


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



yea, its trying to look for the PEAR. but it doesnt have it. so ill try and find a connection that doesnt require a DB.php. should be simple.
Go to the top of the page 
 
  + Quote Post
ORiOn
post Mar 22 2008, 09:43 PM
Post #31


Newbie
*

Group: Members
Posts: 11
Joined: 2-December 07
From: Suisse
Member No.: 3,981



QUOTE(uncled1023 @ Mar 22 2008, 09:32 PM) *
yea, its trying to look for the PEAR. but it doesnt have it. so ill try and find a connection that doesnt require a DB.php. should be simple.



ok
Tanks
Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 24 2008, 01:10 AM
Post #32


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



ok... i cant figure out a way to transfer from the PEAR:biggrin.gifB format to another older format... Version 4.1.2 of PHP builds PEAR by default, but any version below that doesnt have PEAR. so im sorry, but maybe there is a way for your hosting company to upgrade their php system.
Go to the top of the page 
 
  + Quote Post
krazytaco
post Mar 24 2008, 05:26 AM
Post #33


Newbie
*

Group: Members
Posts: 5
Joined: 24-March 08
Member No.: 15,228



Hey, great system it appears. I do have one problem with it though. I have succesfully registered an accoutn and have logged it in. The login page confrims my test user is logged in. I modified the login page to then redirect back to 'index.php' when that happens though, I am returned with

CODE
Fatal error: Call to undefined method DB_Error::fetchRow() in [path]/check_login.php on line 29


Any ideas what thats about?
Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 24 2008, 06:00 AM
Post #34


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



ok, did you change any of the code in the index.php?
Go to the top of the page 
 
  + Quote Post
krazytaco
post Mar 24 2008, 06:21 AM
Post #35


Newbie
*

Group: Members
Posts: 5
Joined: 24-March 08
Member No.: 15,228



My index.php file looks like this

CODE
<?php include("header.php"); ?>
<?php include('includes/include_connect.php'); ?>

<?php if ($logged_in == 0) {
    echo 'Sorry you are not logged in, this area is restricted to registered members. ';
    echo '<a href="login.php">Click here</a> to log in.';
    exit;
}
?>

...HTML FORM...


include_connect.php is simply db_connect.php with a different name. After the last php close it simply trails off into a form.
Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 24 2008, 11:27 PM
Post #36


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



ok, is the index the one you are trying to have the login box in? or is it the one you are trying to block.
Go to the top of the page 
 
  + Quote Post
krazytaco
post Mar 25 2008, 04:30 AM
Post #37


Newbie
*

Group: Members
Posts: 5
Joined: 24-March 08
Member No.: 15,228



Well, I figured I would just add the login check to every page, just to ensure that users are logged in no matter which page they try to access.

Basically, I want users to start out at index.php, so I have it checking if they're logged in and if they aren't redirecting them to login.php. Once they've submitted on login.php, the page redirects them back to index.php. From there they can navigate to any other portion of the site, but each page should be verifying that they are logged in.
Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 25 2008, 04:38 AM
Post #38


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



ok, if you want to Redirect the person to the login page, i would suggest this script.
CODE
<script type="text/javascript">
<!--
window.location = "/login.php"
//-->
</script>


because it automatically directs them there. so your index.php would look like this.
CODE
<?php include('includes/include_connect.php'); ?> //make sure this code and any other require codes are above your <head>

<?php include("header.php"); ?>
<?php include('includes/include_connect.php'); ?>

<?php if ($logged_in == 0) {
    <script type="text/javascript">
<!--
window.location = "/login.php"
//-->
</script>
}
else {

?>

...HTML FORM...

</body>
</html>
<?php
}
?>
Go to the top of the page 
 
  + Quote Post
krazytaco
post Mar 25 2008, 05:20 AM
Post #39


Newbie
*

Group: Members
Posts: 5
Joined: 24-March 08
Member No.: 15,228



Okay, well that script works but it doesn't solve the original problem. After a user has typed in their login details and once they have clicked "Login", they are greeted with the "Welcome _username_" message, and from there are redirected to index.php, where the same error is now appearing

(Fatal error: Call to undefined method DB_Error::fetchRow() in [path]/check_login.php on line 29)

I think the problem invloves check_login.php somehow, but I'm not entirely sure what some of the db functions you were using for it are, so I'm having problems debugging it. The code for check_login.php is

CODE
<?php

/* check login script, included in db_connect.php. */

session_start();

if (!isset($_SESSION['username']) || !isset($_SESSION['password'])) {
    $logged_in = 0;
    return;
} else {

    // remember, $_SESSION['password'] will be encrypted.

    if(!get_magic_quotes_gpc()) {
        $_SESSION['username'] = addslashes($_SESSION['username']);
    }

    // addslashes to session username before using in a query.
    $qry = "SELECT password FROM users WHERE username = '".$_SESSION['username']."'";
    $pass = $db_object->query($qry);

    if(DB::isError($pass) || $pass->numRows() != 1) {
        $logged_in = 0;
        unset($_SESSION['username']);
        unset($_SESSION['password']);
        // kill incorrect session variables.
    }

    $db_pass = $pass->fetchRow(); //This is line 29

    // now we have encrypted pass from DB in
    //$db_pass['password'], stripslashes() just incase:

    $db_pass['password'] = stripslashes($db_pass['password']);
    $_SESSION['password'] = stripslashes($_SESSION['password']);

    //compare:

    if($_SESSION['password'] == $db_pass['password']) {
        // valid password for username
        $logged_in = 1; // they have correct info
                    // in session variables.
    } else {
        $logged_in = 0;
        unset($_SESSION['username']);
        unset($_SESSION['password']);
        // kill incorrect session variables.
    }
}

// clean up
unset($db_pass['password']);

$_SESSION['username'] = stripslashes($_SESSION['username']);

?>
Go to the top of the page 
 
  + Quote Post
uncled1023
post Mar 25 2008, 05:29 AM
Post #40


Super Ninja
****

Group: Members
Posts: 353
Joined: 24-February 08
Member No.: 11,718



hm... it looks like the same one that i am using. what is your login.php script look like...
Go to the top of the page 
 
  + Quote Post
9 Pages V  < 1 2 3 4 > » 
 Reply to this topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 21st November 2009 - 08:58 PM