473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

parse error

hi,
i am getting a message Parse error:parse error, unexpected $...please help with this code:
<?php
require_once('db_login.php');
$sdbh = "";
$expire = 900;
function sess_open($save_path, $session_name){
global $dbhost, $dbuser, $dbpasswd, $sdbh;
if (! $sdbh = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){
echo mysql_error();
exit;
}
return true;
}
function sess_close(){
return true;
}
function sess_read($key){
global $sdbh, $dbname, $tb_sessions;
$query = "
select
data
from
$tb_sessions
where
id = '$key'
and
expire > UNIX_TIMESTAMP()
";
$result = mysql_query($query);
if($record = mysql_fetch_row($result)){
return $record;
}else {
print (mysql_error());

}
function sess_write($key, $val){
global $sdbh, $dbname, $tb_sessions, $expire;
$value = addslashes($val);
$query = "
replace into
$tb_sessions
values (
'$key',
'$value',
UNIX_TIMESTAMP() + $expire
)
";
$result = mysql_query($query);
echo mysql_error();
return $result;
}
function sess_destroy($key){
global $sdbh, $dbname, $tb_sessions;
$query = "
delete from
$tb_sessions
where
id = '$key'
";
$result = mysql_query($query);
return $result;
}
function sess_gc($maxlifetime){
global $sdbh, $dbname, $tb_sessions;
$query = "
delete from
$tb_sessions
where
expire < UNIX_TIMESTAMP()
";
$result = mysql_query($query);
return mysql_affected_rows($sdbh);
}
session_set_save_handler("sess_open","sess_close", "sess_read","sess_write","sess_destroy","sess_gc") ;
session_start();
$sn = session_name();
$sid = session_id();

?>
Feb 25 '07 #1
0 1022

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Steven | last post by:
I got a "Parse error: parse error in ..." in this line: if(empty($_POST){ ..... But if I fist assign $ssn=$_POST; and then if(empty($ssn){ ... it is working. Any advice? Thanks in advance.
1
by: H.L Bai | last post by:
hi, everybody i meet a parse error when i used the xml4c. any proposal is helpful. The error is following .../XMLRegionHandler.h:59 parse error before '*' .../XMLRegionHandler.h:60 parse...
2
by: Vittal | last post by:
Hello All, I am trying to compile my application on Red Hat Linux 8 against gcc 3.2.2. Very first file in application is failing to compile. I tried compiling my application on Linux 7.2...
21
by: BWIGLEY | last post by:
Basically I've just started making a game. So far it makes an array 25 by 20 and tries to make five rooms within it. In scr_make_room() there's parse errors: 20 C:\c\Rooms\Untitled1.c parse error...
6
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar...
5
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
1
by: Phaelle | last post by:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' What does that error mean? I can´t find the mistake!! In another script, I have got another kind of mistake : parse...
2
by: Lawrence Krubner | last post by:
Imagine a template system that works by getting a file, as a string, and then putting it through eval(), something like this: $formAsString = $controller->command("readFileAndReturnString",...
5
by: goldtech | last post by:
SAX XML Parse Python error message Hi, My first attempt at SAX, but have an error message I need help with. I cite the error message, code, and xml below. Be grateful if anyone can tell me...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.