[PHP] Sessions not working on Linux - Apache

2004-05-12 Thread Zac Hillier - Net Affectors
Running on apache 1.3

session.save_handler = files
session.save_path = /tmp
session.use_cookies = 1
session.name = i
session.auto_start = 0
session.cookie_lifetime = 0
session_start() is included in the top of each page.

When I test session files are being written into the /tmp folder and the 
session variable is corerctly added to the url when moving to another 
page, BUT the sessions do not appear to be working?

I can set a session var on one page and display it there but when moving 
to another page the session var is no longer available?

If I look in the tmp folder a relevant sess_nnn file is there but 
contains no data. I've checked permissions and the /tmp folder is world 
writable and the sess_nnn file is owned by the web server and is writable?

Can anyone suggest what to test next or where the problem may be?

Thanks

Zac

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Looping or what?

2003-07-09 Thread Zac Hillier - Net Affectors
The code below is suppose to replace some images and links but when I run it
the page just seems to hang and eventually times out.

Am I Looping somewhere and not realising it?

Thanks

Zac

$i = $c01_1;
$imgLst = '';

function imgRplc($val){
 global $imgLst;
 global $i;
 $imgLst .= div class=\figTtl\Fig. $i/divimg src=\$val[1]\ /,;

 return 'div class=fig(Fig.'.$i.')/div';
}

// first remove pics and add a reference to the end of the doc for those
that are required
while(preg_match(/img type=\reg\ src/,$disp)){

 $disp = preg_replace_callback(/img type=\reg\ src=\(.+)\ alt=(.+)
\//i, 'imgRplc', $disp,1);
 $i++;

}

// now remove all other pics
$disp = preg_replace(/img (.+) \//i, '', $disp);

// remove bigPic links  target=bigPic
$disp = preg_replace(/a (.+) target=\bigPic\(.+)\/a/i, '\\2',
$disp);

// next find shopping links and mark up
$disp = preg_replace(/a href=\(.+)\(.*)(.+)\/a/i, 'div
class=shpLnkLink to: \\3 (Enter into your browser:
http://www.lasersailing.com\\1)/div', $disp);

// remove paragraphs
$disp = preg_replace(/\/p(\s*)p/i, 'br /br /', $disp);
$disp = preg_replace(/p/i, '', $disp);
$disp = preg_replace(/\/p/i, '', $disp);

echo $disp;



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] URL Encode to send as form POSTed Items

2002-11-25 Thread Zac Hillier
Hi All,

I would like to know if it's possible to use php to encode form variables as
if they had come from a post form instead of a get form. I imagine I need to
place them into a header but cannot find much to read that gives any
information on this.

I need to create form variables and than use header location to direct the
user to another page that will process the form.

I'm posting to another site which is why i have to use form variables. I
would like to avoid using JavaScript as this takes longer, will not work on
all machines.

Thanks

Zac


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Free WEB Hosting with PHP and MySQL support

2002-07-24 Thread Zac Hillier

easyDNS.com provide a dynamic dns solution to your problem

Zac

- Original Message - 
From: crimix [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 24, 2002 10:03 PM
Subject: [PHP] Free WEB Hosting with PHP and MySQL support


 Unfortunatelly I changed my ADLS setting from IP static to IP dynamic 
 and now nobody, me too, can access to my data.
 My question is if exist a Free WEB Server where I can place my data 
 using PHP and MySQL support?
 Thank you and have a nice day
 
 Tiziano Crimella - Switzerland
 
 
 -- 
 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] fsock and fget driving me mad!

2002-07-11 Thread Zac Hillier

Hi

Can anyone in the group help, I'm trying to read and write from a serial
port using php.

So far using fsockopen I've managed to open and send data through a serial
port but I'm having real problems reading a response. I've tried fgets
really to no success can anyone spare me some ideas or thoughts?

Setup:

Linux box running serproxy ( A tcp to serial port proxy ) IP 192.168.123.192

I connect to this from a webserver running on another machine with:
?php
$fp = fsockopen (192.168.123.192, 5331, $errno, $errstr, 30);
if (!$fp) {
   echo $errstr ($errno)br\n;
} else {
 if(fputs ($fp, test data.chr(37))){
  echo 'data sent';
 } else {
  echo 'no data sent';
 }
   while (!feof($fp)) {
   echo fgets ($fp,128);
   }
   fclose ($fp);
}
?

The output is being read by a small ap that displays the serial port data
and allows me to send a response, I've logged the response I send at the
linux box on the serial port and serproxy is supposed to translate this back
to tcp port 5331 however I cannot read it with fgets?

Please help it's driving me mad and I'm sure I'm just being stupid  : {

Thanks for any help.

Zac


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Development Tools

2002-07-10 Thread Zac Hillier

Can't agree more, it's fine having Ultradev and the rest to get you started
but the best end results come from understanding and writing code that is
not bloated.

For a great text editor that has all the features identified in PHPEdit but
none of the bugs try JEdit www.jedit.org

Zac

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: 'Uwe Birkenhain' [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Wednesday, July 10, 2002 5:21 PM
Subject: RE: [PHP] Development Tools


 [snip]
 What makes development tools better than a good editor? (serious question)
 [/snip]

 Over the course of time (I have been writing code for 25 years, many
 languages, some compiled, some not) I have found that the most useful tool
 in the arsenal is a good editor with no more features than line numbering.
 When I find myself in times of code trouble (props to John Lennon) I will
 almost always turn to an editor first. I have used many, and for my money
 where web application development is concerned, Programmers File Editor
(no
 longer supported) http://www.lancs.ac.uk/people/cpaap/pfe/ for Windows,
and
 vi or pico on *nix are the editors of choice. I do use PHPedit from time
to
 time because, while it is buggy, it does do syntax highlighting and
matches
 brackets and other curly thingies well, which is especially helpful when
 viewing large scripts with lots of code.

 I have and continue to use some IDE's for certain projects (Visual C++,
 UltraDev for ASP code) but often find myself using an editor on the code
 created by these.

 So to answer the question above ... nothing beats a good editor.

 Jay



 --
 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




Re: [PHP] I am out of pleases now get me off this fuckin list!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

2002-07-09 Thread Zac Hillier

Maybe everybody should send him a copy then he'll get the message?
Maybe


To remove your address from the list, just send a message to
the address in the ``List-Unsubscribe'' header of any list
message. If you haven't changed addresses since subscribing,
you can also send a message to:
   [EMAIL PROTECTED]

or for the digest to:
   [EMAIL PROTECTED]

For addition or removal of addresses, I'll send a confirmation
message to that address. When you receive it, simply reply to it
to complete the transaction.



- Original Message -
From: Erik Hegreberg [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 09, 2002 2:15 PM
Subject: [PHP] I am out of pleases now get me off this fuckin
list

!





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Sockets 'requested address is not valid in its context'

2002-07-06 Thread Zac Hillier

Hi All,

I'm opening a port on a remote machine presently I'm using fsockopen() which
is fine for opening the port and sending data however I'm having trouble
reading data back from the port.

So I've considered using socket functions but do not appear to be able to
get a connection. When I run the code below pointing to 127.0.0.1 everything
runs fine however when I point to 192.168.123.193 (Another machine on the
local network without a server running) I get these errors.

Warning: socket_bind() unable to bind address [10049]: The requested address
is not valid in its context. in D:\php-dev\new.php on line 20
socket_bind() failed: reason: The requested address is not valid in its
context.

Warning: socket_listen() unable to listen on socket [10022]: An invalid
argument was supplied. in D:\php-dev\new.php on line 26
socket_listen() failed: reason: An invalid argument was supplied.


What does 'requested address is not valid in its context' mean?

Thanks

Zac


Code:

?php
error_reporting (E_ALL);

/* Allow the script to hang around waiting for connections. */
set_time_limit (0);

/* Turn on implicit output flushing so we see what we're getting
 * as it comes in. */
ob_implicit_flush ();

$address = 192.168.123.193;
$port = 5331;

if (($sock = socket_create(AF_INET, SOCK_STREAM, getprotobyname(TCP))) 
0) {
echo socket_create() failed: reason:  . socket_strerror ($sock) .
br;
} else {
 echo 'socketbr';
}

if (($ret = socket_bind($sock, $address, $port)) == false) {
echo socket_bind() failed: reason:  .
socket_strerror(socket_last_error($sock)) . br;
} else {
 echo 'bindbr';
}

if (($ret = socket_listen ($sock, 5)) == false) {
echo socket_listen() failed: reason:  .
socket_strerror(socket_last_error($sock)) . br;
} else {
 echo 'listenbr';
}


socket_close ($sock);
?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] row pointer

2002-06-14 Thread Zac Hillier

Hi

I'm looking for a php function that will return the position of the pointer
in a mysql recordset.

I found mysql_data_seek, but this appears to only move the pointer, I need
to get the equivalent row number for the pointer position before moving it,
then return to the same position.

Can anyone help?

Thanks

Zac


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] row pointer

2002-06-14 Thread Zac Hillier

John, Dan  All,

Thanks for your response, perhaps if I tell you more of the story then it'll
make more sense. I'm afraid I seem to have an ability for asking cryptic
questions.

Below is the code I'm using, it is meant to check for a list of between 10
and 50 words in a table then return the key of the words found, for the
words not in the table they should be added to the table.

It seems to work fine, but in a effort to make the code more efficient I
realised that at present I'm walking through a lot of the recordset for each
keyword. But that the majority of the recordset would be in the same order
as the keywords. So if I can add a little extra code that says if the next
record in the recordset is not the word I'm trying to find then walk through
the recordset, if you reach the end then start at the beginning and go
down-to the initial row. This should confirm that the word is not in the
recordset and so needs to be added, but leave the recordset in the correct
place to check the next word.

However to do this I thought initialy I would need to identify the row the
recordset was presently at. However now I understand I need to push the
recordset into an array then use this array to loop through finding the
key's and the words that need to be added. However saying it and coding it
seem to be two completely different things, can anyone help me getting
started? Hope this makes some sense? If you have any other comments on the
code to improve it or good coding practice I would appreciate your comments
as I'm still new to this.

Thanks

Zac

Code:

#--create select statement for getting keywords from table
$fndWrds = '';
foreach($kywrd as $val) {
 $fndWrds .= wrd = '$val' OR ;
}

#-- add test word to get a result regardless
$fndWrds .= wrd = 'test';

#-- get present keywords from db
$dbKy = mysql_query(SELECT ky, wrd FROM .$site_no.kywrdInd WHERE
$fndWrds;);

#--create kywrd index array for index to be used in update value list
$indx = array();

#--create update value lists to later add record into lookup table
$vlst = '';

foreach($kywrd as $key = $val) {
 $fnd = 0;
 While ($kyRw = mysql_fetch_array($dbKy)) {
  if($kyRw['wrd'] == $val) {
   $fnd = 1;
   $indx[$key] = $kyRw['ky'];
   break 1;
  }
 }
 #-- reset pointer of db array back to begining
 mysql_data_seek($dbKy, 0);

 #-- if not in db then add word to db then set index
 if($fnd == 0) {
  if(! mysql_query(INSERT INTO .$site_no.kywrdInd (wrd) values
('.$val.');)) echo 'Word not added';
  $indx[$key] = mysql_insert_id();
 }

 #-- check to see that each word has an index value
 if($indx[$key]) {
  #--create value list for update into lookup table
  $vlst .= ($compID, . $indx[$key] . , . $scr[$key] . ), ;
 } else {
  echo 'no index set for keyword, word = '.$val.' index = '.$key.'br';
 }


- Original Message -
From: John Holmes [EMAIL PROTECTED]
To: 'Zac Hillier' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, June 14, 2002 6:42 PM
Subject: RE: [PHP] row pointer


 Keep track of it yourself as you loop through the data. Maybe if you
 explained what you need overall then we could suggest a method...

 ---John Holmes...

  -Original Message-
  From: Zac Hillier [mailto:[EMAIL PROTECTED]]
  Sent: Friday, June 14, 2002 3:59 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] row pointer
 
  Hi
 
  I'm looking for a php function that will return the position of the
  pointer
  in a mysql recordset.
 
  I found mysql_data_seek, but this appears to only move the pointer, I
 need
  to get the equivalent row number for the pointer position before
 moving
  it,
  then return to the same position.
 
  Can anyone help?
 
  Thanks
 
  Zac
 
 
  --
  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] catching plurals

2002-06-11 Thread Zac Hillier

Hi

I'm trying to write a function to catch and remove plurals from a search
feature, can anyone suggest how I can efficiently remove 'ies' and 's' from
the right hand end of each word within an array?

Thanks,

Zac


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] is preg_replace the fastest way?

2002-06-11 Thread Zac Hillier

Hi All,

I'm writing a search facility and am stripping noise words from a string
(The string contains between 50 - 200 words). Presently I'm importing a text
file of noise words (The noise words file contains almost 1000 words) then
using :

   #-- remove noisewords
   $cntLmt = count($noise_words);
   for ($i=0; $i$cntLmt; $i++) {
$filterword = trim(strtolower($noise_words[$i]));
$filtered = preg_replace(/(\b$filterword \b)/x, ,$filtered);
   }

to remove these noise words.

However I'm wondering if it would be quicker to separate the $filtered
string and then look for the words in a noise words string. If so how would
I do this and remove the words?

Thanks

Zac


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] preg

2002-06-11 Thread Zac Hillier

Does anyone know how I can use preg or any other function to identify a
double letter on the end of a string and then replace it.

So 'foo' would become 'f2' and 'bar' would not change.

Thanks

Zac


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] global variables without sessions on apache

2002-06-06 Thread Zac Hillier

Thanks Jason,

Works great in htaccess

Zac
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 06, 2002 4:08 AM
Subject: Re: [PHP] global variables without sessions on apache


 On Thursday 06 June 2002 06:05, Zac Hillier wrote:
  Miguel,
 
  I mean that the variables will never change per Virtual host but that
the
  site is a template for many sites and these vars are part of the
  distinction for each site / Virtual Host.
 
  So far the suggestions of using the  auto-prepend  in the php.ini have
not
  seemed to cater for this. Can you help further?

 The auto-prepend thing can be set per-site if you put it in the
apache.conf
 file, and possibly per-directory as well (haven't tried it) if put in
 .htaccess files.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 You will have a head crash on your private pack.
 */


 --
 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] global variables without sessions on apache

2002-06-05 Thread Zac Hillier

Hi,

Is it possible using php on our own apache server to create global variables
for virtual host without having to use session variables.

We would like to have three variables that are constant for each virtual
host and that are available from every page, I thought it would be possible
with htaccess or http.conf but am struggling to find documentation for it.

Thanks

Zac


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] global variables without sessions on apache

2002-06-05 Thread Zac Hillier

Jason,

Could you expand on this a little more? I've tried searching for
auto-prepend in both php documentation and apache and cannot find anything
thats relates to our needs.

Thanks for your help

Zac
- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, June 05, 2002 2:46 PM
Subject: Re: [PHP] global variables without sessions on apache


 On Wednesday 05 June 2002 20:40, Zac Hillier wrote:
  Hi,
 
  Is it possible using php on our own apache server to create global
  variables for virtual host without having to use session variables.
 
  We would like to have three variables that are constant for each virtual
  host and that are available from every page, I thought it would be
possible
  with htaccess or http.conf but am struggling to find documentation for
it.

 Use an auto-prepend file.

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 QOTD:
 The baby was so ugly they had to hang a pork chop around its
 neck to get the dog to play with it.
 */


 --
 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




Re: [PHP] global variables without sessions on apache

2002-06-05 Thread Zac Hillier

Miguel,

I mean that the variables will never change per Virtual host but that the
site is a template for many sites and these vars are part of the distinction
for each site / Virtual Host.

So far the suggestions of using the  auto-prepend  in the php.ini have not
seemed to cater for this. Can you help further?

-- ORIGINAL MESSAGE --

Is it possible using php on our own apache server to create global variables
for virtual host without having to use session variables.

We would like to have three variables that are constant for each virtual
host and that are available from every page, I thought it would be possible
with htaccess or http.conf but am struggling to find documentation for it.

Thanks,

Zac

- Original Message -
From: Miguel Cruz [EMAIL PROTECTED]
To: Zac Hillier [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, June 05, 2002 7:12 PM
Subject: Re: [PHP] global variables without sessions on apache


 On Wed, 5 Jun 2002, Zac Hillier wrote:
  Is it possible using php on our own apache server to create global
  variables for virtual host without having to use session variables.
 
  We would like to have three variables that are constant for each virtual
  host and that are available from every page, I thought it would be
possible
  with htaccess or http.conf but am struggling to find documentation for
it.

 When you say that are constant do you mean that they never change or
 just that they are the same for each page at any given time?

 If you need dynamic variables shared between all your pages, you're going
 to have to either use a database or shared memory as documented at:

http://www.php.net/manual/en/ref.sem.php

 miguel





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] fread and session vars

2002-05-27 Thread Zac Hillier

Hi all,

I'm using the fread function to read one of my php scripts and then produce a static 
page, within this script I'm using session variables.

If I browse to the script normally then all appears to work correctly, however when I 
use the fread function the session variables are not being translated. I've tried 
adding  SID to the end of the URL but to no avail. Can anyone suggest a course of 
action. I'm reluctant to produce GET variables as there are many variables and this 
script will need to be used by multiple domains.

Thanks,

Zac


Re: [PHP] fread and session vars

2002-05-27 Thread Zac Hillier

Code:

generate page script:

$pge = create-page.php
$pd = $HTTP_GET_VARS['pd'];

# Set the files
$crtPge = /. $pge .?pd=. $pd; # the url of the dynamic page to write the
output page
$targetfilename = $SITE_ DOCUMENT_ROOT . $outPge; # the output page

# delete previous version of temp file if it exists
@unlink('temp.html');

# open the dynamic page into dynpage
$dynpage = fopen($crtPge, 'r');

# Check for errors
if (!$dynpage) {
 echo(pUnable to load  . $crtPge . . Static page update aborted!/p);
 exit();
}

# function read the data
$htmldata = fread($dynpage, 1024*1024);

# close the dynamic page
fclose($dynpage);

# connect to temp file ready to write
$tempfile = fopen('temp.html', 'w');

# Check for errors
if (!$tempfile) {
 echo(pUnable to open temporary file  . ('temp.html') .  for writing.
Static page update aborted!/p);
 exit();
}

#write to temp file
fwrite($tempfile, $htmldata);

# close the temp file
fclose($tempfile);

etc...

===
create-page.php:

?
session_start();

$SITE_ DOCUMENT_ROOT = '/usr/local/htdocs/' . $HTTP_SESSION_VARS['site_Loc']
. '/';

The line above fails when being read by fread in the generate script code
above, but works when I browse to it.

Hope this makes more sense.

Zac


- Original Message -
From: John Holmes [EMAIL PROTECTED]
To: 'Zac Hillier' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, May 27, 2002 3:28 PM
Subject: RE: [PHP] fread and session vars


 Post some code. I don't understand completely what you're trying to do
 or how you're trying to do it.

 ---John Holmes...

  -Original Message-
  From: Zac Hillier [mailto:[EMAIL PROTECTED]]
  Sent: Monday, May 27, 2002 9:20 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] fread and session vars
 
  Hi all,
 
  I'm using the fread function to read one of my php scripts and then
  produce a static page, within this script I'm using session variables.
 
  If I browse to the script normally then all appears to work correctly,
  however when I use the fread function the session variables are not
 being
  translated. I've tried adding  SID to the end of the URL but to no
 avail.
  Can anyone suggest a course of action. I'm reluctant to produce GET
  variables as there are many variables and this script will need to be
 used
  by multiple domains.
 
  Thanks,
 
  Zac


 --
 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




Re: [PHP] fread and session vars

2002-05-27 Thread Zac Hillier

John,

Thanks, the code does actually read this but I'm afraid I removed it so the
servers ip is not exposed to the mail list.

The script runs correctly and opens and creates the page, however it cannot
find the include files I have in the page as the variable
$SITE_DOCUMENT_ROOT requires a session variable.

Zac
- Original Message -
From: John Holmes [EMAIL PROTECTED]
To: 'Zac Hillier' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, May 27, 2002 7:12 PM
Subject: RE: [PHP] fread and session vars


 Hi.

  Code:
 
  generate page script:
 
  $pge = create-page.php
  $pd = $HTTP_GET_VARS['pd'];
 
  # Set the files
  $crtPge = /. $pge .?pd=. $pd; # the url of the dynamic page to
 write
  the
  output page
  $targetfilename = $SITE_ DOCUMENT_ROOT . $outPge; # the output page
 
  # delete previous version of temp file if it exists
  @unlink('temp.html');
 
  # open the dynamic page into dynpage
  $dynpage = fopen($crtPge, 'r');

 Here it looks like $crtPge is going to be equal to something like
 /create-page.php?pd=xx. If you want to open it via a URL, you need to
 add the HTTP:// and server name to it.

 $crtPge = http:// . $HTTP_SERVER_VARS['SERVER_NAME'] . / . $pge .
 ?pd= . $pd;

 Something like that...then fopen() will work.

 ---John Holmes...


 --
 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] unexpected T_IF

2002-05-25 Thread Zac Hillier

Hmm, can anyone explain why I'm getting this error?

Parse error: parse error, unexpected T_IF in /usr/local/htdocs/san.loc/upload-img.php 
on line 34

Code reads:

11:#--if form submitted then process file upload
12:if($HTTP_POST_VARS['ttl']) {
13:
14: #--check if there is already a picture called this
15: include $DOCUMENT_ROOT . 'incs/db.php';
16: mysql_select_db(infoNav) or die(unable to connect to table);
17: $qry = SELECT ttl FROM imgLst WHERE site = $HTTP_SESSION_VARS[site_no] AND ttl = 
'$HTTP_POST_VARS[ttl]';;
18: $imgTst = MYSQL_QUERY($qry);
19: 
20: if(mysql_numrows($imgTst)  1) {
21:
22:  #-- check file type 
23:  $ulf = $HTTP_POST_FILES['uplfile']['type'];
24:  if($ulf == 'image/pjpeg' || $ulf == 'image/gif') {
25: 
26:   #-- get ext
27:   ($ulf == 'image/pjpeg') ? $ext = '.jpg' : $ext = '.gif';
28: 
29:   #-- create unique filename
30:   $flNme = '\/imgs\/user-imgs\/' . time() . $REMOTE_HOST . $ext;
31:   $FulflNme = $DOCUMENT_ROOT . $flNme
32:  
33:   #-- check file is realy uploaded for security then copy to store folder
34:   if (is_uploaded_file($HTTP_POST_FILES['uplfile'])) {

Thanks

Zac


[PHP] ereg_replace problems

2002-05-22 Thread Zac Hillier

I'm trying to replace values within a string with a value looked up from a database. I 
have a function that looks up the value in the database for me but I'm having trouble 
passing the value to the function because of  the backslashes, is there a way around 
this?

Code:

$cntnt = eregi_replace(\[L=([a-zA-Z]+)].([a-zA-Z]+)\[EL], a href=\ . 
fndLnk(\\1) . \\\2/a, $cntnt);

fndLnk is the function and the error I receive is -

Warning: Unexpected character in input: '\' (ASCII=92) state=1 

Thanks for any help

Zac