php-general@lists.php.net

2002-11-09 Thread Rich
PHP$B=i?4http://www.mydomain.com$B$G%;%C%7%g%s$r3+;O$7!"$=$N8e!"(B
(Bhttps://www.mydomain.com/regist.htm$B$X0\F0$7$?$H$-$K!"%;%C%7%g%s$O7QB3$5(B
$B$l$k$N$G$7$g$&$+!)(B
(B
$BJL%5!<%P!<$X0\F0$9$k$H%;%C%7%g%s$O=*N;$9$k$HJ9$-$^$7$?!#%I%a%$%sItJ,$,F1(B
$B$8$G$b(Bhttps://$B$K$J$k$3$H$G!"JL%I%a%$%s$H$7$FG'<1$5$l$k$N$G$O$J$$$+$H?4G[(B
$B$7$F$$$^$9!#$^$@(BSSL Cert$B$rGc$C$F$$$J$$$N$G!"%F%9%H$G$-$J$$$N$G$9!#(B
(B
$B$h$m$7$/$*4j$$CW$7$^$9!#(B
(B
$B:d!!N<2p(B
(B
(B
(B-- 
(BPHP General Mailing List (http://www.php.net/)
(BTo unsubscribe, visit: http://www.php.net/unsub.php



[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:
 $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?



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




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



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

2002-11-23 Thread Rich Gray
Ken

Do *not* use hidden form statements or cookies to store any SQL this is
extremely dangerous and a relatively simple hack could destroy your database
completely!

By all means use hidden form fields to store row ID values but your PHP
scripts should treat all user input data via $_GET/$_POST/$_COOKIE/$_FILES
as hostile and you should be rigorous in validating that data coming into
your script is as you would expect...

Having said that it seems your server has magic_quotes_gpc() switched on -
this automatically escapes all incoming data that could upset a SQL query
i.e. the quotes - you can remove them by using stripslashes() or switch off
magic quotes in your php.ini file. But I would repeat *don't* continue down
the path you are going unless you like being hacked!

HTH
Rich
-Original Message-
From: Ken Nagorski [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 11:52
To: [EMAIL PROTECTED]
Subject: [PHP] using cookies


Hi there,

I have never used cookies before, however I am trying to implement them to
make things a little more secure. Rather than passing a sql statement via a
hidden input tag I am setting a cookie. This works fine except that when I
look at the sql after it is pulled from the cookie everything is escaped,
for instance.

SELECT * FROM inventory WHERE name='Watches'
  would become
SELECT manufacturer FROM inventory WHERE name=\'Watches\'

This is a problem cause trying to use preg_replace doesn't seem to work. I
get an error saying that the delimeter must not be a \. What a bummer. I am
a little stuck. I will take any suggestions. Maybe I am just going about
things the wrong way. *** Shrug ***

Thanks
Ken




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




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




RE: [PHP] using cookies

2002-11-23 Thread Rich Gray
Try the system() or passthru() functions...

Rich
-Original Message-
From: Paul Marinas [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 13:09
To: Rich Gray
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] using cookies



dose anyone how to send a "ping" in local network

thanks

Paul Marinas
Technical Support
RDS Craiova


Phone:  +402-51-410-194
Mobile: +407-22-451-439
Fax:+402-51-416-579
www.rdsnet.ro
.

Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this
message (or responsible for delivery of the message to such person), you may
not copy or deliver this message to
anyone. In such a case, you should destroy this message and kindly notify
the sender by reply e-mail.



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

2002-11-23 Thread Rich Gray
Is your register_globals setting set to Off? This is the default setting in
v4.2.x upwards.

Rich
-Original Message-
From: Craig Edgmon [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 11:43
To: [EMAIL PROTECTED]
Subject: [PHP] Passing Variables


I am sure this question has been answered, but there is a ton of data to
sift through on this. I am running Apache 1.3 and the latest PHP 4.2.3. .
I am just working with variables and I cannot seem to get them to pass from
my html file to the php call. I will get the html portion fine, but not the
variable. I have checked my language and have compared my files with
supposed good code from a reliable source with the same results. Any idea on
this. It happens on multiple systems.



--
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] getting mysql dump using php

2002-11-23 Thread Rich Gray
Answer is No. 2)

Use cron to run the mysqldump utility instead of a php script.
Let me know if you need more info.

Cheers
Rich

-Original Message-
From: See Kok Boon [mailto:[EMAIL PROTECTED]]
Sent: 23 November 2002 07:35
To: PHP
Subject: [PHP] getting mysql dump using php


hi,

can anyone tell me how to make auto backups of mysql databases?

i have a particular database that i want to backup everyday. what i can
think of now is to use crontab to execute a .php that will do the work, then
send the db schema (dump) via email every midnight.

however, i do not know the code to GET THE DUMP of the mysql db.

i know that i can be done because phpAdmin from sourceforge.net has the
export feature, which does what i want, except that i cannot execute the
hyperlink there using crontab.

can someone tell me:
1. what is the php code for getting the schema?
2. what is an alternatively BETTER way to backup?

thanks in advance

Yours sincerely,
See Kok Boon
-
looking for - jobs? career? customer?
look in realPortal!
http://realportal.realizecreations.com


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




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




[PHP] File upload on Win2k ...

2002-11-26 Thread Rich Gray
PHP v4.2.3
Win2K Sp2
Apache v1.3.24

I'm testing some file upload code for a image library type site and the file
upload keeps failing... here's some code to explain what the issue is...

Uploaded' :
'Not Uploaded');
?>

This outputs the following:-

Array ( [userpic] => Array ( [name] => garden.jpg [type] => image/pjpeg
[tmp_name] => C:\\WINNT\\TEMP\\phpC0.tmp [error] => 0 [size] => 59501 ) )
Not Uploaded

The copy() function works in that the temp file is copied to c:\test.jpg.

So why is is_uploaded_file() returning false?

TIA
Rich


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




RE: [PHP] File upload on Win2k ...

2002-11-26 Thread Rich Gray
Don't bother to respond people... worked out the issue - the double
backslashes in the name...
Cheers
Rich
-Original Message-
From: Rich Gray [mailto:[EMAIL PROTECTED]]
Sent: 26 November 2002 21:14
To: [EMAIL PROTECTED]
Subject: [PHP] File upload on Win2k ...


PHP v4.2.3
Win2K Sp2
Apache v1.3.24

I'm testing some file upload code for a image library type site and the file
upload keeps failing... here's some code to explain what the issue is...

Uploaded' :
'Not Uploaded');
?>

This outputs the following:-

Array ( [userpic] => Array ( [name] => garden.jpg [type] => image/pjpeg
[tmp_name] => C:\\WINNT\\TEMP\\phpC0.tmp [error] => 0 [size] => 59501 ) )
Not Uploaded

The copy() function works in that the temp file is copied to c:\test.jpg.

So why is is_uploaded_file() returning false?

TIA
Rich


--
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] Newbie : How work with parameters?

2002-11-27 Thread Rich Gray
Stephane

http://www.php.net/manual/en/security.registerglobals.php

http://www.php.net/manual/en/faq.php

Substitute 'fr' for 'en' if your prefer it en francais

Use: $_GET['id'] or $_REQUEST['id']

Ciao
Rich
-Original Message-
From: Stéphane Génin [mailto:[EMAIL PROTECTED]]
Sent: 27 November 2002 08:58
To: [EMAIL PROTECTED]
Subject: [PHP] Newbie : How work with parameters?


Hello,

I want to read the parameters in the URL, but I can't find the right way to
do that. I've tried several things :

my URL is:  http://localhost/test.php?id=abc

I tried to use the $id, but in this case, I have a notice with 'undefined
variable'.
I have the same problem if I try the variable $QUERY_STRING (still undefined
variable).

Do you know what is the best way to read this parameters?

Many thanks
Stéphane



--
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] Newbie Mail() Question...

2002-11-27 Thread Rich Gray
Er yea - just call the mail() function at the appropriate time in your
script...

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

However IMO if you need to log this sort of information then using a
database is far more appropriate than sending emails - especially on a busy
site...

Rich
-Original Message-
From: Chase [mailto:[EMAIL PROTECTED]]
Sent: 27 November 2002 14:24
To: [EMAIL PROTECTED]
Subject: [PHP] Newbie Mail() Question...


Is there a way to have an email sent to a specified email address either
when a page is accessed, or when a file is downloaded?

Maybe I should just be logging the info into a table?

Basically, I am trying to set up a secure site that would send the sysadmin
an email when a file has been downloaded with reference to the page title
and/or filename.

I have a feeling that this may be a bit too complicated for a newbie like
me...

...Suggestions?


Chase




--
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] ignoring client supplied session data

2002-11-27 Thread Rich Gray
I know I'm late in on this thread but 

Ignoring cookies is easy - just don't set them and don't use any data in
$_COOKIE[]... or am I missing your point?

$_COOKIE[] data should be treated with far more caution than $_SESSION[]
i.e. it should be treated as hostile data. If you really have to recognise
users coming back to your site after their session has timed out then store
the bare minimum in the cookie e.g. an encrypted User ID. You can then use
that to look up their information in a database table and deal with their
profile accordingly. Users can switch off cookie support at any time or
delete/tamper with cookies so don't make your code reliant on the stuff
stored in them...

In effect it is up to you what you save and process from persistent
cookies...

HTH
Rich

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I'm not worried about them using the query string for malicious purposes- I
have register_globals off... I'm worried about someone messing with their
cookie and sedding authorized to true- that _will_ change my $_SESSION
variable, unless I can find some way to ignore cookies, which brings us back
to my original question- how do i ignore all client input, _especially_
cookies??


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




RE: [PHP] session problems again

2002-11-27 Thread Rich Gray
Jason

session.cookie_lifetime set to 0 means the session cookie persists until the
client browser is closed...

I'm not clear if you are still having session problems now or the advice you
got earlier sorted it?

Rich
-Original Message-
From: Jason Romero [mailto:[EMAIL PROTECTED]]
Sent: 27 November 2002 15:09
To: [EMAIL PROTECTED]
Subject: [PHP] session problems again


--when using session registered variables
--i can only get them to save as session variables for one page
--then on the next page they are gone
--far as i can tell the variables are not getting written over or unset
--and the session is not gettting destroyed
--any other ideas what it might be?

i tried the seggestions you guys had
and i came up with one more question
does the session cookie.cookie_lifetime have anything to do with the amount
of time that session variables can be stored
the session.use_cookies is on and register.globals is turned on
however session.cookie_lifetime is set to 0
so would this affect the session variable lifetime?




--
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] Bizarreness with htmlentities() and other things

2002-11-28 Thread Rich Gray
Hi James
There is a bug in PHP for the capitalisation problem
http://bugs.php.net/bug.php?id=14655
If you check the link then a workaround was posted by someone.
HTH
Rich
-Original Message-
From: James Coates [mailto:[EMAIL PROTECTED]]
Sent: 28 November 2002 13:11
To: [EMAIL PROTECTED]
Subject: [PHP] Bizarreness with htmlentities() and other things


Hello!

I'm currently doing some work that requires a mySQL database of actor
names. For all my actors, I have three columns; first_name, last_name and
between_name. Because between_name can be written in many ways ("Peter van
Wibble" or "Fred d'Angelo), and the French have a habit of writing their
surnames in capitals, I wrote a little function to prepare the actor names
for output:



Thing is, I'm getting bizarre behaviour where some characters become
modified in a way I don't like - in particular, when the letter L follows
an E with a diaresis (Raphaël, for example) it becomes upper case.
Suggestions, anyone?

And if anyone wants to make that code shorter and more readable, I'd
appreciate it greatly. :-)

James.
xx


--
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] 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 "No categories currently available.";
  }
  else
  {
//create table
echo "";
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---


Send the file: 


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_size";
}else{
echo "some error has occured while uploading the file
$userfile_name";
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=TRUE&name=1&from=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 

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

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

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?




Input yourname





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




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:
>  method=POST>
>
> 
>
> 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
> 
>  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 URL\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-:
>
>  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 ...


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


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



RE: [PHP] quick echo output

2003-03-03 Thread Rich Gray
> Ok most all programs I see they use 
> within the html.
> Now I have always used the shortened version  Is
> there a reason
> why I should not use this?  I've never had any problems with this way of
> doing things, but I just don't see anyone else using that format..

I think it's because the '=$blah' syntax relies on short tags ...
and short tags can upset XML parsers... as a result short tags aren't
supported by all hosting providers  so your code could break if ported
to another site...

Cheers
Rich


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



RE: [PHP] question about smarty

2003-03-04 Thread Rich Gray
> just wondering... does smarty have to be installed on the server where the
> web site or php scripts it makes are going to be ran... or do you
> just make
> the stuff and put on the server like normal php files...

No, the Smarty classes and plugins will have to be installed/accessible on
the target server. It can be outside the document root though if it bothers
you...

HTH
Rich


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



RE: [PHP] submit button

2003-03-06 Thread Rich Gray
> hi everybody,
> 
> i have a PHP script by name registration.php
> in which i have a submit button at the bottom.
> the form in this script is sent to p.php by "GET".
> but on clicking the submit button, nothing happens
> attaching registration.php.
> 
> p.php has only the following:
>  echo "hi how are u";
> ?>
> 
> please help,
> diksha.

Can you post the form code?
Rich

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



RE: [PHP] Uploading file problem

2003-03-06 Thread Rich Gray
> I'm very new to PHP, so I hope no one is offended by reading my very basic
> questions.
>
> I have created a web form that saves some data to a database and uploads
> three files, copies them to a new directory, and renames them.  From my
> work machine and home machine, it works great for me - there are never any
> errors.  When my boss tries it, two of the files work fine, but the other
> fails at the copy.  I have watched him do it, and it's not user error.
> What could the problem be?  I'm stumped!
>
> I can include code or links if needed.
>
> Thanks,
> Amanda

>From what you say above I'd check the permissions on the 3rd target
directory to check if it allows writes by the web server process. Are all 3
files going into the same directory? Is the server *nix or Windows?

Rich


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



RE: [PHP] Uploading file problem

2003-03-06 Thread Rich Gray
> Thanks!!  I'll give that a try!
> 
> On Thu, 6 Mar 2003, 1LT John W. Holmes wrote:
> 
> > > Well, I have a statement that says:
> > > 
> > > if ([EMAIL PROTECTED]($photo, $long_path . "speakers/" . $photo_name)) {
> > > echo an error
> > > }else{
> > > proceed with renaming the file
> > > }
> > > 
> > > The error that is echoed after the copy is the one that pops 
> up.  So, it
> > > could be some other problem, but I'm not sure what to look for.
> > 
> > Take out the @ sign so you can see what the PHP error message is. 
> > 
> > ---John Holmes...

Try using move_uploaded_file() as well...
Rich 

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



RE: [PHP] MySQL Alias and PHP

2003-03-07 Thread Rich Gray
> Hi all,
>
> I have this query:
>
> SELECT a.area_name, b.area_name FROM tbl_1 x, tbl_2 a, tbl_2 b
> WHERE x.area_1 = a.id
> AND x.area_2 = b.id
>
> I am using PEAR DB to get my results as an ASSOC ARRAY. How do I echo
> the values for a.id and b.id?
>
> Thnks
> Charles
>

I presume you mean area_name...

Try this -> SELECT a.area_name as area_a, b.area_name as area_b FROM tbl_1
x, tbl_2 a, tbl_2 b
Then you can refer to the columns as $array['area_a'] and $array['area_b']

HTH
Rich


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



RE: [PHP] Persistent values between executions

2003-03-10 Thread Rich Gray
>
> I have some sets of values that I have stored in several tables in a mySQL
> database.  These don't often change, but are referenced on every
> single page
> view.  While each call is quick, as a gross the load on the server is too
> high.  I would like to know if there is a way to have these sets of values
> remain persistent in the server's memory between calls from browsers, like
> environment variables, to reduce the back and forth calls to
> mySQL.  As the
> data from the calls are almost always the same, it would seem easier this
> way.
>
> Any thoughts?  Comments?  RTFM suggestions?
>
> Mike
>
Use a 404 handler to build static html pages from the database. To refresh
the content just delete the static content - this could be done
automatically at predetermined intervals using cron or similar.

FFT
Rich


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



RE: [PHP] file

2003-03-28 Thread Rich Gray
> hi all!
>
> i have a simple program to open and write a file.
> but the file is not getting created.
> can anyone please spot the mistake?
> giving the code below.
>
> thanks a lot,
> diksha.
>
>  echo"hi?how are u doing??";
> $fp = fopen ("sandrew.html", "w");
> string="hii am
>
> fine";
> $contents=fwrite($fp,string);
> echo "'$contents'";
> fclose($fp);
> ?>

Hi Diksha
Some comments...

. Your string variable needs to be defined and referenced as $string not
just string  - unless this is a typo in your post
. fwrite() returns an int - you are assigning this int to $contents - what
exactly are you expecting $contents to be set to?
. Does your user or web server process have the permissions to create files
in the directory?
. What does readfile('sandrew.html'); after your fclose($fp) return?

HTH
Rich


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



RE: [PHP] string replace problem!!

2003-03-28 Thread Rich Gray
> Good day ,
> 
> I have the following string.
> ,slideimages[0],slideimages[1],slideimages[2]
> Wich starts with a ','. No my problem is i want to strip
> this first and only the first ','.
> 
> i've tried 
> $string = ",slideimages[0],slideimages[1],slideimages[2]";
> $string = preg_replace('/^./','',$string,1);
> 
> wich results in slideimages[0]slideimages[1]slideimages[2]
> Can somebody help me out here??
> 
> thnx
> Thijs

$string = substr($string,1);

Rich

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



RE: [PHP] Time stamp and changing to a date.

2003-03-28 Thread Rich Gray
> $mydate = "20030328231154";
>
> $myPrintDate=date ("l dS of F Y h:i:s A",$mydate);
>
> echo "$myPrintDate";
>
> Whats wrong

$mydate should be a unix style timestamp not  a MMDDHHMMSS type
date/time format...
Check the functions time() and mktime() to help you generate unix
timestamps.

HTH
Rich


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



RE: [PHP] Microsoft SQL Server varchar(500) field text concatenated at 255 characters.

2003-03-28 Thread Rich Gray
> Hi There.
>
> I am using PHP 4.3.0 on WIN32 to query data from a Microsoft SQL Server.
> One field I am requesting is type VARCHAR size 500. For some reason, PHP
> is returning only the first 255 characters of the text from that field.
>
> If I change the field type to TEXT, all of the data in that field
> is returned.
>
> Unfortunately, an ASP application is also using that database,
> and when I change
> the field type to TEXT, it pukes completely.
> I would rather try to resolve the issue in PHP than waste my time
> looking at ASP code.
>
> Has anyone got an idea why this might be hapenning?
>
> Many thanks.
>
> Scott

Hi Scott

I believe this is a problem because of the relatively old TDS libraries used
by native access methods...

Possible workarounds are...

. cast the data to TEXT before returning it
. use ODBC which doesn't have this problem IIRC

HTH
Rich


-- 
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] easy things - forms, variable sending

2002-11-22 Thread Rich Gray
Hi
Some suggestions below...
Cheers
Rich

>This is a trivial question - what function can I use to automatically
>proceed to some link, one that can be executed without any user input.

header('Location: http://www.newurl.blah')
 
>How can we, most efficiently, send all the data (variables) from one
>page to another?

Many ways... here's some ... Query string, Sessions, Form Post hidden vars 

>Also, would you happen to know, as PHP is very often used in forms, how
>to generate a radiobutton, which when clicked upon automatically
>proceeds and does not need a Submit button? 

use javascript - onclick="this.form.submit()"




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




RE: [PHP] session trouble

2002-11-22 Thread Rich Gray
I don't know which version of PHP you are using but if v4.2.x upwards then
use session_start() and the $_SESSION[] superglobal array instead of
session_register(). Your warning is because you have either started output
of HTML or you have some blank lines in your PHP scripts before the session
related calls were made.

HTH
Rich
-Original Message-
From: empty [mailto:[EMAIL PROTECTED]]
Sent: 22 November 2002 14:22
To: [EMAIL PROTECTED]
Subject: [PHP] session trouble


hi guys ;

 I can't use session bla..as on my site.
PHP Code

...

Warning: Cannot send session cache limiter - headers already sent (output
started at D:\sites\inc\register.inc:23) in D:\sites\uyelik\login.php on
line 90

I cant understand and solve the warning message, what is it?

thanks all.


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




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




[PHP] Session 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



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

$test = 999;

$_SESSION['test'] = $test;
?>



After the assignment $test is '.$test.' and the $_SESSION value
is '.$_SESSION['test'].'';
?>



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





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


 
 


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


 
  >
  >
 
 


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:


   
 

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

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





<!--
 so = window.open('','CompanyEdit');
 so.location.reload();
 window.close();
// -->




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



  1   2   >