/    Sign up×
Community /Pin to ProfileBookmark

Problem with Session/Logins/Register page

Hey,

Im fairly new to php and sessions etc. Im trying to create a site with sessions. ive read a few tutorials and used a template but i have errors on line 21 and 33. can anyone elaborate on how i shud fix this? im guessing it simple.

[code=php]<?php

//require the PEAR::DB classes.

require_once ‘Connections/TheBuzzo.php’;

$db_engine = ‘mysqls’;
$db_user = ‘[Removed by Moderator]’;
$db_pass = ‘[Removed by Moderator]’;
$db_host = ‘mysql2.streamline.net’;
$db_name = ‘TheBuzzo’;

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

$db_object = TheBuzzo/Tables/users/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(TheBuzzo::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’);

?>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″ />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@so_is_thisNov 17.2006 — To keep a single session going, each page that is to maintain the session must have the following very near the first line of PHP code in the page -- at least before anything is output back to the client:

session_start();
Copy linkTweet thisAlerts:
@gazzwi86authorNov 22.2006 — how would i go about restricting areas? no code would have to go in the bracets?
Copy linkTweet thisAlerts:
@jignesh1Nov 22.2006 — y dont u just exit() if the session is not there

that way nobody could view ur pages from other directory
Copy linkTweet thisAlerts:
@so_is_thisNov 22.2006 — how would i go about restricting areas? no code would have to go in the bracets?[/QUOTE]
No, this function takes no arguments. Restricting areas would require a sign on process.
×

Success!

Help @gazzwi86 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...