[PHP] Problem With Session Handling

2004-02-28 Thread Kyndig
Hi folks,

  I've been working on my website for a few years now. It uses SESSION 
management. I am using: php4.3 version. A problem I have had for awhile 
now is that all session information is lost if a page does not fully 
load. This wouldn't be an issue, except on every page load I create a 
MySQL link id for that page load, and store the object in a SESSION 
varriable:
 $db = new db(mydatabase);
 $_SESSION[db] = $db;

  Then throughout the website code, I'll simply call:   $q = 
$_SESSION[db];
This is causing my pages to fail ( I have the queries wrapped to send 
users to an error page if there is a DB issue ).

  The reason I attempt to store the database object in a SESSION is 
because there are quite a number of databases in a single page load that 
can be called. I don't want to spend time opening a new DB connection 
for every query to the database. A single page load could have up to 15 
queries to output the data and use up to 10 different databases (not 
tables) to produce the output.

Recomendations on how to fix my problem are much appreciated. If more 
data is needed to assist in debugging, just let me know.

Thank you,
Calvin Ellis
webmaster: http://www.mudmagic.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Problem With Session Handling

2004-02-28 Thread Kyndig


Rasmus Lerdorf wrote:
Uh, sorry, I meant ignore_user_abort = On
These negated ini options suck.
-Rasmus

That fixed it! =) I'll make sure to read the Connection Handling 
chapter. I havn't looked into the php.ini docs, in quite a few php 
versions. I'm sure my knowledge about them is now outdated.

Thank you. This was a problem I've had for a little over a year now.

Kyndig

On Sat, 28 Feb 2004, Rasmus Lerdorf wrote:


ignore_user_abort = Off

in your php.ini file

And read the Connection Handling chapter in the manual.

-Rasmus

On Sat, 28 Feb 2004, Kyndig wrote:


Hi folks,

  I've been working on my website for a few years now. It uses SESSION
management. I am using: php4.3 version. A problem I have had for awhile
now is that all session information is lost if a page does not fully
load. This wouldn't be an issue, except on every page load I create a
MySQL link id for that page load, and store the object in a SESSION
varriable:
 $db = new db(mydatabase);
 $_SESSION[db] = $db;
  Then throughout the website code, I'll simply call:   $q =
$_SESSION[db];
This is causing my pages to fail ( I have the queries wrapped to send
users to an error page if there is a DB issue ).
  The reason I attempt to store the database object in a SESSION is
because there are quite a number of databases in a single page load that
can be called. I don't want to spend time opening a new DB connection
for every query to the database. A single page load could have up to 15
queries to output the data and use up to 10 different databases (not
tables) to produce the output.
Recomendations on how to fix my problem are much appreciated. If more
data is needed to assist in debugging, just let me know.
Thank you,
Calvin Ellis
webmaster: http://www.mudmagic.com/
--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PhpLib Template Not Parsing

2001-02-25 Thread Kyndig

Afternoon All,

  Been running through archives and posts throughout the net.
Hopin ta find an answer. Looks like the questions been asked,
but no public answer has been made.

  I'm using PhpLib's Template code. ( just pulled the file and
modified it a minor bit ) The problem I'm having is when I create
a dynamic page with the Template class, any php within that
page is not being parsed by the webserver. If you visit:
http://www.kyndig.com/listings  and look at the page source,
you'll see the php code to call the banner code in. Any pointers
in how to go about fixing this is much appreciated.

-- 
Kind Regards,
---
Kyndig
Online Text Game Resource Site:  http://www.kyndig.com
ICQ#10451240


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] DIsplaying page before script finnished

2001-02-24 Thread Kyndig

On Sat, 24 Feb 2001, David Tandberg-Johansen wrote:
 Hello!
 
 I wonder if there are any way to display the page before the script is
 finished?
 
 I have a loop in my script,and I want to display the resoult for each loop.
Try the REFRESH meta tag


 
 Thanks
 
 David :-)
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
-- 
Kind Regards,
---
Kyndig
Online Text Game Resource Site:  http://www.kyndig.com
ICQ#10451240


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Fwd: Binding A Socket

2001-02-24 Thread Kyndig


I posted this message, but it never went through:


Not sunny on this end, abit drab today,


I'm workin up a socket bind for a MUD game. Heh, why not, nothin
ta do wright now. I've taken the main socket() call off of php.net
page as an example to bind a port. The script functions, but
when I telnet to the binded port...I get nothing. Any help?

?php

function init_socket( $port )
{
   /* Allow the script to hang around waiting for connections. */ 
   set_time_limit (0); 

   $address = '216.166.223.178';

  if (($sock = socket(AF_INET, SOCK_STREAM, 0))  0) 
  { 
  echo "socket() failed: reason: " . strerror ($sock) . "\n"; 
  } 

  if (($ret = bind ($sock, $address, $port))  0) 
  { 
   echo "bind() failed: reason: " . strerror ($ret) . "\n"; 
  } 

  if (($ret = listen ($sock, 5))  0) 
  { 
   echo "listen() failed: reason: " . strerror ($ret) . "\n"; 
  } 

  do 
  { 
 if (($msgsock = accept_connect($sock))  0) 
 { 
echo "accept_connect() failed: reason: " . strerror ($msgsock) 
. "\n"; 
break; 
 }
  
 do 
 { 
$buf = ''; 
$ret = read ($msgsock, $buf, 2048); 
if ($ret  0) { 
echo "read() failed: reason: " . strerror ($ret) . 
"\n";
break 2; 
} 
if ($ret == 0) { 
break 2; 
} 
$buf = trim ($buf); 
if ($buf == 'quit') { 
close ($msgsock); 
break 2; 
} 
$talkback = "PHP: You said '$buf'.\n"; 
write ($msgsock, $talkback, strlen ($talkback)); 
echo "$buf\n"; 
} while (true); 
close ($msgsock); 
} while (true); 
}

$port = "6969";
$control = init_socket( $port );
printf("Game is up and runnin on %d.", $port );
close ($control);
exit( 0 );

? 
-- 
Kind Regards,
---
Kyndig
Online Text Game Resource Site:  http://www.kyndig.com
ICQ#10451240
---

-- 
Kind Regards,
---
Kyndig
Online Text Game Resource Site:  http://www.kyndig.com
ICQ#10451240
---

-- 
Kind Regards,
---
Kyndig
Online Text Game Resource Site:  http://www.kyndig.com
ICQ#10451240


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Order by Date (Newbie)

2001-02-23 Thread Kyndig

On Fri, 23 Feb 2001, Brian S. Drexler wrote:
 Ok, I must be missing something, but does anyone have a script that will
 order by the closest date in the future that hasn't been here yet.  Did that
 make sense?
 
 Brian
 
$plusten = mktime(0,0,0,date("m"),date("d")+10,date("Y") );

Will take todays day, and add 10 days to it.
-- 
Kind Regards,
---
Kyndig
Online Text Game Resource Site:  http://www.kyndig.com
ICQ#10451240


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Help INSERTing to MySQL

2001-02-23 Thread Kyndig

On Fri, 23 Feb 2001, Clayton Dukes wrote:
 Well sheesh,
 If I knew I could get answers that easy here, I woudn't have worked on this
 for 20 hours :-)
 
 THANKS
 
 btw, field one is an ID field set to auto increment, how can I insert that
 if I don't know what it is?

You don't need to insert it. auto_increment will automatically
increment every time you insert a record. In fact, you _really_
don't want to ever set this field, as you would be modifying your
primary key ( unless your modifying them all )

 Note: You don't have to INSERT all fields mentioned below. If
you have a 'default' value set..then it will default to that value,
or in auto_increment case...it will automatically increment from
the last record it reads.

 
 Here are the fields:
 CREATE TABLE documents (
   id bigint(20) DEFAULT '0' NOT NULL auto_increment,
   docid varchar(20),
   category enum('Language Arts','Sciences','Humanities','Arts','Special
 Subjects','Other'),
   subcategory enum('Physics','Biology','Chemistry','Math','Computers and
 Internet','History','Economics','Geography','Law','Religion','Philosophy','B
 lack Awareness','Countries','Drugs','Education','Environmental
 Awareness','Politics','Health','Sex and Sexuality','Female
 Awareness','Art','Movies or TV','Music','Sports','Charles
 Dickens','Shakespeare','Biography','Fictional
 Stories','Astronomy','Mythology'),
   date varchar(10),
   subject varchar(200),
   title varchar(200),
   author varchar(200),
   email varchar(50),
   language enum('English','Danish','Dutch','Finnish','German','Spanish'),
   grade int(3),
   level enum('High School','College','Other'),
   city varchar(15),
   state varchar(15),
   county varchar(15),
   school varchar(45),
   zip smallint(5),
   authorcomments varchar(200),
   teachercomments varchar(200),
   approve enum('Y','N'),
   docdata text,
   PRIMARY KEY (id),
   UNIQUE id (id)
 
 
 - Original Message -
 From: "Philip Olson" [EMAIL PROTECTED]
 To: "Clayton Dukes" [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Friday, February 23, 2001 8:31 PM
 Subject: Re: [PHP] Help INSERTing to MySQL
 
 
 
   Hello, This is my first attempt, so I'm prolly doing something stupid,
   but can someone tell me why this doesn't work? All it returns is
   "Unable to INSERT to database"
 
  Change : or die("Unable to INSERT to database");
  To : or die(mysql_error());
 
  And see what it tells you.  Odds are there's a field not being accounted
  for.  When not designating columns (just values) it's important to make
  sure all columns are accounted for.  See :
 
  http://www.sqlcourse.com/
 
  It'll provide some basic SQL help.  It's recommended to write out columns
  and values (easier to make sense of).
 
 
  Regards,
 
  Philip Olson
  http://www.cornado.com/
 
  
  
   ---BEGIN---
   ?
  $time = time();
  $rand = Random_Password(5);
  $docid = $time . $rand;
  
   if (isset($email)  isset($docid)) {
   mysql_connect("$HOSTNAME", "$DB_USER", "$DB_PASS");
  
  $query = "INSERT INTO documents VALUES ('$docid', '$category',
   '$subcategory', '$date', '$subject', '$title', '$author', '$email',
   '$language', '$gr ade', '$level', '$city', '$state', '$county',
   '$zip', '$authors_comments', '$teachers_comments', 'N', '$docdata')";
  
  $result = mysql_db_query("$DATABASE", $query) or die("Unable to
   INSERT to database");
  
   if ($result) {
   echo "p$docid was added to the database/p";
   }
   }
   ?
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
-- 
Kind Regards,
---
Kyndig
Online Text Game Resource Site:  http://www.kyndig.com
ICQ#10451240


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] special characters with perl,mysql,php

2001-02-23 Thread Kyndig


If your refering to:  '  or "  just use:

addslashes($value);   to escape special characters.


On Fri, 23 Feb 2001, Mitchell Hagerty wrote:
 Hey All,
 
 What would be a good method for inserting data into a blob field
 that contained special characters using perl then retrieving that
 data with php?
 
 URI::Escape has worked well with perl but now that php has
 gotten into the picture I need a new method.
 
 any suggestions?
 
 tks
 mitch
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
-- 
Kind Regards,
---
Kyndig
Online Text Game Resource Site:  http://www.kyndig.com
ICQ#10451240


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]