RE: [PHP] Like ternary but without the else.

2005-02-25 Thread rich
I couldn't find this anywhere on google or PHP's site but I'm pretty sure
there's an answer to it.

How can I turn the following into something that resembles the ternary
operator?

?php

  if($something)
  {
$this = $that;
  }

?


is this what you're after?

$this = ($something ? $that : $this) 

rich

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



[PHP] http$B$G%;%C%7%g%s$r3+;O(B$B$7$?>l9g!"(Bhttps$B$X(B$B9T$C$F$b7QB3$5$l$k$N$G(B$B$7$g$&$+!)(B

2002-11-09 Thread Rich
PHP$B=i?4

[PHP] Using two XSLT stylesheets

2003-10-18 Thread rich
I'm working on a read only database.

I have the data encoded as XML and am writing the queries
using XSLT stylesheets.  The only way I can find (being, of
course, restricted to XSLT 1.0 on PHP) of executing the
required queries requires two stylesheets.

The generates a result tree which needs to be proceesed by
the second.  But I can't find a way of doing this. I've tried:

xslt_process($xh, 'library.xml', 'simple-search-get-results.xsl',
 -- 'results.xml', NULL, $params);

$data = xslt_process($xh, 'results.xml',
 -- 'simple-search-display-results.xsl', NULL, NULL, NULL);

and:

$results = xslt_process($xh, 'library.xml', 'simple-search-get-results.xsl',
 -- NULL, NULL, $params);

$data = xslt_process($xh, $results, 'simple-search-display-results.xsl',
 -- NULL, NULL, NULL);

neither of which work at all.

Any ideas?

Cheers,
rich.

-- 
UEA/MUS::Record Library
http://www.cursus.uea.ac.uk/cdlib/

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



Re: [PHP] Using two XSLT stylesheets

2003-10-18 Thread rich
Ray Hunter wrote:

 
 xslt_process($xh, 'library.xml', 'simple-search-get-results.xsl',
  -- 'results.xml', NULL, $params);
 $data = xslt_process($xh, 'results.xml',
  -- 'simple-search-display-results.xsl', NULL, NULL, NULL);
 
 
 What happens when you do the above...what is the var_dump of data?
 
 --
 BigDog

I get this:
Warning: Sablotron error on line 1001: cannot open file
'/var/www/html/cdlib/search/results.xml' in
/var/www/html/cdlib/search/simple-search.php on line 24
 string(591)   

line 24 is the first call to xslt_process() above.

But I'd never tried using var_dump($data) before. It appears the the
second call is working fine: the file 'results.xml' exists already
becasue I've been using a command line XSL processor to test the
stylesheets. The second call to xslt_process() appears to have read
and processed the data which was in that file correctly because
var_dump() has inserted the result into the HTML following the error
message.
-- 
Richard
UEA/MUS::Record Library

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



[PHP] Re: Using two XSLT stylesheets

2003-10-19 Thread rich
OK,

This is my latest idea to try and do this:

$xh = xslt_create();

parse_str($_SERVER['QUERY_STRING']);
$params = array(keywords = $keywords);

$results = xslt_process($xh, 'library.xml', 'simple-search.xsl', NULL, NULL,
  --$params);
$f = fopen('results.xml','w');
fwrite($f, $results);
fclose($f);
$data = xslt_process($xh, 'results.xml', 'display-results.xsl', NULL, NULL,
  --NULL);
echo $data;

xslt_free($xh);

But, of course, it just throws up messages saying I can't write to 
results.xml!

See http://www.cursus.uea.ac.uk/cdlib/ for error messages in action (search 
terms which will find records include 'Boulez', 'Messiaen').

Does anyone know why:

xslt_process($xh, 'sample.xml', 'sample.xsl', 'result.xml')

doesn't work? (lifted straight from the manual)

Cheers,
Rich

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



[PHP] Re: Using two XSLT stylesheets

2003-10-21 Thread rich
Aha!

I've worked out a (better?) way of doing:
?
parse_str($_SERVER['QUERY_STRING']);
$params = array(keywords = $keywords);

$library_xml_file = library.xml;
$search_xsl_file = simple-search.xsl;
$display_xsl_file = display-results.xsl;

$library_xml_string = join('', file($library_xml_file));
$search_xsl_string = join('', file($search_xsl_file));
$display_xsl_string = join('', file($display_xsl_file));

$arg_buffer = array(/xml = $library_xml_string, /xslt =
$search_xsl_string);

$xh = xslt_create();

$results_xml_string = xslt_process($xh, arg:/xml, arg:/xslt, NULL,
$arg_buffer, $params);
xslt_free($xh);

$arg_buffer = array(/xml = $results_xml_string, /xslt =
$display_xsl_string);

$xh = xslt_create();

$results_html_string = xslt_process($xh, arg:/xml, arg:/xslt, NULL,
$arg_buffer);
echo $results_html_string;
xslt_free($xh);
?

Thanks for all your suggestions!
-- 
Rich.
UEA/MUS::Record Library

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



[PHP] PHP with Frames (cont.)

2003-10-27 Thread rich
No, he's right - this is an issue.

Do variables persist between PHP files?

In the attached scripts I have a login page which directs the user, on a
sucessful login, to a front page which is a frameset.

The login.php opens a connection to a MySQL database ($connection) but once
the browser has been re-directed to the frame-root.html page this variable
is no longer available.

Kb wrote:

 Hi,
 
 Does anyone know why my PHP pages won't work in Frames?  I have 5 frames,
 each of which are displaying PHP pages.and none of the PHP code works.
 
 If I run the code outside of Frames it works fine!
 
 I've can't find any decent references for PHP in Frames.
 
 Your help would be appreciated.
 
 Thanks
 
 Kevin

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

[PHP] Persisting MySQL connection accross scripts

2003-11-01 Thread rich
How can I establish a connection with a MySQL database and have it persist
accross multiple script files?

I've found the mysql_pconnect() function but this doesn't seem to do the job
- which is fairly logical actually because the connection is stored in a
variable:

$connect = mysql_pconnect();

and that variable $connection won't be available in another script.

I would have thought there would be a straightforward answer to this as it
seems that its someting which must be done fairly regularly.

The only workaround I can think of is sending the username, password and
database name to every script.  But how would you do this securely?

When establishing the initial connection I got the username and password
from a form which used the method=POST method.

But if I want to have a link to a script, say 'add_item.php', how can I do
it securely?

a href=add_item.php?username=? echo($_POST['username']): ?password=?
echo($_POST['password']): ?.../a

would not use the POST method.

I could use forms for every link but this seems ridiculously
over-complicated!

Thanks in advance for any pointers!

Richard.
-- 
UEA/MUS

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



[PHP] Problem using substr() and strpos() functions

2003-11-14 Thread rich
Hello List,

I'm trying to extract the sub-string from a string which appears between a
pair of brackets,

e.g. from Mozart Requiem (15)
I want to extract the string 15

I tried this:

substr($s, (strpos($s, () + 1), (strpos($s, )) - strpos($s, () - 1))

but it returned the error:

Parse error: parse error, unexpected T_STRING in /.../loan-edit.php on line
15

What have done wrong?

Thanks in advance,

Richard
-- 
UEA/MUS

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



[PHP] Re: Problem using substr() and strpos() functions

2003-11-14 Thread rich
Oh, sorry I've worked it out!

The bug was on a different part of the line!

Cheers,
Richard
-- 
UEA/MUS

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



RE: [PHP] PHP Sessions on Windows

2004-05-12 Thread rich
 How does one get sessions working on Windows? I have modified my php.ini
 file so that session.save_path = C:\Temp, restarted and Apache.
 Still I get
 this error message:

 Warning: session_start(): open(/tmp\sess_26310affee160329c9e50f27663f8971,
 O_RDWR) failed: No such file or directory (2) in
 c:\apache\htdocs\dbmdata\admin\61646d696e.php on line 2


check you have edited the correct php.ini -- run ? phpinfo() ? and check
where the ini file is to make sure you changed the correct one...

hth
rich

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



RE: [PHP] passing the file back

2004-04-30 Thread rich
 Hi all
 In the CMS package mambo , there is an option to backup a database etc.
 Which I can do etc, but what I would like to know, is of a way to pass the
 .sql file, or what ever was selected, to be passed back to the user

 Im looking in the source, but my OO skills is very much lagging.
 I basically want a file to be passed back to me, via a web front end

 Kind Regards
 Brent Clark

not sure what you're after here as mambo gives you an option to download the
file to the local computer when you selct backup database... do you not see
that option?

rich

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



RE: [PHP] http username

2004-05-02 Thread rich
 If a user is logged in via http (authentification e.g. with  .htaccess and
 .htpasswd file), how can i get the username of the current logged in user?

 Thanx
 Harry

try $_SERVER['PHP_AUTH_USER']

rich

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



RE: [PHP] executing php scripts via cron

2004-05-18 Thread rich
 I am trying to run a php script via cron. Problem is, that it
 does not work if I
 include the whole path in crontab

 Currently it looks like:
 0 6 * * * php
 /home/www/project/app_cron/follow_up_new_members.php  /dev/null

 Most likeley because the webserver root for the project is:
 /home/www/project/

 So if I go into this dir and execute:
 php app_cron/follow_up_new_members.php

 it workes. But not with the full path. What do I have to enter
 into crontab? It
 obviosly does not work with the full path, but how to change into
 the directory
 via cron first?

It is probably because the cron daemon cannot find the php binary in its
path try it like this...

 0 6 * * * /full/path/to/php/binary/php
/home/www/project/app_cron/follow_up_new_members.php  /dev/null

hth
rich

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



RE: [PHP] count number of occurences of character in a string

2004-06-08 Thread rich
 
 what function can I use to count the number of occurences of a certain
 character in a string?

substr_count() ...?

rich

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



RE: [PHP] Mysql fetch_row()

2004-06-20 Thread rich
 when I call mysql_fetch_row() I get an array, but this Array doesn't have
 the fieldnames as array-keys.
 I've seen several codes from others where they use something like
 
 print $row['key'];
 
 This doesn't work on my server. Is this because my server-software is too
 old or am I using the wrong function?

...the wrong function - use mysql_fetch_assoc()

rich

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



Re: [PHP] PHP Eclipse on Linux

2007-04-12 Thread rich
Try setting JAVA_HOME then starting Eclipse. I got a similar error  
because it was trying to load Java from the wrong directory.


   Rich

Quoting Bagus Nugroho [EMAIL PROTECTED]:


Hi All,

When I'm trying to use eclipse on Linux, using command java   
-startup.jar, it was show an error like this

Could not create Java Virtual Machine

Is my command wrong.
Java already installed and eclipse was put on /opt

Thanks in advance
bn




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



RE: [PHP] Qmail problem

2001-03-08 Thread Rich Cavanaugh

Or you could try this:

sendmail_path   =   /var/qmail/bin/qmail-inject

Obviously you'll want to put in your correct path to qmail-inject, but that
works fine for me.

--
rich

-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 7:24 PM
To: pete collins; [EMAIL PROTECTED]
Subject: Re: [PHP] Qmail problem


On Fri,  9 Mar 2001 03:43, pete collins wrote:
 I keep getting:
 qmail-inject: fatal: read error

 I've tried everything.

 Sendmail is symlinked to /var/qmail/bin/sendmail wrapper

 $ ls -l /usr/lib/sendmail
 lrwxrwxrwx   1 root root   28 Aug 25  2000
 /usr/lib/sendmail - ../../var/qmail/bin/sendmail

 $ ls -l /usr/sbin/sendmail
 lrwxrwxrwx   1 root root   28 Aug 25  2000
 /usr/sbin/sendmail - ../../var/qmail/bin/sendmail


 I have tried every permutation for my sendmail_path in php.ini

 I tested the php code i'm using from my FreeBSD box which uses sendmail
 and it all works fine.

 I can use qmail fine from perl.

 Does anyone have any ideas? This is down right silly. ;-)

 Thanks

 --pete

For me, on Slackware, this works:

~$ ls -l /usr/sbin/sendmail
lrwxrwxrwx   1 root root   23 Aug 28  2000 /usr/sbin/sendmail
- /var/qmail/bin/sendmail*
~$ ls -l /usr/lib/sendmail
lrwxrwxrwx   1 root root   18 Jul 12  2000 /usr/lib/sendmail
- /usr/sbin/sendmail*

sendmail_path   =   /usr/sbin/sendmail -t -i;for unix only,
may supply arguments as well (default is sendmail -t)

Cheers
--
David Robley| WEBMASTER  Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet| http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA

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




Re: [PHP] Apache virtualhosts with different user

2002-01-08 Thread Rich Buggy


 if I define 'user' in virtualhost section of apache's httpd.conf, then my
 cgi scripts will be running as 'user' if suexec has been set up correctly.
 It's okay. But how can I tell apache to run the whole virtualhost as
 'user'? Including accessing html files, and especially php.

  In 1.3 you can't. Last I heard version 2 was supposed to include something
that would let you do this.

 Is it possible somehow? Having read the apache docs, I haven't found
 anything useful, but there must be a solution if I don't want my users to
 run php scripts as www-data.

  Run PHP as a cgi instead of a module. The PHP docs tell you how

 Rich




-- 
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] PHP and XML/XLST/WDDX etc

2002-03-29 Thread Rich Buggy

 I am in a dilemma right now between If it ain't broke, don't fix it and
Looking
 over my shoulder.  I am trying to determine whether it makes more sense
to use
 ML for maintaining configuration files.

  Compiled program == ML configuration file
  Interpreted program (i.e PHP) == included configuration file with
variables set

  For most interpreted programs I can't see any advantage in adding extra
code and processing time just to store the config file in a ML.

 As far as content management, we use static include files or MySQL
databases to
 store site content.   I am not sure where the advantage of using XML/XLST
for this
 functionality.

  I'm currently working on a class library/application framework for PHP
(similar to Delphi's VCL) in which I'm using XML/XSLT for the templates.
It's working great with development not taking very long at all. The two
main advantages of using XML/XSLT for content management that I can see are:
1. It's easier to enforce a common look and feel on a site.
2. It's easier to re-target content (different transformations for
different browsers).
.

  Rich



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




[PHP] Empty delimiter error - ??

2002-04-13 Thread Rich Pinder

I'm totally unfamiliar with php, and making some slight modificiations
to Chris Heilmann's nice v 1.1 Newsleterscript.

What exactly is meant by an empty delimiter?  This code works just fine,
but I get the following error:

Warning: Empty delimiter in /home/sites/site56/web/trailcrew.php on line
63



# Put the entries into the array lines
$lines = explode(%,$content);
for ($key=1;$keysizeof($lines);$key++){
# when the email is not in the list, add the old entries
 if (!stristr($lines[$key], $email)) {
offending line - line 63
  $out .= %.$lines[$key];
 }
# when it's already in the list, set found
 else {
  $found=1;
 }
}


Thanks
Rich Pinder




[PHP] Empty Delimiter error

2002-04-13 Thread Rich Pinder

Let me try again:

This line of the script:

if (!stristr($lines[$key], $email)) {


yields the following error:
Warning: Empty delimiter in /home/sites/site56/web.


Do you know what causes this error ?

Thanks
r

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




[PHP] Re: Empty Delimiter error

2002-04-15 Thread Rich Pinder

Thanks so much Daniel.

Indeed,  the old line that I modified didnt use a function call.

The old line was:
if ($lines[$key] != $email){

So, the  @  suggestion works just fine:

if (!@stristr($lines[$key], $email)) {  

Seems like a cryptic syntax for an error code of this meaning - and odd
that all the PHP sources I searched before posting here came up empty
for the terminology.

Thanks again
Rich


Daniel Grace wrote:
 
 Rich Pinder [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Let me try again:
 
  This line of the script:
 
  if (!stristr($lines[$key], $email)) {
 
 
  yields the following error:
  Warning: Empty delimiter in /home/sites/site56/web.
 
 
  Do you know what causes this error ?
 
  Thanks
  r
 
 My guess is that $email is empty (or possibly $lines[$key]). The
 documentation for stristr says nothing about generating warnings on such an
 occurance, but it would make sense.
 
 If your script can handle $email being empty, simply adjust your level of
 error-reporting or silence the warning with an @.  Otherwise, fix whatever
 it is that's causing $email to be empty.
 
 -- Daniel Grace

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




[PHP] Case Sensitivity

2002-08-11 Thread Rich Hutchins

I've had a web site under development on my Win2k box at home. I built and
tested everything with PHP 4.2.2 and Apache 1.3.24.

Now, I have transitioned everything up to my host who is using a Linux box,
PHP 4.2.2 and Apache 1.3.26.

One of the pages I designed has code that retrieves a list of thumbnails
from a directory name passed into the page then embeds a hyperlink to a full
size version of the thumbnail. Incidentally, the full size version is in the
same directory as the thumbnail and has a very similar filename:
tn_01.jpg and 01.jpg (guess which one's the thumbnail).

Here's the problem:
When I run the page on the web host's server, the link to the full size
image dies. I've tracked the problem to the case of the linked filename.
Basically, unless the filename in the href matches the case of the target
file, the link dies and I get that nice, little red X indicating the link to
the image is broken.

For example, the target image DSC01.JPG _MUST_ be referenced in the href
as: href='../path/to/resource/DSC01.JPG' If I reference it as
href='../path/to/resource/dsc01.jpg' the target image won't show up.

I have temporarily resolved the issue by designating the filename used in
the href as upper case using the strtoupper() function, but I can't believe
that's the way it's SUPPOSED to be done.

What I'd like to know is does the Linux server introduce case-sensitivity
issues? It doesn't seem to matter with the elements of the path, just the
target filename.

Help is appreciated.

Rich


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




Re: [PHP] Store locator / postcode proximity

2001-12-10 Thread Rich Buggy

 I'm wondering if anyone has any information about how to get the
 proximity data for postcodes in Australia? Or is it safe to assume
 that if a postcode is, say, 3107, that 3120 or 3110 (for example)
 are nearby as well as 3108 (so, perhaps, 10 above and 10 below could
 be safely assumed to be nearby?)

  Don't even bother trying that for Sydney. There's a border around Western
Sydney where the Eastern suburbs are 21xx and the Western ones are 27xx. For
example 2148 and 2767 are next to each other.

Rich




-- 
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] something wrong

2001-08-07 Thread Rich Cavanaugh

Ok, this is just a variant of a question asked almost daily. You are trying
to call a PHP function using JavaScript. PHP is handled on the server,
JavaScript is done client side. The browser doesn't know anything about PHP.
Another option might be to use the onunload handler to popup (might piss off
people though) a window which would load that PHP script and delete the
file.

rich



-Original Message-
From: Eduardo Kokubo [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 07, 2001 1:49 PM
To: Chris Cocuzzo
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] something wrong


I tried it using return and without it, but unfortunly  neither cases
worked.

- Original Message -
From: Chris Cocuzzo [EMAIL PROTECTED]
To: Eduardo Kokubo [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 2:21 PM
Subject: Re: [PHP] something worong


 hey-

 I'm not sure, but maybe try this:

 body onunload=?php return apaga($diretorio);?

 for some reason i don't think that'd work, prolly because of the quotes
 around the php, however i think you need to call it that way. But can you
 ever use return that way??

 chris


 - Original Message -
 From: Eduardo Kokubo [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Tuesday, August 07, 2001 1:12 PM
 Subject: [PHP] something worong


 Hi,

 I'm using this code to delete a file using onunload, but this is not
 working. Can anyone please tell me why? I know the function apaga() works,
 but the onunload thing doesn't. I probably missed a detail.

 html
 head
 /head
 BODY onunload=return apaga($diretorio);
 ?php

 function apaga($diretorio){

 unlink ($diretorio.tgz);

 }





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




RE: [PHP] email templates and str_replace

2001-06-20 Thread Rich Cavanaugh

Richard,
The problem is with the str_replace()s. Consider the following:

?php
$myvar = 'this is a var.';
$mytext = str_replace('is', 'is not', $myvar);
?

At this point $myvar still equals 'this is a var.' but $mytext is 'this is
not a var.' $myvar hasn't been modfified by the str_replace so any
additional str_replace()s after it will not have a cumlative effect.

?php
$mail_content = $mail_template;

$mail_content = str_replace('##fullname##',$fullname,$mail_content);
$mail_content = str_replace('##email##',$email,$mail_content);
$mail_content = str_replace('##domain##',$domainname,$mail_content);
?

Something like the above would have the effect you're looking for.

--
Rich Cavanaugh
CTO, EnSpot.com

-Original Message-
From: Richard Kurth [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 4:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP] email templates and str_replace


  I am trying to set up a template for an email program below you will
  see the test program the $mail_template is pulled from a database
  that is pre saved when it is saved the Placeholders are filled in
  using str_replace. that is what I want it to do. But it does not work.
What am
  I missing hear.

$mail_template= html
head
titleWeb Hosting At ##hostdomain## /title
/head

body bgcolor='#C4C9DB'
font size='4' color='#008080'strongDear ##fullname## /strong/font
brbr
font size='4' color='#008080'strongYour webhosting account has been
created. Please use the following data to log in to ##domain##
/strong/font
br
font size='4' color='#008080'
strongul type=square
liDomain:##domain##   /li
liIP-Address: ##ip## /li
liUsername: ##username##/li
liPassword: ##password##/li
liMysql Database: ##userdatabase##  /li
liMysql Username: ##newuser## /li
liMysql Password: ##newuserpass## /li
/ul  /strong
/font

font size='4' color='#008080'strongThanks for choosing ##hostdomain##
br Any Questions e-mail ##sales##@##hostdomain##/strong /font

/body
/html
;

/* message*/
//$mail_template = $message;

$fullname=Richard Kurth;
 $email=[EMAIL PROTECTED];
 $hostdomain=northwesthost.com;
 $hostname=www;
 $domain=twohot;
  $tld=.com;
 $baseip=234.444.45.444;
 $username=rkurth;
 $password=boat;
 $userdatabase=twohot;
 $newuser=twohot;
 $newuserpass=twohot;
 $sales=sales;
$domainname=$hostname . . . $domain . $tld;


$mail_content = str_replace('##fullname##',$fullname,$mail_template);
$mail_content = str_replace('##email##',$email,$mail_template);
$mail_content = str_replace('##domain##',$domainname,$mail_template);
$mail_content = str_replace('##ip##',$baseip,$mail_template);
$mail_content = str_replace('##username##',$username,$mail_template);
$mail_content = str_replace('##password##',$password,$mail_template);
$mail_content =
str_replace('##userdatabase##',$userdatabase,$mail_template);
$mail_content = str_replace('##newuser##',$newuser,$mail_template);
$mail_content = str_replace('##newuserpass##',$newuserpass,$mail_template);
$mail_content = str_replace('##hostdomain##',$hostdomain,$mail_template);
$mail_content = str_replace('##sales##',$sales,$mail_template);
/* and now mail it */
/* recipients */
$recipient = $fullname $email ;
//header
$headers .=From: Sales Department  [EMAIL PROTECTED] \n;
$headers .= reply-To:$from\nX-Mailer: PHP/ .phpversion(). \n;
$headers .= Content-Type: text/html; charset=iso-8859-1\n;
//subject
$subject1 = $subject;
//mail($recipient, $subject1, $mail_content, $headers);
//print $recipient, $subject1, $mail_content, $headers;
echo $mail_content;











Best regards,
 Richard
mailto:[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]




RE: [PHP] Calculate # of minutes during working hours between two dates

2001-06-20 Thread Rich Cavanaugh

this is just the way I would do it:

generate timestamps for 8.00 and 17.30 for the days you want as long as the
timestamps are between the two original timestamps. after that it's all
subtraction and dividing by 60. That's about as efficient as I can think of.

Rich Cavanaugh

-Original Message-
From: Wim Koorenneef [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 11:26 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Calculate # of minutes during working hours between two
dates


Hi all,

I want to calculate the number of minutes between two dates, but only
those minutes on monday through friday between 08.00 and 17.30.

I could evaluate every minute in the interval against all known minutes
during working hours, but that's a bit much :-) Any suggestions for a
better, more efficient algorithm? Tia.

--
Greetinx,

Wim Koorenneef [EMAIL PROTECTED] Boxtel, the Netherlands


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




RE: [PHP] Code check please

2001-06-20 Thread Rich Cavanaugh

You're using UPDATE syntax for your INSERT

try:

$sql = INSERT INTO tabell (fornamn, efternamn, email) values ('{$fornamn}',
'{$efternamn}', '{$email}');

Rich Cavanaugh

-Original Message-
From: Andreas Skarin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 20, 2001 12:00 PM
To: PHP General
Subject: [PHP] Code check please


I've tried to get this working for over an hour
now, and it still won't. I don't even get an error
message to help me find the problem so I was
hoping that someone could check my code for me.

I'm fooling around with a basic form that is
supposed to send one's name, surname and e-mail
address to receive.php. receive.php is then
supposed to take the information and add it to a
table called tabell in a database called
databas, but it doesn't work. I think there
might be something wrong with my MySQL query.

- - - - - - - - - - - FORM - - - - - - - - - - - -
- -

form action=receive.php method=post
PFouml;rnamn:br
input type=text name=fornamn
size=25/p
pEfternamn:br
input type=text name=efternamn
size=25/p
pE-mailadress:br
input type=text name=email
size=25/p
input type=submit name=submit
value=Log in
/form

- - - - - - - - - - - - - - - - - - - - - - - - -
- - -

- - - - - - - - - - - RECEIVE.PHP - - - - - - - -
- - -

?php

// connection to MySQL
$connection = mysql_connect(localhost,
username, password);
if (!$connection) {
echo (PUnable to connect to the database
server at this time./P );
exit();
}

//select database
if (! @mysql_select_db(databas) ) {
echo (PUnable to locate the database at
this time./P);
exit();
}

// MySQL query
$sql = INSERT INTO tabell SET .
fornamn ='$fornamn', .
efternamn='$efternamn', .
email='$email';;
?

- - - - - - - - - - - - - - - - - - - - - - - - -
- - -

Thanks in advance!

// Andreas


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




RE: [PHP] Problem starting session

2001-06-20 Thread Rich Cavanaugh

Ben,
In your php.ini you should have the following:

session.save_path = c:\winnt\temp

Currently you have it set to:

session.save_path = /tmp


--
Rich Cavanaugh
-Original Message-
From: Ben Edwards [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 23, 2001 12:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Problem starting session


I am getting the following on a Windows 2000 Professional installation when
I try to start a session:

Warning: open(/tmp\sess_9ab091b811c5675d90fabf4392b3c110, O_RDWR) failed: m
(2) in
e:\inetpub\wwwroot\cd\common.inc on line 27

Any help would be much appreciated.

Regards,
Ben
*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+
* Ben Edwards [EMAIL PROTECTED]+44 (0)7970 269 522 *
* Campaign Against proper English, Dyslexia division *
* Homepagehttp://www.gifford.co.uk/~bedwards *
* i-Contact Progressive Videohttp://www.videonetwork.org *
* Smashing the Corporate image http://www.subvertise.org *
* Bristol's radical newshttp://www.bristle.co.uk *
* Open Directory Project http://www.dmoz.org *
*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+

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




RE: [PHP] how to install pws on win2k

2001-06-20 Thread Rich Cavanaugh



Sagar,
 Open your "Add/Remove Programs" control panel. Click on 
"Add/Remove Windows Components". Click the check box next to "Internet 
Information Server". Click OK. You'll need your Win2k CD. This will install a 
limited version of IIS. 

--Rich 
Cavanaugh

-Original 
Message-From: sagar chand 
[mailto:[EMAIL PROTECTED]]Sent: Wednesday, June 20, 2001 12:58 
PMTo: [EMAIL PROTECTED]Subject: [PHP] how to 
install pws on win2k

  hi everyone,
  
  I have recently shifted from win98 to win2k. the 
  pws i'm using is not installing on win2k. Is there any remedy 4 
  this?
  
  thanks for all u guys who help here with this 
  mailing list.
  
  bye
  sagar


RE: [PHP] [OT-ish] Optional Extras.

2001-06-25 Thread Rich Cavanaugh

Dave,
I did something similar and I came up with an interesting way of
approaching it:

Assign IDs to each car (obviously).
Assign an ID to each option.
Match up your car IDs and option IDs in a seperate table.

Here's some table defs:

create table cars (
carid   int auto_increment,
namevarchar(255)
);

create table options (
optid   int auto_increment,
namevarchar(255)
);

create table caroptions (
carid   int,
optid   int
);

(if my sql is off, don't flame me, you at least get the idea)

Here's the search:

$words should be a comma delimited list if the options the user chose.

select count(o.carid) as cnt, o.carid as id, c.name from caroptions as o,
cars as c where and o.optid in ({$words}) and o.carid = c.carid group by
o.carid, c.name order by cnt DESC

This would give you a list of cars ordered by the best match to worst match.


again - this is all off the top of my head, I'm sure it's not word for word
correct.
--
Rich Cavanaugh

-Original Message-
From: Dave Mariner [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 25, 2001 3:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP] [OT-ish] Optional Extras.


Please excuse me if you consider this to be off-topic, but this is the best
place I can think of to ask the (slightly long-winded) question.

Imagine you have a car database (MySQL driven). Different models have
different optional extras (air-con, central locking, immobiliser etc). I
need to store the optional extras in a searchable form - i.e. the customer
may have a wish-list of electric windows, aircon, and power steering.
However the optional extras list is not and will not be finalised when the
system goes live (probably will never be finalised!). Therefore I cannot do
the quick-and-dirty hack of putting all the options as binary fields in my
car database, so must come up with a more elegant solution. I've thought of
storing e.g. 10 tuples car.option1-aircon code, car.option2-powersteering
code. etc. and also going down the header-detail route.
My current quandry is to which is going to be better for the search
aspect, considering I'd also like to give them a best fit option. Would it
be to create a cursor on my fixed criterion (price, age etc) and then
iterate through each of those manually in my php script (see - it isn't
entirely off topic ;0) ) counting the matches for that record in the
optional-extra detail table? Or would it be to do a select where
(optionalextra1=mychoice1 or optionalextra2 = mychoice1 ..) and
(optionalextra2=mychoice2 or optionalextra2 = mychoice2.. ) and  etc
etc (yeuch!).

 I have a sneaking suspicion that there's a more elegant way than either
of these, but can't think of it at the moment.

 If you come up with the solution there's a beer in it for you the next
time you're in Paphos, Cyprus!

Thanks in advance,

Dave.




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




[PHP] passthru environment variables

2001-02-10 Thread Rich Puchalsky

I'm trying to use passthru in a PHP program to have an external program
display some data.  The problem is that I was trying to have the external
program's environment pick up the form field variables automatically passed
into the PHP program as shell environment variables.

In other words, if a user typed "Smith" into the last_name field in a form,
the PHP program called by that form starts out with $last_name = "Smith",
and I would like the external program called by passthru within the PHP
program to have a shell environment variable last_name = "Smith".

Does anyone know an easy way to do this?





-- 
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] passthru environment variables

2001-02-11 Thread Rich Puchalsky

"Richard Lynch" [EMAIL PROTECTED] wrote:
 http://php.net/setenv

Thanks!  But when I try this link, or the "Quick Ref" button on the PHP home
page, I can't find anything about setenv.  And the manual doesn't have
anything about it under Program Execution Functions.  Is it undocumented?




-- 
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] passthru environment variables

2001-02-11 Thread Rich Puchalsky


"Rich Puchalsky" [EMAIL PROTECTED] wrote in message
966dad$pkm$[EMAIL PROTECTED]">news:966dad$pkm$[EMAIL PROTECTED]...
 "Richard Lynch" [EMAIL PROTECTED] wrote:
  http://php.net/setenv

 Thanks!  But when I try this link, or the "Quick Ref" button on the PHP
home
 page, I can't find anything about setenv.  And the manual doesn't have
 anything about it under Program Execution Functions.  Is it undocumented?

And once I actaully tried it, I got an undefined function message.




-- 
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] passthru environment variables

2001-02-13 Thread Rich Puchalsky

OK, I finally found it.  Someone else here recommended setenv -- it's
actually putenv.  putenv was *not* found through any search I could make on
the PHP Web site involving the word environment and so on, I found it
through Google.  And it's apparently documented under "PHP Options and
Information" where I wouldn't have thought to look for it for a thousand
years.



-- 
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] System log in problems

2007-05-24 Thread Rich Peterson

Hi All

Let me start by saying I am not 100% sure this
is the correct board to post this to. I hope it is
because as i have watched this list it contains
some very helpful people.

I have search for an answer to this and cannot
seem to find it.  We have a subscription based
site that is developed mainly with php and mysql.
We have one person who each time he attempts
to log in it just rolls back to the login page. With
almost 2000 users this is the only time we have
come across this problem. He is not running your
average system at his home the details are.

Operating system is Ubuntu 7.04 released in April 2007
 also using Firefox Version 2.0.03
Mozilla/5.0 (x11; U; Linusi686; en-US;rv:1.8.13) Gecko/200611201
Firefox/ 2.0.0.3 (Ubuntu-feisty)


I can login using firefox and ie no problem but am running a
more common windows system. Is there something on our
end that could be causing this problem for him?

Thanks in advance
Rich

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



Re: [PHP] PHP Frameworks - Opinion

2006-08-01 Thread rich gray

Robert Cummings wrote:

[chop]
An IDE is not a framework, it's an IDE :)

Cheers,
Rob.
  
I think Rob is being unduly modest - correct me if I am wrong but he is 
the core developer of the InterJinn php framework - 
http://interjinn.com - it's been out there for a while now (read: 
robust, fully featured) and the ZF is still in beta I think...

cheers
rich


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



Re: [PHP] str_replace on words with an array

2006-10-29 Thread rich gray

Paul Novitski wrote:


If you go this route, perhaps you could enclose each member of your 
original array in \b word boundary sequences using an array_walk 
routine so that you don't have to muddy your original array 
declaration statement.


IIRC str_replace() does not interpret or understand regular expression 
syntax - you'd need preg_replace() for that

rich


Re: [PHP] how to kill session id without closing the window?

2006-04-07 Thread rich gray

[chop]

How can I create new, other sesssion id (after I, for example, click on
'Log Out' button) without closing window?

Thanks for any help.

  

er .. session_regenerate_id()

hth
rich

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



Re: [PHP] looking for shopping cart

2006-04-22 Thread rich gray
Try Zen cart  http://www.zen-cart.com/modules/frontpage/ it is a fork of 
osCommerce which is a very popular OS cart.

I've used it and customised it on a few sites without problems.
Cheers
Rich

Lisa A wrote:
I'm still looking for an inexpensive shopping cart to use on my client's 
website.  Something they can easily update their products, prices, photos, 
etc once I set it up for them.  It must be very simple for them to use.

Anyone write any shopping cart scripts that might work?
thanks,
Lisa A

  



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



RE: [PHP] Different output on two different servers

2002-12-09 Thread Rich Gray
Steve
Not quite clear on your problem - did you run an ALTER TABLE on your MySQL
table or just an INSERT of a new row? Assuming it was the former, all I can
say is look at the code that populates the $cat_array variable to see if the
underlying query would have been affected by the alter table command...
Does the query that populates $cat_array run OK if executed directly in
MySQL?
Rich

-Original Message-
From: Steve Jackson [mailto:[EMAIL PROTECTED]]
Sent: 09 December 2002 13:11
To: PHP General
Subject: [PHP] Different output on two different servers


Hi all,

I have set-up a production server and a live server. The problem is with
the production server. I am using PHP version 4.2.3 and MySQL 3.23.39 on
both servers. We have just configured the production server to mimick
the live server (which incidentally works fine) and the code from both
servers is identical. I dumped all the data into the production MySQL
database then copied the code from the live server to our production one
and there didn't seem to be any problems. However today my boss asked
for a new category to go into our webshop with a new product. I went
into MySQL and updated the database fine then when I went to check the
section of the site to see if the extra category and product are there I
get my own PHP encoded error 'No categories currently available'. It
fails on the first function:
function display_categories($cat_array)

{
  //display all categories in the array passed in
  if (!is_array($cat_array))
  {
 echo brNo categories currently available.br;
  }
  else
  {
//create table
echo table width = \760\ border='0'
background='images/shopbg.gif';
etc.

Now it works superbly on my live server and did work fine until I tried
adding another field to the database on the production server. Where
should I start looking to de-bug this?

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159


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




RE: [PHP] Script not working from one computer

2002-12-09 Thread Rich Gray
Does a print_r() of the superglobal arrays differ in any significant way
when posting the username/password from the troublesome client when compared
to the superglobals for a well behaved machine?

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: 09 December 2002 16:32
To: M.A.Bond; php-general
Cc: heflinaw
Subject: Re: [PHP] Script not working from one computer


 Have you checked:

 Browser versions? (is the browser the same type/version as on the other
 machines)
 Is it a laptop? If so, are you using the internal keyboard with Numlock
on?
 Is the machine in question set-up on the network correctly, i.e. has it
got
 domain, gateway addresses etc setup - this would only affect it if the
 Intranet server is set-up to only allow a certain range of IP addresses or
 doamin/hostnames etc.

Browser's are the same (128bit). It's not a laptop. The web page can pull up
any other external web page correctly.

What gets me is that the computer can pull up the log in page. It can pull
up another, unprotected page from that web server. But, no matter who tries
to log in from that machine, I get a bad username and password, even though
they are right. It's like the browser is sending bad data to a script that
works fine from every other computer.

Anyone else have any other ideas?


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




RE: [PHP] server problems.

2002-12-10 Thread Rich Gray
A wild guess: Are you using a database abstraction class or configuration
file? Is it still pointing to the live server database instead of the
production server database?

Rich

-Original Message-
From: Steve Jackson [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 12:34
To: PHP General
Subject: [PHP] server problems.


I have a production server and a 'live' web server. The set-ups are the
same and yet I can view code fine on the 'live' web site but not on the
production server. At least I can view one shopping cart section online
but not offline. All the other database driven stuff appears fine. I've
even tried dumping the 'live' database onto my production server and
deleting and re-installing the code. No effect. Any ideas? The shop
section even worked offline until I added a new category now it simply
doesn't show anything. Flummoxed because on the live server everything
works hunky dory. Also the shop admin functions are password protected -
now when I try to login to that it refuses to let me in, even though the
same password and login functions are ok on the live server. I tried
adding a new user - no effect. It's like it just refuses to read this
part of my database, but everything else will work OK. Any ideas?

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159



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




RE: [PHP] run query

2002-12-10 Thread Rich Gray
Er... but the original poster wanted a count of rows returned by a
particular query... your method just returns the number of rows in the
table...

Rich

-Original Message-
From: @ Edwin [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 17:21
To: Jon Haworth; 'Diana Castillo'
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] run query


Or,

Jon Haworth [EMAIL PROTECTED] wrote:

 Hi Diana,

  After I run a query lik this,
  $db-query($sql);
 
  what is the quickest way to find out how many
  records result?

 Look into mysql_num_rows (or the equivalent if you're not using MySQL)

... you can even do it faster by using a

  select count(*) as something from some_table

More info (found in the manual):

  http://www.faqts.com/knowledge_base/view.phtml/aid/114/fid/12

HTH,

- E



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




RE: [PHP] Help Need in PHP File Upload

2002-12-10 Thread Rich Gray
probably register_globals is off on the client's machine - use $_FILES[][]
instead of $HTTP_POST_FILES[][] BTW I would upgrade your local Linux box
from v.4.0.3 it is pretty old now and unsupported...

Rich
-Original Message-
From: ppf [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 13:21
To: [EMAIL PROTECTED]
Subject: [PHP] Help Need in PHP File Upload


Hi:
I need to upload a file during form submittion, I had
done all the coding on my local Linux box It work fine
over here.
When i moved the code to my Client machine File upload
is not working  well.
Server side code first check where file upload is
successful by
is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])
method, if it is True it will copy it to the
destination folder.
 Once i hosted this code on my clients machine First
attempt will work successfully, it will copy the file
into the destnation folder. But when i tries to repeat
the form submission process, from second time onwards
unsuccessful.
  I am programmatically creating new folder each time
so there is no chance of over writing issues.
  Whe i checked the code more care fully, Function
is_uploaded_file($HTTP_POST_FILES['file']['tmp_name'])
returns False
 I am quite new to Linux env. Is it due to some sought
of permission issue? Or due to Version problem.
  I am using Php4.0.3 on my local Linux Box and 4.2.3
on Clients machine. I also tested this code on
window's Apache/php4.2.3 It works fine over windows .
 If anybody can point out the error will be a great
Help for me.. Thanks in advance

  Prad




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




RE: [PHP] Can anyone help? PHP script/MySQL problem

2002-12-10 Thread Rich Gray
Hi Steven
so what exactly is the problem then?
Rich

-Original Message-
From: Steven M [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 14:25
To: [EMAIL PROTECTED]
Subject: [PHP] Can anyone help? PHP script/MySQL problem


Hi, i am trying to create a member login/authentication script to
automatically send newly signed up people an email with a confirmation link.
I am following a tutorial:

http://www.phpfreaks.com/tutorials/40/0.php

My form is located at:

http://www.tricia-marwick.co.uk/members/join_form.php

[snip]


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




RE: [PHP] Can anyone help? PHP script/MySQL problem

2002-12-10 Thread Rich Gray
Any error messages? You say it is not stored 'as it should be' does that
mean it *is* stored but incorrectly, or is the data just not there?
FWIW I just used your test form and it said I had registered ok I then
retried with the same info and I got 2 error messages as I would have
expected which implies the data is hitting the database ok...
Rich

-Original Message-
From: Steven M [mailto:[EMAIL PROTECTED]]
Sent: 10 December 2002 14:47
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Can anyone help? PHP script/MySQL problem


Hi Rich

The prob is that the data isn't stored into the database as it should be and
the user doesn't get an email back with their data.  It seems to get lost
before reaching the database, meaning the rest of it wont work, and i don't
know why.

Thanks

Steven M



--
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] How to upload a file

2002-12-18 Thread Rich Gray
What does print_r($_FILES) tell you? Is $_FILES['userfile']['error'] set to
a value?
Rich

-Original Message-
From: Somesh [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 11:18
To: [EMAIL PROTECTED]
Subject: [PHP] How to upload a file



Hi,

I am using the following code to upload file;
X---
form enctype=multipart/form-data action=load.php method=post
input type=hidden name=MAX_FILE_SIZE value=10
Send the file: input type=file name=userfilebr
input type=submit value=Send 
/form
X---

This works fine for small files of like some Kbs but fails to upload
larger files near to 1MB.

Can any one help me out from this problem

my file processing code is::
X---
if(is_uploaded_file($userfile)) {
copy($userfile,./upload/$userfile_name);
echo Successfully completed the uploading of the file
$userfile_name of size $userfile_sizebr;
}else{
echo some error has occured while uploading the file
$userfile_namebr;
echo $userfile;
}
-X---


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




RE: [PHP] How to upload a file

2002-12-18 Thread Rich Gray
As others have suggested does it make any difference if you up the script
timeout limit with set_time_limit() or via the max_execution_time in
php.ini?

-Original Message-
From: Somesh [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 13:37
To: Rich Gray
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] How to upload a file


It is not displaying any thing.
It just gives the browser's error page
The page cannot be displayed

And the print_r($_FILES) prints an empty array;



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




RE: [PHP] How to upload a file

2002-12-18 Thread Rich Gray
What are these settings in your php.ini?

post_max_size
upload_tmp_dir

Does the upload_tmp_dir have enough space? Are the permissions on the
directory correct? When you start the upload - how long does it take to fail
immeditaely you click submit or after a delay. If the latter then is there
anything created in the upload directory after teh submit is clicked and
before it fails...?

-Original Message-
From: Somesh [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 15:52
To: Rich Gray
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] How to upload a file



No difference


On Wed, 18 Dec 2002, Rich Gray wrote:

 As others have suggested does it make any difference if you up the script
 timeout limit with set_time_limit() or via the max_execution_time in
 php.ini?




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




RE: [PHP] PHP and MySQL queries

2002-12-19 Thread Rich Gray
Does it work if you put quotes around the array keys as follows...

echo $line['idn'];
echo $line['total'];
echo $line['idp'];
echo $line['position'];
echo $line['points'];

Rich

-Original Message-
From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
Sent: 18 December 2002 20:28
To: PHP General
Subject: [PHP] PHP and MySQL queries


Hi,

I am having a real problem with variables in PHP and trying to query my
MySQL database. I have a form that a user inputs information and then that
info is used to query my database, but it's not working. I don't get any
errorrs and it appears every thing worked, but nothing gets displayed (see
code below). I know the info is getting passed from the form as it appears
correct in the address bar of my browser. The query below also works if I
use the command line in MySQL and hard code the information.

Any help is appreciated.

http://etc/etc?FromTrade=TRUEname=1from=2

$query = select tmanager.idn, tmanager.total, troster.idp, user, position,
points from troster join treference
join tmanager where tmanager.idn=treference.idn and
treference.idp=troster.idp and tmanager.name like '$name' and
troster.player like '$from';

$results = mysql_query($query) or die(Query failed);

while ($line = mysql_fetch_array($results, MYSQL_ASSOC)) {

 echo $line[idn];
 echo $line[total];
 echo $line[idp];
 echo $line[position];
 echo $line[points];

This just displays an empty page. So it appears the query found nothing, but
like I said, it works from the command line and there should be one entry
(see below). So I have to assume it is a problem with the variables.

+-++-++--++
| idn | total  | idp | user | position | points |
+-++-++--++
|   1 | 746.75 |   2 | Trevor  | F|  45.00 |
+-++-++--++


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




RE: [PHP] Check Uploaded File

2002-12-19 Thread Rich Gray
Shaun

Run getimagesize() on the uploaded file - if a valid jpeg the returned
array[2] will be set to 2...

http://www.php.net/manual/en/function.getimagesize.php

HTH
Rich

-Original Message-
From: shaun [mailto:[EMAIL PROTECTED]]
Sent: 19 December 2002 02:24
To: [EMAIL PROTECTED]
Subject: [PHP] Check Uploaded File


Hi,

Is it possible to ensure that a user is uploading a jpeg file from a form
and nothing else?

Thanks for your help



--
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] How to upload a file

2002-12-20 Thread Rich Gray
And if you select a small file it works fine right?

-Original Message-
From: Somesh [mailto:[EMAIL PROTECTED]]
Sent: 20 December 2002 12:29
To: Rich Gray
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] How to upload a file


post_max_size 8M
upload_tmp_dir didn't set to any value

It fails immediately after clicking the submit button.

[thanx for ur concern]



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




RE: [PHP] PHP Sessions

2003-01-21 Thread Rich Gray
Sorry I'm a bit late in on this thread but I know there is a problem with
sessions with 4.1.2 with IIS 5 over Win2K... is that your platform? I
encountered it a while back and there is a hack/workaround which I can dig
up if you need it...

HTH
Rich
-Original Message-
From: Tim Thorburn [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 10:26
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] PHP Sessions


There is some discussion as to whether my globals are on or not ... I am
using session_register to name my sessions, and then the global command
later on on the individual pages to remember which session it is we're
looking for.

It would be simply priceless if sessions were broken in 4.1.2 - and make
much sense in the long run.

Thanks
-Tim


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




RE: [PHP] Form Validating Class (OOP misunderstandings...)

2003-01-21 Thread Rich Gray
PHP does not yet support private methods ... your problem with getValue() is
most probably because register_globals is off in your php.ini try
substituting $_POST[] for $HTTP_POST_VARS[] and it may start to work...
HTH
Rich

-Original Message-
From: Nicholas Wieland [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 14:13
To: [EMAIL PROTECTED]
Subject: [PHP] Form Validating Class (OOP misunderstandings...)


Hello everybody,
I'm working on a class but having a lot of problems... probably my
understanding of PhP-OOP is not so good ...
Here's the class: I found it on the web and I've tried to personalize
it to fit my needs...

?php

class FormV
{
var $errorList;

function FormV()
{
$this-reset_errorList();
}

function getValue( $field )
{
$value = $HTTP_POST_VARS[ $field ];
return $value;
}

function isEmpty( $field, $msg )
{
$value = $this-getValue( $field );

if( trim( $value ) ==  )
{
$this-errorList[] = array( field = $field,
value = $value, msg = $msg );
return true;
}
else
return false;

}

function isString( $field, $msg )
{
$value = $this-getValue( $field );

if( is_string( $value ) )
return true;

else
{
$this-errorList[] = array( field = $field,
value = $value, msg = $msg );
return false;
}
}

function isEmail( $field, $msg )
{
$value = $this-getValue( $field );
$pattern =
/^([a-zA-Z0-9])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/;

if( preg_match( $pattern, $value ) )
return true;

else
{
$this-errorList[] = array( field = $field,
value = $value, msg = $msg );
return false;
}
}

function isError()
{
if( sizeof( $this-errorList )  0 )
return true;

else
return false;
}

function get_errorList()
{
return $this-errorList;
}

function reset_errorList()
{
$this-errorList = array();
}

function stringConvert( $field )
{
$value = $this-getValue( $field );

$value = html_special_chars( $value );

$value = stripslashes( $value );

$value = strtolower( $value );

return $value;
}

};

?

Ok.
I think that the getter is *totally* wrong but I'm not able to debug
it, because it's private (I think...). Also the stringConvert() method
sucks, maybe I'll split it in some others accessor methods, for a
better design.
Now I'm totally lost, I don't have a clue how to continue, I've tried
for hours and hours to make it work, but didn't succeed :(
Any suggestion on improving and other enhancment for a good form
validating class is really really appreciated.

TIA,
Nicholas


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




RE: [PHP] setcooke(...) before header(Location: XYZ) - Cookie doesn't set!

2003-01-21 Thread Rich Gray
Mike
IIRC this is a known bug with IIS (not PHP) when it gets the http redirect
it junks the cookie - sorry I can't remember much more detail than that...
Workaround maybe is to spit out an HTML based META refresh redirect tag
instead of using the header() call.
HTH
Rich

-Original Message-
From: Mike Potter [mailto:[EMAIL PROTECTED]]
Sent: 21 January 2003 15:35
To: [EMAIL PROTECTED]
Subject: [PHP] setcooke(...) before header(Location: XYZ) - Cookie
doesn't set!


HELP!
I know I'm new at this so please don't laugh.  But I can't get this to work!
I am using Microsoft IIS with the latest PHP installed.
Here's a smple:

.
.
.
setcookie(testCookie, testValue, time() + 3600, /);
header(Location: http://newpage.php;);
exit;


Later, I pull the cookie:

echo $_COOKIE[testCookie];

and there is no value.  If I don't use the header function at the end, and
write something to the page, it works fine.
Why does this cookie not get set?

Thanks a ton!

Mike


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




RE: [PHP] Starting sessions, registering variables, destroying sessions with global_variables off....

2003-01-24 Thread Rich Gray
Phil
It should be as easy as ..
?
session_start();
$_SESSION['foo'] = 'bar';
?
You'll need a session_start() on all pages that will be using the
$_SESSION[] array.
Is your session.save_path pointing to a writable directory? Do you see any
errors in the server logs when you try to start a session?

Rich
-Original Message-
From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]]
Sent: 24 January 2003 13:36
To: [EMAIL PROTECTED]
Subject: [PHP] Starting sessions, registering variables, destroying
sessions with global_variables off


I just switched from a 4.06 server with global_variables ON to a 4.22
with global_variables OFF



Can someone give me a quick run down of how to set/unset variables and
register/destroy sessions with PHP 4.22 (global_variables OFF).



I've been all through the php.net manual and still can't figure it out.



I know that I have to use $_SESSION['foo'] instead of just $foo now, but
for some reason I can't get session_start(); to properly start a
session.



Any ideas??



Thanks!!



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




RE: [PHP] If... Else.. I'm not getting it!

2003-01-25 Thread Rich Gray
You are using the post method not get so $_GET[] should be empty.

Does this version of your code work?

?php
if(isset($_POST['submit'])) {
$vname=$_POST['vname'];
echo hello $vname;
} else {
?
form action=? echo ($_SERVER['PHP_SELF']); ? method=post
table
trtdInput yourname/tdtdinput type=text name=vname/td/tr
trtd colspan=2input type=submit name=submit/td/tr
/table
/form
?php
}
?

Rich
-Original Message-
From: Frank Keessen [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2003 11:33
To: Johannes Schlueter; [EMAIL PROTECTED]
Subject: Re: [PHP] If... Else.. I'm not getting it!


Hi,

Thanks, but i'm a kind of a newbie in PHP and what i've read it's better to
have the register_globals = Off!!! If you look at my code you see that i'm
using the $_GET variable.. This works fine!! It's the IF.. ELSE what gives
me a lot of trouble!

Frank


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




[PHP] Session data getting lost

2003-09-16 Thread Rich Gray
Hi

I'm running v4.2.3 on RedHat v7.0 and am getting some strange behaviour with
the $_SESSION superglobal... below is a script to demonstrate the problem...
Whenever the $_SESSION array gets re-created by session_start() the reloaded
test entry is set to -1 however at no time does this value ever get assigned
to the $_SESSION array ... it seems to be picking up the initialised value
of the variable that gets assigned to the array...

It works fine on Win2K albeit v4.3.0 of PHP.

Anybody come across this before?
Cheers
Rich



?php
session_start();
$test = -1;

echo 'htmlbodyInitial script load ... $_SESSION value is
'.(isset($_SESSION['test']) ? $_SESSION['test'].' it should be 999...' :
'not set yet').'br /';

$test = 999;

$_SESSION['test'] = $test;
?
form action=? echo $_SERVER['PHP_SELF'] ? method=post
input type=submit name=but value=do it
/form
?
echo 'br /After the assignment $test is '.$test.' and the $_SESSION value
is '.$_SESSION['test'].'br /';
?
/body
/html

The output from the 'initial script load' line is shown below ...

Initial script load ... $_SESSION value is not set yet (first time only)
Initial script load ... $_SESSION value is -1it should be 999... (all
subsequent submits)

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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Chris

Thanks for your answer which I'm sorry to say makes no sense to me given the
code example I supplied ... can you explain to me why you think register
globals being set to on for the Linux server will cause the $_SESSION
superglobal array to lose data? Am I missing something obvious here?

Thx
Rich

 --- Rich Gray [EMAIL PROTECTED] wrote:
  I'm running v4.2.3 on RedHat v7.0 and am getting some strange
  behaviour with the $_SESSION superglobal...
 ...
  It works fine on Win2K albeit v4.3.0 of PHP.

 Maybe you have register_globals enabled on your Linux server and
 not on your
 Windows PC? Compare php.ini files before giving it too much thought.

 Chris


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Jan
Sorry - no that doesn't help - as you can see from the code snippet I posted
the session_start() is at the very top of the code...
Thx anyway.
Rich

 You have to put session_start(); at the VERY TOP of your code.
 even before alle the html tags.
 Hope that helps!

 Jan

 --- Rich Gray [EMAIL PROTECTED] wrote:
  I'm running v4.2.3 on RedHat v7.0 and am getting some strange
  behaviour with the $_SESSION superglobal...
 ...
  It works fine on Win2K albeit v4.3.0 of PHP.

 Maybe you have register_globals enabled on your Linux server and
 not on your
 Windows PC? Compare php.ini files before giving it too much thought.

 Chris


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Jay

Thanks, but no I don't think so ... session_register() is deprecated ...

Quote PHP manual:

Caution:
If you want your script to work regardless of register_globals, you need to
instead use the $_SESSION array as $_SESSION entries are automatically
registered. If your script uses session_register(), it will not work in
environments where the PHP directive register_globals is disabled.

Cheers
Rich


 [snip]
 ?php
 session_start();
 $test = -1;
 .

 [/snip]

 I think you need to register test 

 http://us3.php.net/session_register

 HTH!


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
Well a functon that doesn't work under certain conditions should be
deprecated IMO ... I haven't used it for a long time now...

To answer your question ... yep I've used print_r() and after the 1st form
submission the entry is set to -1 however at no time do I ever set
$_SESSION['test'] to -1 in my code example ...

Rich

 [snip]
 Thanks, but no I don't think so ... session_register() is deprecated ...
 [/snip]

 Not depricated, just doesn't work when register_globals is off in the
 .ini

 Have you done a print_r($_SESSION) to see if in fact the $test variable
 is contained?


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



RE: [PHP] Session data getting lost

2003-09-17 Thread Rich Gray
So your telling me that all variables defined in the global scope are
automatically added to the $_SESSION array...?
Not true I think

 [snip]
 Well a functon that doesn't work under certain conditions should be
 deprecated IMO ... I haven't used it for a long time now...

 To answer your question ... yep I've used print_r() and after the 1st
 form
 submission the entry is set to -1 however at no time do I ever set
 $_SESSION['test'] to -1 in my code example ...
 [/snip]

 Nope, but $test is a GLOBAL variable, and therefore would be set to -1
 within $_SESSION as all GLOBALS are, as you pointed out earlier,
 registerd with $_SESSION. If $test is within a function it is a PRIVATE
 variable, local to the function only, unless declared as a GLOBAL.



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



RE: [PHP] Session data getting lost

2003-09-18 Thread Rich Gray

 * Thus wrote Rich Gray ([EMAIL PROTECTED]):
  Well a functon that doesn't work under certain conditions should be
  deprecated IMO ... I haven't used it for a long time now...

 this makes absolutly no sense. So if I use a function improperly,
 it should become deprecated?

Er ...I'm not using it improperly I'm just not using it at all. Why? Because
it behaves differently in different operating conditions. Sure I could write
extra code to detect the operating conditions but what's the point? If
globals are off you can't use it as it doesn't work... The manual seems to
make it pretty obvious to me that it should be avoided and even mentions the
function is deprecated in a code example...


 session_register() is used in cases where you haver register_globals
 on; it is not useed when it is off.

So are you happy to use session_register() in your code?

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



RE: [PHP] Session data getting lost

2003-09-18 Thread Rich Gray
 * Thus wrote Rich Gray ([EMAIL PROTECTED]):
  So your telling me that all variables defined in the global scope are
  automatically added to the $_SESSION array...?
  Not true I think
 

 no. read the documentation, in full.

you're right - I'm sorry I hadn't read it in full...


 The soluction to your problem was resolved from the first reply (by
 Chris Shiflett), but you rejected it because of it not making sense
 to you, which seems to be the problem.

Yes, however I was simply asking Chris to explain to me more as it didn't
make sense to me (because I hadn't read the manual fully). I mistakenly
expected the $_SESSION array to hold copies of assigned data not references
to the global namespace variable ... my expectations were based on PHP's
current default behaviour of pass by copy rather than by reference.

It seems with globals on it can become a minefield eg below where a script
happens to define and use a variable with the same name as an entry in the
$_SESSION array...

?
// script_a.php - developed by dev A
session_start();
$_SESSION['test'] = 'dev A saves some data';
header('Location : script_b.php');
?

?
// script_b.php - developed by dev B
session_start();
$test = 'I am another variable in the global scope that happens to have the
same name as a $_SESSION array entry';
print_r($_SESSION);  // dev B has just trashed dev A's saved data...
?

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



[PHP] Returning FORM vars from popup

2003-09-18 Thread Rich Fox
(Sorry, I inadvertently sent an incomplete post)

I have a popup window, itemSelect.php, from which I would like to reload the
calling page. itemSelect.php has a form, and I want to reload the calling
page with these form variables. How can I do this? I can reload the page
easily enough, with this test code in itemSelect.php:

form
 input type=hidden value=mine name=newparam
 input type=button value=Close
onClick=window.opener.location.reload();window.close()
/form

Not surprisingly, this doesn't work. My calling page reloads and the popup
closes, but the onClick code bypasses the form and newparam doesn't get
passed. What, please, is a good way to  accomplish passing newparam (and
other form vars) back to the calling page?

Many thanks,

Rich

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



[PHP] Returning form vars from popup

2003-09-18 Thread Rich Fox
I have a popup window, itemSelect.php, from which I would like to reload the
calling page. itemSelect.php has a form, and I want to reload the calling
page with these form variables. How can I do this? I can reload the page
easily enough, with

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



[PHP] Opening new browser window

2003-09-19 Thread Rich Fox
I would like to open a new browser window from within my php script
(edit.php), a window in which another php page is run (search.php).
search.php should be able to receive $_POST vars etc. from edit.php. I am
not sure that the javascript solution to popup a window is correct, because
then the popup does not behave normally.

By normally, I mean that when I use javascript to popup a new window
(search.php), and in search.php I have a form

form action=searchAction.php method=post
 input type=hidden name=caller   value=window.opener.location.href
 input type=hidden name=ID   value=? $_GET['ID'] ? 
 input type=hidden name=Type   value=? $type? 
 input type=button name=btnOKvalue=OK
 input type=button name=btnCancel   value=Cancel
/form

clicking OK or Cancel does absolutely nothing. So, I would like to avoid
javascript and simply open a new browser window to run search.php. What is
the accepted way to do this in php?

tia,

Rich

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



Re: [PHP] Opening new browser window

2003-09-19 Thread Rich Fox
And if you are not in a form? My current code is:

a href=search.php onClick=return popup(this,
'Industry','?ID=$companyIDType=Industry')
   img src=images/Plus.gif
 /a

where popup is my javascript function. But as I said below, the popup
doesn't work as expected and I do not want to use javascript. I can also not
be in a form. Suggestions?

Rich

Marek Kilimajer [EMAIL PROTECTED] wrote in message

 form target=searchwindow 


 Rich Fox wrote:

  I would like to open a new browser window from within my php script
  (edit.php), a window in which another php page is run (search.php).
  search.php should be able to receive $_POST vars etc. from edit.php. I
am
  not sure that the javascript solution to popup a window is correct,
because
  then the popup does not behave normally.
 
  By normally, I mean that when I use javascript to popup a new window
  (search.php), and in search.php I have a form
 
  form action=searchAction.php method=post
   input type=hidden name=caller   value=window.opener.location.href
   input type=hidden name=ID   value=? $_GET['ID'] ? 
   input type=hidden name=Type   value=? $type? 
   input type=button name=btnOKvalue=OK
   input type=button name=btnCancel   value=Cancel
  /form
 
  clicking OK or Cancel does absolutely nothing. So, I would like to avoid
  javascript and simply open a new browser window to run search.php. What
is
  the accepted way to do this in php?
 
  tia,
 
  Rich
 

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



[PHP] popups, parents, parameters, and php

2003-09-19 Thread Rich Fox
I have been asking specific questions, and getting helpful answers, but I
realized I am getting ahead of myself and thinking about the trees when I
don't see the forest yet. I would like to describe what it is I want to do
in general, and then hopefully you can point me in the right direction so I
use html, php, and javascript together in some kind of reasonable way. I
feel like I am re-inventing the wheel, and badly. What I want to do must
have been done a zillion times by other web programmers already.

I have a php page (edit.php) with a form with some text fields and a select
menu (select1). I want users to be able to add entries to the select1 menu,
and would like to use a popup window to do this. In the popup window, the
user is presented with a form with a select menu of all possible entries.
The user can make multiple selections from this list in the popup, and when
the popup's form is submitted, I want the select1 menu in edit.php to
reflect these additional entries selected from the popup.

Those are the requirements. Should be easy, but I am finding it very
difficult to tie the pieces together.

Any advice or url of a relevant tutorial would be greatly appreciated.
Thanks,

Rich

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



[PHP] Re: popups, parents, parameters, and php

2003-09-19 Thread Rich Fox
my colleague just suggested that my popup, on the form submit, can call
another page which just registers the items selected as session variables.
This seems like a good idea. Of course, I will have to reload the original
calling page, edit.php, so it can check those session varibles and amend the
select1 list. I am going to try this, but I would still greatly appreciate
any advice. Thanks, Rich

Rich Fox [EMAIL PROTECTED]

 I have been asking specific questions, and getting helpful answers, but I
 realized I am getting ahead of myself and thinking about the trees when I
 don't see the forest yet. I would like to describe what it is I want to do
 in general, and then hopefully you can point me in the right direction so
I
 use html, php, and javascript together in some kind of reasonable way. I
 feel like I am re-inventing the wheel, and badly. What I want to do must
 have been done a zillion times by other web programmers already.

 I have a php page (edit.php) with a form with some text fields and a
select
 menu (select1). I want users to be able to add entries to the select1
menu,
 and would like to use a popup window to do this. In the popup window, the
 user is presented with a form with a select menu of all possible entries.
 The user can make multiple selections from this list in the popup, and
when
 the popup's form is submitted, I want the select1 menu in edit.php to
 reflect these additional entries selected from the popup.

 Those are the requirements. Should be easy, but I am finding it very
 difficult to tie the pieces together.

 Any advice or url of a relevant tutorial would be greatly appreciated.
 Thanks,

 Rich

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



[PHP] Re: forcing variable expansion

2003-09-21 Thread Rich Fox
That's not Eugene from the dojo is it?

Rich


Eugene Lee [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 If I have a block of text saved in an external text file, e.g.:

 All {$badstuff} and no {$goodstuff} makes {$name} a dull {$type}.

 after reading the text into a string, is there a way to force variable
 expansion?  In a sense, it's like having a heredoc for multiline strings
 with variable expansion while not having the heredoc embedded in PHP code.

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



Re: [PHP] Re: forcing variable expansion

2003-09-22 Thread Rich Fox
Sorry, we have a Eugene Lee at my aikido school and it's such an unusual
name I thought you might be him.

Eugene Lee [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Sun, Sep 21, 2003 at 03:01:41PM -0400, Rich Fox wrote:
 : Eugene Lee [EMAIL PROTECTED] wrote:
 : 
 :  If I have a block of text saved in an external text file, e.g.:
 : 
 :  All {$badstuff} and no {$goodstuff} makes {$name} a dull {$type}.
 : 
 :  after reading the text into a string, is there a way to force variable
 :  expansion?  In a sense, it's like having a heredoc for multiline
strings
 :  with variable expansion while not having the heredoc embedded in PHP
code.

 Question already answered by another helpful soul: use eval().

 : That's not Eugene from the dojo is it?

 Hmmm?  What dojo?

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



[PHP] using a php variable in javascript

2003-09-22 Thread Rich Fox
I have a page with the following code:

?
$callerWin = $_POST['CallerWin'];
?
html
body
script type=text/javascript
!--
 so = window.open('','CompanyEdit');
 so.location.reload();
 window.close();
// --
/script
/body
/html

I have 'CompanyEdit' hardcoded, but what I want instead is something like:

so = window.open('','$callerWin');

This does not work, of course, but you get the idea: I want to use the value
of the $callerWin php variable in my javascript. Can someone tell me the
syntax for this? My reading of the documentation and trial-and-error have
not met with success.

thanks,

Rich

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



[PHP] for loop break and continue

2003-09-25 Thread Rich Fox
Hi,
Is there an equivalent to the C++ 'break' command to stop execution of a for
loop? I know I can use 'goto' but I don't want to unless I have to.

for ($i=0; $i$n; $i++)
if (some condition)
break;

And, what about 'continue' which skips the rest of the code in the for loop
and immediately goes on to the next iteration?

Thanks,

Rich

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



Re: [PHP] for loop break and continue

2003-09-25 Thread Rich Fox
DOH!

This is a new addition to PHP because it wasn't there before!

Thanks for the slap.


Robert Cummings [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Take the sample code below, paste it to a PHP file, add a real
 conditional, execute script. Voila, you've taken the first step towards
 helping yourself.

 Cheers,
 Rob.


 On Thu, 2003-09-25 at 11:42, Rich Fox wrote:
  Hi,
  Is there an equivalent to the C++ 'break' command to stop execution of a
for
  loop? I know I can use 'goto' but I don't want to unless I have to.
 
  for ($i=0; $i$n; $i++)
  if (some condition)
  break;
 
  And, what about 'continue' which skips the rest of the code in the for
loop
  and immediately goes on to the next iteration?
 
  Thanks,
 
  Rich
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 -- 
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'

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



Re: [PHP] for loop break and continue

2003-09-25 Thread Rich Fox
Can't you let me have a shred of programming self-respect?

Rich (I should have cracked the book) Fox

 On Thu, 2003-09-25 at 12:04, Rich Fox wrote:
  DOH!
 
  This is a new addition to PHP because it wasn't there before!
 
  Thanks for the slap.

 PHP has supported break for as long as I can remember which goes back to
 about 1999 and PHP 3.something.

 Cheers,
 Rob.

 -- 
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'

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



RE: [PHP] session id

2003-02-06 Thread Rich Gray
 -Original Message-
 From: Edward Peloke [mailto:[EMAIL PROTECTED]]
 Sent: 06 February 2003 13:56
 To: Php-General@Lists. Php. Net
 Subject: [PHP] session id


 Ok, I am sure this has been discussed but I have not been keeping up with
 the listserv.  I am using sessions so to test, I blocked all
 cookies and of
 course the sessionid is then in the url.  How can I hide it from the
 url?...or is this even possible?

 Thanks,
 Eddie

If you disable session.use_trans_sid in your php.ini then session id's will
not get passed via the url if cookies are being refused. But then of course
your session support is gone for that particular browser/user.

Rich


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




RE: [PHP] 4.0.6 to 4.3.0

2003-02-07 Thread Rich Gray

 Any thoughts as to why this snippet:

 25: if ($attach != none)
 26:  {
 27:$file = fopen($attach, r);
 28:$contents = fread($file, $attach_size);
 29:$encoded_attach = chunk_split(base64_encode($contents));
 30:fclose($file);

 would produce these errors:

 Warning: fread(): supplied argument is not a valid stream resource in
 /usr/virtual/share/pkgs/installed/aeromail/1.40/aeromail/send_mess
 age.php on line 28

 Warning: fclose(): supplied argument is not a valid stream resource in
 /usr/virtual/share/pkgs/installed/aeromail/1.40/aeromail/send_mess
 age.php on line 30

 After upgrading from 4.0.6 to 4.3.0


Most probably because with 4.3.0 register_globals is set to OFF by default -
where does $attach get set?

Rich


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




RE: [PHP] 4.0.6 to 4.3.0

2003-02-07 Thread Rich Gray
[snip]
  
   After upgrading from 4.0.6 to 4.3.0
  
 
  Most probably because with 4.3.0 register_globals is set to OFF
 by default -
  where does $attach get set?
 


 Nope, I do have register_globals on in php.ini

 Its being set in another file like this:
 form enctype=multipart/form-data name-doit action=send_message.php
 method=POST

 input type=file name=attach size=68

 It behaves like, if ($_GET['attach'] != none) or ($attach != none)
 is always true.

 If I attach something it goes through no prob, if I do not attach
 something
 it still goes through but with all the error messages and an
 empty attachment
 at the recieving end. Only thng that has changes was upgrading
 PHP from 4.0.6
 to 4.3.0

Hi Brian

Why are you using $_GET[] when your form is submitting via the 'post'
method? Secondly for file uploads why are you not using the $_FILES[]
superglobal array?

Rich


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




RE: [PHP] 4.0.6 to 4.3.0

2003-02-07 Thread Rich Gray
  Secondly for file uploads why are you not using the $_FILES[]
  superglobal array?
 
 I did not write the app, just trying to figure out why it stopped
 working after upgrading PHP. You think that's the problem?

Well try  ...

if (is_uploaded_file($_FILES['attach']['tmp_name'])) {
// Blah Blah Blah
}

Rich 

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




RE: [PHP] $_SESSIONS and printing off..

2003-02-18 Thread Rich Gray
Er... well I've seen a lot worse code than that but maybe you could use ...

if (isset($_SESSION['username'])  !empty($_SESSION['username'])) {
echo 'Welcome '.$_SESSION['username'].', you are still logged in.';
}
else {
header... etc etc
}

Rich
 -Original Message-
 From: Frank Keessen [mailto:[EMAIL PROTECTED]]
 Sent: 18 February 2003 09:00
 To: [EMAIL PROTECTED]
 Subject: [PHP] $_SESSIONS and printing off..
 
 
 Hi All,
 
 I'm a little bit confused and it's maybe a newbie question but 
 maybe you can help me out;
 
 A user is login in and after username password check it will 
 redirects to this page
 
 ?php
 session_start();
 if (isset($_SESSION['username'])){
 $username = $_SESSION['username'];
 echo 'Welcome, you are still loged in.';
 echo $username;
 }
 else{
 header ( Location: login.htm );
 }
 ?
 
 Question is; is this the way to print of his username?
 
 $username = $_SESSION['username'];
 Echo $username
 
 Or has anyone some alternatives..
 
 This is working o.k. but in my opinion it's a little bit quick and dirty?
 
 Thanks for the comments and suggestions!
 
 Frank

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




RE: [PHP] $_SESSIONS and printing off..

2003-02-18 Thread Rich Gray
Um... how about...

echo 'Welcome '.$_SESSION['username'].', you are still logged in and your
authentication level is '.(isset($_SESSION['level']) ? $_SESSION['level'] :
'unknown');

Or am I missing something here?

Rich

 -Original Message-
 From: Frank Keessen [mailto:[EMAIL PROTECTED]]
 Sent: 18 February 2003 12:15
 To: Rich Gray; [EMAIL PROTECTED]
 Subject: Re: [PHP] $_SESSIONS and printing off..


 Thanks,

 But then another question;

  if (isset($_SESSION['username'])  !empty($_SESSION['username'])) {
  echo 'Welcome '.$_SESSION['username'].', you are still logged in.';


 I want also checked if the level of authentication = 2; for example
 User Frank = level 1
 User Rich = level 2

 I've set $_SESSION['level'] to 2 but how can i check that with the above
 line?

 Thanks for your help,

 Frank


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




RE: [PHP] Block direct image loads but allow them in PHP

2003-02-19 Thread Rich Gray
[snip]
 
 if(isset($i))
 {
 //codeImageURL decodes $i into an image path that we can work with
 $link=codeImageURL($i);
 if($link!=  (isAdmin() || !isThisFileBlocked($link)))
 {
 header(Cache-control: private);
 header(Content-type: image/jpg);
 header(Content-Disposition: attachment; filename=.$link);
 $fp = fopen($link, 'r');
 fpassthru($fp);
 fclose($fp);
 }
 else
 echo Error: Couldn't decode image URLbr\n;
 }
Michael
Have you tried header('Content-type: image/jpeg') ?
Note the 'e'...
Rich


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




RE: [PHP] online tutorial

2003-02-19 Thread Rich Gray
 
 
 dear all,
 
 i am a final year engineering student and have
 started studying PHP since last 10 days.
 
 can anybody suggest some good online tutorial for mastering PHP?
 
 regards,
 diksha.
 
Hi Diskha

try these urls...

http://www.zend.com/zend/tut/
http://www.php.net/manual/en/tutorial.php
http://www.devshed.com/Server_Side/PHP


Rich

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




RE: [PHP] ftp browsing

2003-02-23 Thread Rich Gray
 -Original Message-
 From: Matt Palermo [mailto:[EMAIL PROTECTED]
 Sent: 23 February 2003 09:46
 To: [EMAIL PROTECTED]
 Subject: [PHP] ftp browsing


 I have a php script that is like and ftp client, only is just browsers the
 server and displays file names and folders.  If you click on the name of a
 folder that it displays, it will then display the files and folders inside
 that directory, and so on for all directories.  It works perfectly when I
 connect to my internet hosting company through ftp to browse, but
 it doesn't
 work right when I connect to my personal ftp server.  I have tried using
 both Serv-U and Bulletproof ftp servers to host my ftp site.  The script
 won't display my server correctly with either of these.  Can
 anyone give me
 some advice?  I would really appreciate it.  Thanks.

 Matt

What version of PHP are you running on your personal ftp server? Is your
personal server Win32? There was a bug with ftp_nlist()/ftp_rawlist() on
Windows that wasn't fixed till v4.3.x IIRC
Rich


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



RE: [PHP] ftp browsing

2003-02-23 Thread Rich Gray
 I am using Windows XP Pro, and I am using Serv-U to run my FTP server.
 It is just a server running from my machine.  Is it supposed to have PHP
 installed somewhere?

OK I've probably misunderstood - I assumed you were running your PHP scripts
locally - what platform are you running the PHP scripts on and what version
of PHP is it?

Rich


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



RE: [PHP] How do I display the script file name?

2003-02-27 Thread Rich Gray
 How can I display the script file name? Presumably something like-:

 ?php
 echo $ScriptFileName;
 ?

 While I'm learning php and developing various Web page versions, I want to
 be sure the that the display is from the appropriate script.

 Regards
 Stephen Ford, Surrey, UK

Try any of these to see if it is what you want - some are absolute some are
relative ...
?
echo $_SERVER['SCRIPT_NAME'].' '.
 $_SERVER['SCRIPT_FILENAME'].' '.
 $_SERVER['PHP_SELF'];
?

Rich


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



RE: [PHP] Counting table fields having specific values

2003-02-27 Thread Rich Gray
Mike

Try ...
?
$res = mysql_query('select count(*) from names where not hide');
$row = mysql_fetch_row($res);
echo $row[0];
?

Rich
 -Original Message-
 From: rentAweek support [mailto:[EMAIL PROTECTED]
 Sent: 27 February 2003 17:32
 To: [EMAIL PROTECTED]
 Subject: [PHP] Counting table fields having specific values
 
 
   I have a table where the row named hide can have a value 0 or 1.
 I want to obtain a count of all the rows where hide has value 0.
 
 The following works on mysqladmin:
 
 SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, - 1 
 
 Giving
 
 SUM( hide = 0 ) 
 7
 
 The PHP script statements generated are:
 
 $sql = 'SELECT SUM( hide = 0 ) FROM `names` LIMIT 0, -1';
 $result = mysql_query($sql);
 
 What assignment statement do I need to write now to obtain the SUM value 
 as shown by mysqladmin please?
 
 TIA
 
 Mike
  
 
 
 
 
 
 -- 
 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] Automatically included file?

2003-02-27 Thread Rich Gray
 New to PHP, I was wondering if PHP, running as a module under Apache 2,
 had an automatically included script that would run prior to any/each
 PHP script served by Apache?

 Tks,
 Dwayne

Dwayne
Look into the auto_prepend_file directive that you can specify in php.ini -
this may suit your needs.
Cheers
Rich



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



RE: [PHP] Destroying COM objects

2003-02-27 Thread Rich Gray
 When using the COM functions in PHP what is the equivalent of 
 ASPs set object=nothing?
 I am using the Crystal Report objects and I cannot seem to 
 destroy my Report object.

Have you tried setting it to NULL?
Rich


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



RE: [PHP] Get variable from PHP before submit

2003-03-01 Thread Rich Gray
 I'm trying to implement the following functionality into the file 
 test.php:
 
 When I scroll down the page and then hit a button, the page 
 should remember
 the scrolled position, refresh the page and then scroll down to the
 remembered position. I've almost managed to make this work, but 
 only almost.
 
 The first time I click one of the buttons, the page won't scroll, 
 but after
 that it works fine. I think the reason for this is that the function
 hentKoordinat() gets called before $teller is set. hentKoordinat() uses
 $teller.
 
 Anyone know a way to make this work?
 
 Thanks alot!
 
 Lars

I've probably misunderstood but can you not use an HTML anchor...?
Rich


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



RE: [PHP] Parse exec output

2003-03-01 Thread Rich Gray
 
 If I exec a command like ifconfig, I'd like to be able to parse.  What is
 the best way to go about thihs?  An example output from ifconfig is:

Check http://www.php.net/manual/en/function.passthru.php

Rich

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



RE: [PHP] php.ini

2003-03-01 Thread Rich Gray
 I run the following script:
 
 ?
 phpinfo();
 ?
 
 // the page loads o.k. when the semi-colon remains as in:
 ;extension=php_gd2.dll
 
 but if I remove the semicolon as in:
 
 extension=php_gd2.dll
 
 the page won't load and the server hangs up.
 ..
 
 \\ this is my php.ini file on MS Win 98/ PHP/ Apache
 
 
 ; Directory in which the loadable extensions (modules) reside.
 extension_dir = C:\PHP\
 
 ; Whether or not to enable the dl() function.  The dl() function does NOT
 work
 ; properly in multithreaded servers, such as IIS or Zeus, and is
 automatically
 ; disabled on them.
 enable_dl = On
 
 extension=php_gd2.dll
 ...
 
 Any advice on how I can install GD libraries greatly appreciated.
 Thank you.
 Tony Ritter

Hi Tony

Still battling GD I see :)

Are there any errors in the Apache error.log?

What happens if you change your php.ini directive to ...

extension_dir = C:/php/extensions

HTH
Rich


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



RE: [PHP] mysql replication + mysql_pconnect

2003-03-01 Thread Rich Gray
 hi there i am setting up a test replication slave server as a mysql db
 master backup if it fails , i would like to know how to
 dynamically connect
 to the slave if the master fails , something really strange i have set the
 host like localhost:3307 for the slave but is still connecting to
 the master
 , and if i shut down the master it wont goto the slave :|



Not sure I understand ... are you saying that
mysql_connect('localhost:3307','user','password') connects to the master
server? Can you describe the problem in more detail?

Rich


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



RE: [PHP] php.ini

2003-03-01 Thread Rich Gray
 Rich,
 I've checked my php.ini files on my drive and all I've got is one.

 The php_gd2.dll file is in:

 C:/PHP/extensions

 There was no default folder called extensions when I installed
 PHP so I made
 a directory called extensions under PHP.

 Everytime I take out the semicolon in the .ini file, the page
 won't load and
 I've got to shut down Apache server manually.

 If I put the semicolon back in, the page loads fine.

 I don't have a clue.  Somewhere between the .ini file and Apache something
 is very screwed up.

 TR

You said in your earlier post that in your php.ini your extension_dir is set
to C:\PHP\ - this is wrong it should be c:/php/extensions
If the extensions directory was not there and you had to create it manually
then where did you get the php_gd2.dll from?
The extensions sub-directory should be there for a normal installation - did
you install from zip?

Rich


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



RE: [PHP] Random not working?

2003-03-01 Thread Rich Gray
 Hi All,

 I'm trying to get a random record each time this script runs;
 Only it's giving me everytime the first record back.. No random at all..

 // generate and execute query
 $query = SELECT stedenid, naamstad, stadomschrijvk FROM steden
 ORDER BY RAND() LIMIT 1;
 $result = mysql_query($query) or die (Error in query: $query. 
 . mysql_error());
 $row = mysql_fetch_object($result);
 echo $row-naamstad;


 Version info;

 PHP 4.3.1
 Mysql 3.23.54

 When i'm trying to excute the SELECT statement in phpmyadmin; i'm
 only getting the first record back and when i'm taking off the
 LIMIT 1 it will display all the records in ascending order so
 also not in random..


 Regards,

 Frank


Frank

This really belongs on the MySQL list but there was a known issue with
RAND() on 3.23.54 - can you upgrade? If your table has an auto_increment ID
column then a workaround would be to use rand() in PHP to generate a random
ID then use that with a 'where id = '.$id in your query...

HTH
Rich


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



RE: [PHP] PHP on IIS session problems

2003-03-03 Thread Rich Gray
 I get these errors from a simple session_start(); script.

 Warning: session_start() [function.session-start]:
 open(/tmp\sess_f4aa3ef3c537bb6327d5e7b991e91be7, O_RDWR) failed: No such
 file or directory (2) in c:\inetpub\wwwroot\picoblog\admin.php on line 2

 Warning: session_start() [function.session-start]: Cannot send session
 cookie - headers already sent by (output started at
 c:\inetpub\wwwroot\picoblog\admin.php:2) in
 c:\inetpub\wwwroot\picoblog\admin.php on line 2

 Warning: session_start() [function.session-start]: Cannot send
 session cache
 limiter - headers already sent (output started at
 c:\inetpub\wwwroot\picoblog\admin.php:2) in
 c:\inetpub\wwwroot\picoblog\admin.php on line 2


Your php.ini still has the default /tmp session save path which is OK on
Unix but squawks on Win32. So you will need to reset the directive
session.save_path to c:\temp or any other valid scratch directory on your
windows machine you will probably also need to bounce IIS as well to
pick up the new settings if your running as an ISAPI module

The second and third errors are a knock-on effect of the 1st problem so fix
the bad session temp directory and they will probably disappear.

HTH
Rich


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



  1   2   >