I've streamlined all files by using an include for db access.
Everything works except the main registration file which is set to
https.
When I 'include' a file, the db access doesn't work: all other input that
accesses the db does, except for one that first calls a 'randomizer'
function, then an include to the db.
Any ideas why this doesn't work? I figure it must have something to do with
switching from https (the reg'n file)> http (the randomizer file & dbc file)
> https (back to the reg'n file).
Any suggestions on how to fix this? Any help, advice, or suggestions
gratefully accepted.
Code follows:
/* This is the 'randomizer' script called by require */
<?php
# return a randomly-generated string with input length
# Blake Caldwell <[EMAIL PROTECTED]>
function randomString($length=15){
static $srand;
if($srand != true){
$srand = true;
srand((double)microtime()*1000000); # only seed once!
}
$chars =
"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for($i=0; $i<$length; $i++){
$result .= substr($chars,rand(0,strlen($chars)-1),1);
}
return $result;
}
?>
/* This script works (with '$db = .....' ) */
<?php
. . .
require("randomizer.php");
$_SESSION['unique_id'] = randomString(15);
$db = pg_connect("dbname=purgatory user=postgres");
. . .
?>
/* This script DOESN'T work (with 'include("dbc.php"); and where dbc.php' =
<?php $db = pg_connect("dbname=purgatory user=postgres"); ?> in a separate
file */
<?php
. . .
require("randomizer.php");
$_SESSION['unique_id'] = randomString(15);
include("dbc.php");
. . .
?>
Tia,
Andre
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php