RE: [PHP] session_destroy problem
Hi there, So it is the browsers problem. I tested what you said and Mozilla acts as you stated and IE does as well. I guess my question is. Is there no way to close clear out the session when the user logs out? The way I set things up the class that I wrote just gets the current sessionid and does a select from the database to see if it has been logged. The problem this creates is that someone could sit down and reopen a browser and have access to the site as if they where logged because the session is not gone. Hmm - Like a said I have never used sessions before so I am learning about them. Thank you for your input... Ken > What browser are you running? I find that IE drops the session when > you close the browser window actively working the site. On Mozilla I > have to close every instance of Mozilla regardless of the site before > it drops the session. Pretty aggravating so I'm going to have to start > working on a method based on responses to your post. > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > > -Original Message- > From: Ken Nagorski [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 09, 2003 1:35 AM > To: [EMAIL PROTECTED] > Subject: [PHP] session_destroy problem > > Hi there, > > I have written a class that manages sessions. I have never used > sessions before so all this is new to me. Everything works fine as far > as starting the session and logging in however when I call sessoin > destroy it doesn't seem to work the function returns 1 as it should if > all goes well however if I go to another page and do some other > browsing even if I close the browser the session still hangs around. Is > there something I don't know about sessions? I have read the > documentation on the session_destroy function, I don't think that I am > missing anything... > > Anyone have any suggestions? I am totally confused. > > Thanks > Ken > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session_destroy problem
Hi there, I have written a class that manages sessions. I have never used sessions before so all this is new to me. Everything works fine as far as starting the session and logging in however when I call sessoin destroy it doesn't seem to work the function returns 1 as it should if all goes well however if I go to another page and do some other browsing even if I close the browser the session still hangs around. Is there something I don't know about sessions? I have read the documentation on the session_destroy function, I don't think that I am missing anything... Anyone have any suggestions? I am totally confused. Thanks Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] returning data from a function in a class
Hi there, I am totally new at classes and oop... I have never done any object oriented stuff before so I don't know if my question is a php one, a browser issue or an oop one but here goes. I am writing a class that deals with members for a site (I know there are examples on the web, I have used pieces parts from them...) and things seem to be going ok (actually better than OK, I have totally amazed myself so far). but I have one issue. I have a function in the class that returns the session ID if there is a valid session. otherwise it returns 0. This function works fine in IE6 however fails in mozilla or lynx. I have NO idea why and can't seem to figure out where to even start. I would really appreciate any advice. I have included the code snippits below. -- from class.session_logger.php -- function is_logged_in() { session_start(); $this->current_session_id=session_id(); $db_vars = new db_vars; @$sql_connection = mysql_connect($db_vars->db_server, $db_vars->db_user, $db_vars->db_pass); if($sql_connection) { $db_connection = mysql_select_db($db_vars- >db_dbname, $sql_connection); $sql_query = "select sessionid from session where sessionid='$this->current_session_id'"; $query_result = mysql_query($sql_query); if($row=mysql_fetch_array($query_result, MYSQL_ASSOC)) { return $row[sessionid]; } else { return 0; } } } --- --- how I have calling this - $session_logger = new session_logger; $session_id=$session_logger->is_logged_in(); //echos the session id in IE6, echos 0 in Mozilla ??? echo(" la la la $session_id>"); - Thanks kenn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using cookies
Hi there, I have never used cookies before, however I am trying to implement them to make things a little more secure. Rather than passing a sql statement via a hidden input tag I am setting a cookie. This works fine except that when I look at the sql after it is pulled from the cookie everything is escaped, for instance. SELECT * FROM inventory WHERE name='Watches' would become SELECT manufacturer FROM inventory WHERE name=\'Watches\' This is a problem cause trying to use preg_replace doesn't seem to work. I get an error saying that the delimeter must not be a \. What a bummer. I am a little stuck. I will take any suggestions. Maybe I am just going about things the wrong way. *** Shrug *** Thanks Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strange file handle problem
Hi there, Ok - This is the error I get, Warning: 2 is not a valid File-Handle resource in /usr/local/apache/htdocs/mm_edit.php on line 359 But this is the code... I marked line 359 where it attempts to call fputs for the first time. I can't seem to understand how this is failing. I really think it is not the code. I am really stumped. function write() { global $db; global $domain; //Notice that I exit if it can't open the file... That is not the //the problem if(!$domainfile=fopen("/tmp/$domain", "w")) { die("Failed to open domain file"); } echo("DEBUG /tmp/$domain -- $domainfile"); $result = $db->Execute("SELECT * FROM addresses WHERE domain='$domain'"); if ($result === false) { die("SQL Failed"); } while(!$result->EOF) { list($dom,$ext)=split("\.",$domain); $virt_address=$result->fields[1]; $dest=$result->fields[2]; $default=$result->fields[3]; echo("DEBUG $virt_address $dest $default"); list($virt_user,$virt_domain)=split("\@", $virt_address); list($remote_user,$remote_domain)=split("\@", $dest); //If the destination is a remote address and this is a NOT a default if($remote_domain && !($default)) { //this is line 359 - the first call to fputs fputs($domainfile, "$virt_address"); echo("$virt_address"); fputs($domainfile, ": $virt_user$dom$ext\n"); echo(": $virt_user$dom$ext"); if(!$courierfile=fopen("/tmp/.courier-$virt_user$dom$ext", "w")) { echo "Could not open file"; } fputs($courierfile, "$dest\n"); fclose($courierfile); //If the destination is a local address and this is NOT a default } elseif(!($remote_domain) && !($default)) { fputs($domainfile, "$virt_address"); fputs($domainfile, ": $remote_user\n"); } //If it's a default we don't care where it is going, just write a .courier-domext-default with the address //And stick line in the the domain file that looks like this "@dom.com: domcom-default" elseif($default) { fputs($domainfile, "$virt_address"); fputs($domainfile, ": $dom$ext-default\n"); if(!$courierfile=fopen("/tmp/.courier-$dom$ext-default", "w")) { echo "Could not open file"; } fputs($courierfile, "$dest\n"); fclose($courierfile); } $result->MoveNext(); system("mv /tmp/.changes /tmp/$domain"); #system("/usr/local/sbin/changewriter $domain &> /tmp/cw_error"); fclose($domainfile); } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] running commands as root from a script
Hi there, I have a little problem. I need to run a few commands for Courier from a script. What I have is a php based application that makes it easy to create and manage virtual domains and the addresses for them from the web. However when You "Apply the changes" everything is written to /tmp dir and the a little perl script parses the file and moves things where they need to go and then runs couriers makealiases command. Now you can't run a perl script SUID so I wrote a C program that just calls system() and runs the script and it is SUID. This doens't work however. No matter what I do. It is like Courier ignores this. I can't imagine there isn't anyone who has not run into the problem of automating things via PHP and not had to run a system command as root at some point in time. I am wondering what the different approaches to this problem are. Thanks Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php