[PHP] Re: Validating Subdomain E-mail Addresses Using Regular Expressions

2003-09-10 Thread Ivo Fokkema

"Jami Moore" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have been trying all weekend to get this right, and so far it does not
> validate an e-mail address with a subdomain.
>
> -- Code --
>
> $empatt =
> "^[_a-z0-9-]+(\.[_a-z0-9-]+)[EMAIL PROTECTED](\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
>
>  if(eregi($empatt, $email))
>{
> //do stuff
>}
>
> -- End Code --
Try this pattern (which I use):

"[EMAIL PROTECTED],4}$"

HTH,

Ivo

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



Re: [PHP] Encrypt/Serialize Source Code for Sale

2003-09-09 Thread Ivo Fokkema
Hi,

I've actually been looking for this kind of things for a while as well.
However, I would not want my client to install something to uncode the
scripts (probably causing the scripts to be unencoded easier). I found
these:

PHP OBFUSCATOR
http://richard.fairthorne.is-a-geek.com/utils_obfuscate.php

Phrozen
http://sourceforge.net/projects/phrozen/

POBS
http://pobs.mywalhalla.net/

Anyone have any recommendations or experience with any?

--
Ivo


"Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Take a look at Turck MMCache (free) and Zend Encoder (not).
>
> http://www.turcksoft.com/en/e_mmc.htm
> http://www.zend.com/store/products/zend-encoder.php
>
>
>
> On Saturday 06 September 2003 01:59 pm, Charles Kline wrote:
> > What methods are available (ups and downs) for encrypting and
> > serializing php applications for sale?
> >
> > Thanks,
> > Charles

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



Re: [PHP] -f function ???

2003-09-09 Thread Ivo Fokkema
[snip]
 Does this parameter have anything to do with the -f option of the
Unix/Linux sendmail command?
[/snip]

I'm not a linux expert, but as far as I know, it's the same. It allows users
to set the Return-Path header with the mail() function, but this is
disallowed when your PHP is set to safe_mode.

HTH,

Ivo

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



[PHP] Re: accessing $GLOBALS values

2003-09-02 Thread Ivo Fokkema
"Dennis Gearon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

[snip]

> One thing I'm a little confused about is the usage of $GLOBALS array, in
> this manner:
>
>$GLOBALS[SOME_NAME].
>
> I thought that it should be:
>
>$GLOBALS['SOME_NAME'].
Hi,

You should use quotes to tell PHP it's a string you're using as a key of
$GLOBALS. However, when not using quotes PHP will first look for a constant
with that name. If PHP can't find any, it will assume it's a string. So not
using quotes might lead to problems when you use the name of a constant as a
key.

I hope this is clear, more info can be found at
http://www.php.net/manual/en/language.types.array.php and scroll down to
'Array do's and don'ts' -> 'Why is $foo[bar] wrong?'

HTH,

Ivo Fokkema

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



Re: [PHP] PHP Interview questions

2003-08-27 Thread Ivo Fokkema
"Gabriel Guzman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Tue, 2003-08-26 at 10:00, CPT John W. Holmes wrote:
>
> > PHP is server side, so it obviously cannot control light bulbs. Use
> > javascript.
>
> maybe the lightbulbs are connected to the server :)

as seems to be the case right here :

http://www.drivemeinsane.com/

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



Re: [PHP] Mail() Problem Sending

2003-08-19 Thread Ivo Fokkema
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Ivo Fokkema ([EMAIL PROTECTED]):
> > True! But actually, I' ve seen people using only the 'From:' header to
send
> > mail. Emails can then be dropped easily by servers thinking it is spam.
> No email server should drop mail.
Yet they seem to do...? Maybe dropped is not the right word?
Clients may not receive emails which lack certain headers, as these emails
are regarded spam by certain ISP's.
Some people never even get 'normal' Outlook emails which are BCC'ed to them.
The cause? Beats me... Somewhere, something, blocks/drops/deletes these
emails...

> > Ben, I don't know what headers you send, but you could try these
headers:
> >
> > $headers .= "Return-path: Name <[EMAIL PROTECTED]>\r\n";
> Sending this header is virtually a waste of time and effort, it
> will be ignored and set by the receiving smtp server, and on the
> very fist line.
Hmmm... I ofcourse noticed that if I don't use -f in the 5th mail argument,
return-path is something trashy like [EMAIL PROTECTED] Well, then
I delete that from my list...

> > $headers .= "Error-to: Name <[EMAIL PROTECTED]>\r\n";
> This wont guarantee errors to return to that email address.
No sh*t, I _never_ get bounced emails back although I set the reply-to and
error-to headers. Someone told me some SMTP's use this header so I took my
chances.

--
Ivo



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



[PHP] parse_ini_file() difference between empty value and Off?

2003-08-19 Thread Ivo Fokkema
Hi list!

I tried the manual, the web, the archives... maybe I'm not approaching this
correctly.

I use parse_ini_file() on a config.ini to fetch some settings the lame
people can set using my application. I want this config file to be as simple
as possible so that I won't get emails about things not working when this
open source application is released. I was thinking that leaving the value
of a directive blank would be good to set the default value... such as this:

; Whether or not to send reports about MySQL errors. Can be set to On, Off
; or Silent. Silent will send a report, but will not notify the user.
; Defaults to On.
send_db_errors =

would leave the setting 'On' because it's the default and a specific value
was not entered. I fill in the defaults by checking for empty values and
replacing them with the defaults for those directives.

However...

Setting something to 'Off' will also cause the value to be empty. So

send_db_errors =

AND

send_db_errors = Off

both return $config_ini_array['send_db_errors'] as a string(0) "". How can I
see this difference? I know the php.ini file quotes the directive for
default values to work. So :

;send_db_errors (note the ; at the start of the line)

returns $config_ini_array['send_db_errors'] as NULL, allowing me to see the
difference. But I think that might be too complicated for the future users
of the system. Should I use

send_db_errors = Default

or something? Any ideas on this? The default values may sometimes be a bit
more complex than just 'On' or 'Off', so I really need to see the difference
between a user requesting the Default value or setting it to Off.

TIA,

Ivo

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



Re: [PHP] Mail() Problem Sending

2003-08-19 Thread Ivo Fokkema
"Cesar Aracena" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
> For some e-mail servers, you have to write lots of "extra headers" in
> the e-mails in order to pass their guard.
[/snip]

True! But actually, I' ve seen people using only the 'From:' header to send
mail. Emails can then be dropped easily by servers thinking it is spam.

Ben, I don't know what headers you send, but you could try these headers:

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";
$headers .= "From: Name <[EMAIL PROTECTED]>\r\n";
$headers .= "Reply-to: Name <[EMAIL PROTECTED]>\r\n";
$headers .= "Return-path: Name <[EMAIL PROTECTED]>\r\n";
$headers .= "Error-to: Name <[EMAIL PROTECTED]>\r\n";

mail("Yourname <[EMAIL PROTECTED]>", "Subject", $body, $headers);



HTH,

Ivo



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



Re: [PHP] HTML equivalents of accented characters

2003-08-14 Thread Ivo Fokkema
"Liam Gibbs" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > I think php.net/htmlentities will do this.
>
> Apparently it *is*, but it won't for me. Any problems with this code?
>
> $result[] = "é";
> $result[1] = htmlspecialchars($result[0]);
> $result[2] = htmlentities($result[0]);
>
> Both return the accented E unchanged.
I bet they do, did you check the HTML source as well? My guess is that the
source is reading the actual expected output, but your browser views "é", as
it should of course.

HTH,

--
Ivo



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



[PHP] Re: Cache Question

2003-08-14 Thread Ivo Fokkema
Hi Tony,

Chris explained a lot about this... I'm not an expert on this, but you might
want to give a try to embed something like :

"";

And then let mp3.php send all of the no-cache headers together with the
contents of the filename.mp3.

It might work, I would give it a try...

HTH,

--
Ivo

"Tony Tzankoff" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a webpage written in the latest version of PHP and need a little
bit
> of help with a rather pesky cache issue. Part of the source code is as
> follows:
>
> page.php
>  echo "";
> echo "";
> .
> .
> .
> echo "";
> ?>
>
> The page does not cache (which is good), but the MP3 file does (which is
> bad). Is there a way to NOT cache the MP3 file? I would like to keep the
> file embedded within the page, if possible. Thanks!
>
>



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



[PHP] Re: global scope issue

2003-08-14 Thread Ivo Fokkema
"Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm having problems using global vars.  I have read the docs and all of
the
> notes but it's not helping.  Simplified example:
>
> /dir1/script2.php
>  $test = array ( 'a' => '1', 'b' => '2');
> ?>
>
> /dir1/script1.php
>  include("/dir1/script2.php");
> print_r($test);  //works great
> print_r($GLOBALS['test']);  //does not work
> ?>
>
> This is a local include so the vars should be in the global scope right?
> Any help please?
As far as I know, no defined variable is global by default. If you would
really need this variable to be global, you'll need to do a

global $test;

to make $test global.

HTH,

Ivo



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



Re: [PHP] php.ini configuration can we have two include_path in php.in file

2003-08-14 Thread Ivo Fokkema
I think Justin means you could CREATE the file with that exact content he
has given you. With a .htaccess file, you can override settings of your
php.ini file.

HTH,

Ivo

"Murugesan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>   I am not able to locate the file you are referring to. Please do
help
> me I am very much frustrated.
>
> -Murugesan
> - Original Message -
> From: "Justin French" <[EMAIL PROTECTED]>
> To: "murugesan" <[EMAIL PROTECTED]>
> Cc: "PHP List" <[EMAIL PROTECTED]>
> Sent: Thursday, August 14, 2003 2:29 PM
> Subject: Re: [PHP] php.ini configuration can we have two include_path in
> php.in file
>
>
> > The include_path can be set via a .htaccess file on a per-directory
> > basis... so, at the root of your "second" apache server, you could have
> > a file called .htaccess with something like:
> >
> > ---
> > 
> > php_flag register_globals off
> > php_value include_path '/path/to/your/include/dir/'
> > 
> > ---
> >
> > Have fun,
> >
> > Justin
> >
> >
> >
> >
> > On Thursday, August 14, 2003, at 06:39  PM, murugesan wrote:
> > > I am running an apache.In the php.ini file I have defined the
> > > include path.
> > > Now I want to run another apache in different port. The thing is that
> > > for
> > > that apache I need another include path in the php.ini file.
> > > Is there any way to achieve this to have two include_path in the
> > > php.ini
> > > file.
> >
> >
>



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



Re: [PHP] how to change index.php?passwd to index.php in the address bar

2003-08-14 Thread Ivo Fokkema
You will really need the post protocol if you don't want anything from a
form displayed in the url.

Apparently, Apache is not allowing the POST protocol for that
directory/file. Is this a local server or don't you have access to the
Apache config file? If it's a local server, fix this setting. This is not a
standard setting AFAIK.

HTH,

--
Ivo

"Murugesan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I used the post method in the form tag. But I am getting the following
error
>
> Method Not Allowed
> The requested method POST is not allowed for the URL /products.html.
> Apache/1.3.19 Server at localhost
> Any one is there to reaolve my problem
>
> Regards,
> Murugesan.
>
> - Original Message -
> From: "Peter James" <[EMAIL PROTECTED]>
> To: "murugesan" <[EMAIL PROTECTED]>
> Cc: "PHP List" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 13, 2003 12:12 PM
> Subject: Re: [PHP] how to change index.php?passwd to index.php in the
> address bar
>
>
> > Use the post method?
> >
> > --
> > Peter James
> > Editor-in-Chief, php|architect Magazine
> > [EMAIL PROTECTED]
> >
> > php|architect
> > The Magazine for PHP Professionals
> > http://www.phparch.com
> >
> >
> > - Original Message -
> > From: "murugesan" <[EMAIL PROTECTED]>
> > To: "Robert Cummings" <[EMAIL PROTECTED]>; "Kris Reid"
> <[EMAIL PROTECTED]>
> > Cc: "PHP List" <[EMAIL PROTECTED]>
> > Sent: Wednesday, August 13, 2003 12:28 AM
> > Subject: [PHP] how to change index.php?passwd to index.php in the
address
> > bar
> >
> >
> > > Hello all,
> > >When go to a new page from login page the address bar has
> > > localhost/regsuccess.php?password="ASD"
> > > I don't want the things that comes after ? in the URL
> > > How can I resolve this issue?.
> > >
> > > Thanks in advance,
> > > Murugesan
> > >
> > > --
> > > 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] Re: Parse error not understood

2003-08-14 Thread Ivo Fokkema
> //If "Delete User" is selected--
> if ( $_REQUEST['useroption'] == 'delete')
> {
> //First, check that the user already exists
> $query = "select count(*) from pbpc_client where username = '" .
> $_REQUEST['usernamebox'] . "';";
> $result = mysql_query($query);
> if(!$result)
> {
> echo 'Cannot run query.';
> exit();
> }
>
> $count = mysql_result($result, 0, 0);
> if($count==0)
> {
> //User does not exist in the database
> header('location: user_not_exists.php');
> exit();
>
> header('location:del_new_user.php');
> exit();
> }
> //header('location: content.php');
> ?>
>
> No matter which option I select I get the following output :
> --
> Parse error: parse error, unexpected $ in
> /var/www/html/Sessions/userman.php on line 83
>
> Line 83 is '?>'..
You missed a '}' at lines :


if($count==0)
{
//User does not exist in the database
header('location: user_not_exists.php');
exit();

Add a '}' after this, and your problem is fixed!


--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



Re: [PHP] Max script size

2003-08-14 Thread Ivo Fokkema
Hi,

I must say I don't agree. Although it seems odd, I received a DNS error a
while ago while creating a script using the GD library. If the script wasn't
there, I would've got a 404. That particular script was generating problems
with Apache somehow causing my browser to display a DNS error. Run on a
local Windows box, it crashed Apache.

--
Ivo

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
Sorry, in terms of PHP error no.  I get a page cannot be displayed/DNS
error.
It happens instantly...in fact, not 1 line of script exe.
[/snip]

So, is the URL path to the script correct? What is the server path to
the file? Let's just double check. A DNS error has nothing to do with
the script unless the script isn't there.



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



Re: [PHP] PHP - MySQL Query...

2003-08-14 Thread Ivo Fokkema
This is not true, the resource link identifier is optional! If unspecified,
the last opened link is used. My suggestion is to check the results of
mysql_error() for more information on the failed query.

HTH,

Ivo

"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
$dbh = mysql_connect("localhost", "login", "password") or
die('cannot connect to the database because: ' . mysql_error());
mysql_select_db("database");

$query = 'SELECT * FROM cities';
$result = mysql_query($query);

 while ($row = mysql_fetch_row($result)) {
echo (' ' . $row[0] . ', ' . $row[1] . '
' . $row[2] . ' ' . $row[3] . " \n"); }

getting this error:

*Warning*: mysql_fetch_row(): supplied argument is not a valid MySQL
result resource in...

so... is the problem with the $query?
I don't see anything wrong (assuming my login and database selection is
correct)
what are the common errors here?
[/snip]

mysql_query needs both the query variable and the connection
variable
mysql_query($query, $dbh);

HTH!



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



Re: [PHP] Max script size

2003-08-14 Thread Ivo Fokkema
"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Monday 11 August 2003 19:59, Ivo Fokkema wrote:
> >
> > I must say I don't agree. Although it seems odd, I received a DNS error
a
> > while ago while creating a script using the GD library. If the script
> > wasn't there, I would've got a 404. That particular script was
generating
> > problems with Apache somehow causing my browser to display a DNS error.
Run
> > on a local Windows box, it crashed Apache.
> >
> > --
> > Ivo
> >
[SNIP]
> Let's be clear -- a DNS error has nothing to do with the script (whether
it is
> there or not). In fact it has nothing to do with your webserver at all.
Internet Explorer calls it a 'DNS or server error'. Excuse me for shortening
it to a 'DNS error' (while it's probably a 'server error').

--
Ivo



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



Re: [PHP] HTML equivalents of accented characters

2003-08-14 Thread Ivo Fokkema
"Liam Gibbs" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > I bet they do, did you check the HTML source as well? My guess is that
the
> > source is reading the actual expected output, but your browser views
"é",
> as
> > it should of course.
> Sorry, should have mentioned. The source code reads the actual character,
> not the é.
Hmmm... interesting... I tested your exact code in this format :



which returned (sourcecode)
[é][é][é]

So with me, htmlentities works. Did you try this :

$a = get_html_translation_table(HTML_ENTITIES);
var_dump($a);

? With me, it returns a 99 elements array with loads of characters,
including the "é". (PHP/4.2.3 on Win2000)

I have no idea what might be the problem, what does your translation table
look like?

--
Ivo Fokkema



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



Re: [PHP] HTML equivalents of accented characters

2003-08-14 Thread Ivo Fokkema
To change "é" to "é" you need htmlentities(), not htmlspecialchars as
the latter only translates ampersands (&), double quotes, less than en
greater than characters (Single quotes are not translated by default).

If htmlentities does not work, what does a var_dump on your
$translationtable send back?

Ivo

"Liam Gibbs" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > I have no idea what might be the problem, what does your translation
table
> > look like?
>
> Mine is still coming out as a single character. Here's my code, in case
> anyone can spot any stupid human error blunder I'm making:
>
>  $translationtable = get_html_translation_table(HTML_ENTITIES);
>  $string = htmlspecialchars($string);
>
> Also, here's my setup, just in case:
> PHP 4.3.1
> Linux 2.2.19 #1 i586
> Apache 1.3.27
> MySQL 3.23.49 (don't know what this has to do with it, but just in case
> there has been some interference with PHP and MySQL)
> GD 2.0 compatible
>



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



[PHP] Re: mail() function failure

2003-08-11 Thread Ivo Fokkema
"Brad Esclavon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have made a simple script to mail an email to a person on my domain. i
> have tested the script with different values and i still cannot get the
> email. when i execute the mail function, it returns true, so i know it
gets
> to the mail server, but the mail server doesnt actually send it. i am
being
> hosted by a company and am sure the mail server is up and working for me.
is
> there a way i need to feed it a username/password with php? any ideas on
why
> its not working? im completely stumped.
>
> 
>  ini_set("SMTP","smtp-relay.affinity.com");
>
>  $mail_to = "[EMAIL PROTECTED]";
>  $mail_from = "[EMAIL PROTECTED]";
>  $mail_subject = "php mail test";
>  $mail_body = "test";
>
>  if ( mail($mail_to, $mail_subject, $mail_body))
>{echo("sucess");}
>  else
>{echo("fail");}
>
> ?>
Brad, you're missing a buch of headers probably causing your email to be
dropped somewhere regarded spam (especially Hotmail is quite picky about the
headers).

Try and send these headers (fourth argument in mail() function.

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";//I use this, I'm not
sure if you really need this header
$headers .= "From: [EMAIL PROTECTED]";
$headers .= "Reply-to: [EMAIL PROTECTED]";
$headers .= "Return-path: [EMAIL PROTECTED]";
$headers .= "Error-to: [EMAIL PROTECTED]";

if (mail($mail_to, $mail_subject, $mail_body,$headers)) {
  echo ("success");
} else {
  echo ("failed");
}

HTH,

--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



Re: [PHP] Re: Parse error not understood

2003-08-08 Thread Ivo Fokkema
"Miles Thompson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Yes, I'm top posting, pls forgive.
>
> This is a situation where an editor which has built-in brace matching
> really helps - if in the midst of "looking" one remembers to use it.
>
> Another tip, although it probably wouldn't help here: Save the code with a
> .phps extension and look at it in the browser.
I always indent statements like this :

if (this) {
  do_this();
  if (that) {
do_that();
  }
}

It helps me 'see' the code and also it's easier to track missing braces. I
know people have their own coding style - I just find it easy for me.

--
Ivo



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



[PHP] Re: manipulate mail header

2003-08-06 Thread Ivo Fokkema
"Klaus Linzner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi! Its me again. Sorry for the last post - it was quite clumsy.
>
> In fact, it wasn't really what I need. I have a mail and I want to fake
the
> attachment. Its always the same String in the header that I need, but I
need
> to set
> X-MS-Has-Attach: yes
>
> and I have to add some values to the header until this will work
correctly.
> Because if I send a mail the value for Content-Type: text/plain . And I
have
> to manipulate the header in that way, that I can set the Content-Type:
> multipart/mixed. Same with content-class.
>
> If you have any idea how to manipulate the header, please mail me. Thanks
> Klausi
All you need @ http://www.php.net/mail

HTH

--
Ivo



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



Re: [PHP] Where am i screwing up?

2003-07-31 Thread Ivo Fokkema
"John Manko" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can someone correct me on this if i'm wrong...
>
> try (meaning, I think that $vars as $keys will put the value into $key,
> not the key itself):
>
> foreach ($vars as $key=>$value) // clear all previous sessions
>  {
>  if(isset($_SESSION['$key']))
>  {
> unset($_SESSION['$key']);
>  }
>  }
This is no good, now it's going to delete $_SESSION['0'] and so on. This top
function seems OK to me as it was, but using $val in stead of $key should be
clearer.

Ivo



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



[PHP] Re: php path statement appears on my webpages

2003-07-31 Thread Ivo Fokkema
If you don't run PHP as an CGI but as an module, you don't even need this
line. My guess is that you run PHP as a module, so delete the line to fix
your problem.

HTH,

--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands

"Jim M Gronquist" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I include #!/usr/local/bin/php4 at the top of my
Php files so that it knows where to find php.
Unfortunately the path appears in my web pages.
Is there a way for me to turn this off?
Is it a setting in Apache or is it something that I change in
My php files.

#!/usr/local/bin/php4

-
Jim Gronquist



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



Re: [PHP] The return of mysql_fetch_assoc()

2003-07-30 Thread Ivo Fokkema
""Ney andré de mello zunino"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks for the quick response, but I am not sure I understand your
> argument. Yes, I am aware that the function returns an array
> corresponding to a single row/record; what I don't understand is why I
> am not able to apply a key directly to that "temporary" return value. In
> other words, it is necessary to "copy" the resulting row into a new
> variable so that it is then possible to use the column name (key) to
> retrieve the desired value.
Why don't you use :



This will do exactly what you need, if I understand you correctly.

HTH,

--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



Re: [PHP] learning php - problem already

2003-07-30 Thread Ivo Fokkema
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote John W. Holmes ([EMAIL PROTECTED]):
> >

[snip]

> don't but all that matters to most is: it works..  and foreach has
> taken over its job anyway.
Just a small comment... foreach() is not equal to a while/each loop. Foreach
uses a copy of the array, and not the array itself. This might not sound
important, but it was for me when I tried to add new elements to the array
in the middle of a foreach() loop. They didn't show up until after the loop,
which was a bit confusing for me at first. So occasionally when I need to
add elements during a loop, I still use while(list(..) = each(...)).

--
Ivo



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



[PHP] Re: debuging and getting mor information about failures

2003-07-30 Thread Ivo Fokkema
"Chrstian Brensteiner" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> whats the best option to get more information about a failure in your
sorce
> code ?
>
> whenever i get failures that are situated at the very end of my script how
> do i get to know wherer they start?
>
> now i have get from apache + php  this return
>
> Parse error: parse error, unexpected $ in
> c:\programme\easyphp\www\cms\procede_presse.php on line 268
>
> 268 is the last line of my script how to deal with those failures in an
> intelligent way?
Getting these errors at the last line in your script generally means that
you omitted a closing '}'.

So when you would do :



You will get a similar error. Check all of your functions and
if/else/foreach/ etc. structures for an omitted '}' to fix your script.\

Good luck!

--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] Re: anchor in php page

2003-07-29 Thread Ivo Fokkema
Hi Tony,

I think no server-side application had any effect on the viewing position on
the page, it's totally client side. To use this anyway, you could do this in
PHP :

http://"; . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']
. "#" . $_GET['go']);
  exit;
}

//rest of your code
?>

This code detects the availability of a '?go=...' variable and refreshes
itself with the given position.
'test.php?go=here' will reload to 'test.php#here'.

Sorry if this is not what you need.

Ivo


"Anthony Ritter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ivo:
> > Why not use :
> > www.thesite.com/thepage.asp#here
> .
>
> Thank you Ivo.
>
> I don't usually use asp but was wondering if the word "go" in asp like:
>
> www.thesite.com/thepage.asp?go=here
>
>  is a _reserved_ word in .asp which acts like the symbol "#" - serving as
> the
> anchor.
>
> And if one can achieve this using php.
>
> Thank you.
> TR
>
>
>



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



[PHP] Re: ereg() can't recognize characters... [SOLVED]

2003-07-29 Thread Ivo Fokkema
Well, I tried that first, but it failed when some user whould list multiple
references. The ereg_replace would then take the two references as one.
"{PMID11519736:Müller}, {PMID8789442:Milasin}" would result in a link to
Müller named "Müller}, {PMID8789442:Milasin" instead of two separate
links...

Thanks again!

Ivo

"Dvdmandt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Also... You know, there's a (.*?) command as well.. Might work just about
> perfect in your situation...
>
> --
> // DvDmanDT
> MSN: [EMAIL PROTECTED]
> Mail: [EMAIL PROTECTED]
> "Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet
> news:[EMAIL PROTECTED]
> > Well d*mn, why didn't I think of this... It seems to work now! Thanks!
> >
> > I'm not such an expert on the Perl compatible regexp's so I rarely use
> > them... Yet another reason to start using them though...
> >
> > Thanx!
> >
> > "Dvdmandt" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Use preg_*() functions then? Not that I think they would be much
better
> > > but...
> > >
> > > --
> > > // DvDmanDT
> > > MSN: [EMAIL PROTECTED]
> > > Mail: [EMAIL PROTECTED]
> > > "Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet
> > > news:[EMAIL PROTECTED]
> > > > Hi list,
> > > >
> > > > I read through the manual and tried to find something on google, but
I
> > > > didn't come to anything useful.
> > > >
> > > > It seems that the ereg()-family (I tried ereg(), eregi() and
> > > ereg_replace())
> > > > can't recognize any special characters such as èéêë etc. I tested
this
> :
> > > >
> > > >  > > > print
> > > >
> > >
> >
>
(ereg("[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:pri
> > > > nt:][:punct:][:space:][:upper:][:xdigit:]]","é"));
> > > > ?>
> > > >
> > > > and it returned a blank screen. When I fill in a regular character
> such
> > as
> > > > 'e' or a slash or whatever, it returns 1. I ran into this when I
> tested
> > a
> > > > script which should replace '{PMID[PubMed ID number]:[First author's
> > > name]}
> > > > into a link to the article online. For instance,
> > "{PMID12632325:Flanigan}"
> > > > results in " > > >
> > >
> >
>
href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubM
> > > > ed&dopt=Abstract&list_uids=12632325"
> > > target="_blank">Flanigan".
> > > >
> > > > This worked all fine, until an author's name was Müller. Then my
> > > > ereg_replace() failed (below). Any ideas?
> > > >
> > > >  > > > $val = ereg_replace("{PMID([[:alnum:]. _-]*):([[:alnum:]. _-]*)}",
" > > >
> > >
> >
>
href=\"http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=Pub
> > > > Med&dopt=Abstract&list_uids=\\1\"
> > > > target=\"_blank\">\\2","{PMID11519736:Müller}");
> > > > print ($val);
> > > > ?>
> > > >
> > > > TIA!
> > > >
> > > > --
> > > > [Win2000 | Apache/1.3.23]
> > > > [PHP/4.2.3 | MySQL/3.23.53]
> > > >
> > > > Ivo Fokkema
> > > > PHP & MySQL programmer
> > > > Leiden University Medical Centre
> > > > Netherlands
> > > >
> > > >
> > >
> > >
> >
> >
>
>



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



[PHP] Re: anchor in php page

2003-07-29 Thread Ivo Fokkema
"Anthony Ritter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am trying to access a page published on a server - and then using an
> anchor - to jump to a specific paragraph on that page.
>
> For instance, if using asp, I could write:
> www.thesite.com/thepage.asp?go=here
>
> where "here" -the value - in the string query would be marked up as:
> ...
> // thepage.asp
>
> 
> blah,blah,blah, etc...
> 
> ...
>
> Can this be done using php?
Why not use :
www.thesite.com/thepage.asp#here

?

--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] Re: ereg() can't recognize characters... [SOLVED]

2003-07-29 Thread Ivo Fokkema
Well d*mn, why didn't I think of this... It seems to work now! Thanks!

I'm not such an expert on the Perl compatible regexp's so I rarely use
them... Yet another reason to start using them though...

Thanx!

"Dvdmandt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Use preg_*() functions then? Not that I think they would be much better
> but...
>
> --
> // DvDmanDT
> MSN: [EMAIL PROTECTED]
> Mail: [EMAIL PROTECTED]
> "Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet
> news:[EMAIL PROTECTED]
> > Hi list,
> >
> > I read through the manual and tried to find something on google, but I
> > didn't come to anything useful.
> >
> > It seems that the ereg()-family (I tried ereg(), eregi() and
> ereg_replace())
> > can't recognize any special characters such as èéêë etc. I tested this :
> >
> >  > print
> >
>
(ereg("[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:pri
> > nt:][:punct:][:space:][:upper:][:xdigit:]]","é"));
> > ?>
> >
> > and it returned a blank screen. When I fill in a regular character such
as
> > 'e' or a slash or whatever, it returns 1. I ran into this when I tested
a
> > script which should replace '{PMID[PubMed ID number]:[First author's
> name]}
> > into a link to the article online. For instance,
"{PMID12632325:Flanigan}"
> > results in " >
>
href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubM
> > ed&dopt=Abstract&list_uids=12632325"
> target="_blank">Flanigan".
> >
> > This worked all fine, until an author's name was Müller. Then my
> > ereg_replace() failed (below). Any ideas?
> >
> >  > $val = ereg_replace("{PMID([[:alnum:]. _-]*):([[:alnum:]. _-]*)}", " >
>
href=\"http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=Pub
> > Med&dopt=Abstract&list_uids=\\1\"
> > target=\"_blank\">\\2","{PMID11519736:Müller}");
> > print ($val);
> > ?>
> >
> > TIA!
> >
> > --
> > [Win2000 | Apache/1.3.23]
> > [PHP/4.2.3 | MySQL/3.23.53]
> >
> > Ivo Fokkema
> > PHP & MySQL programmer
> > Leiden University Medical Centre
> > Netherlands
> >
> >
>
>



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



[PHP] ereg() can't recognize characters such as èéêë...

2003-07-29 Thread Ivo Fokkema
Hi list,

I read through the manual and tried to find something on google, but I
didn't come to anything useful.

It seems that the ereg()-family (I tried ereg(), eregi() and ereg_replace())
can't recognize any special characters such as èéêë etc. I tested this :



and it returned a blank screen. When I fill in a regular character such as
'e' or a slash or whatever, it returns 1. I ran into this when I tested a
script which should replace '{PMID[PubMed ID number]:[First author's name]}
into a link to the article online. For instance, "{PMID12632325:Flanigan}"
results in "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubM
ed&dopt=Abstract&list_uids=12632325" target="_blank">Flanigan".

This worked all fine, until an author's name was Müller. Then my
ereg_replace() failed (below). Any ideas?

http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=Pub
Med&dopt=Abstract&list_uids=\\1\"
target=\"_blank\">\\2","{PMID11519736:Müller}");
print ($val);
?>

TIA!

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



Re: [PHP] Difference between equal $_SERVER variables?

2003-07-24 Thread Ivo Fokkema
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Ivo Fokkema ([EMAIL PROTECTED]):
> > Hi list,
> >
> > Just out of curiosity I would like to know if anyone can tell me the
> > difference between some $_SERVER variables that generate the same output
(in
> > my test-file at least).
> I would suggest reading up on the variables available
> http://www.php.net/manual/en/reserved.variables.php
Well, I've seen that, but for instance;

'PHP_SELF'
The filename of the currently executing script, relative to the document
root.
--and--
'SCRIPT_NAME'
Contains the current script's path.

doesn't mean much to me... They both return the same results to me, also.
When do these differ?



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



Re: [PHP] php function on php.net

2003-07-24 Thread Ivo Fokkema
> > Use a path relative to your httpdocs for your error document, e.g.
> > ErrorDocument 404 /myerrorpage.php
> > instead of
> > ErrorDocument 404 http://mysite/myerrorpage.php
> Unfortunatelly this is not what I mean.
I think it is. When you use a relative path in the .htaccess, the URL will
not change, but you will be redirected. Therefor you can use
$_SERVER['REQUEST_URI'] in your 404-page to check what the visitor was
looking for.

HTH,

--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] Difference between equal $_SERVER variables?

2003-07-24 Thread Ivo Fokkema
Hi list,

Just out of curiosity I would like to know if anyone can tell me the
difference between some $_SERVER variables that generate the same output (in
my test-file at least).

For instance, what is the difference between $_SERVER['HTTP_HOST'] and
$_SERVER['SERVER_NAME']? Can they generate different output under some
circumstances? They're always the same with me. Any recommendations on which
to use?

I know that $_SERVER['REQUEST_URI'] can differ from 'SCRIPT_NAME' and
'PHP_SELF' (I use 'REQUEST_URI' to see what people were looking for when
they hit a 404) but can $_SERVER['SCRIPT_NAME'] and $_SERVER['PHP_SELF'] be
different?

TIA,


--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] Re: Opinon please - Host refuses to install a later version than 4.2.3 - says they're too buggy.

2003-07-23 Thread Ivo Fokkema
> I would like to get away from 4.2.3, just wondering what people's thoughts
> on the current version of php are.
When my hosting provider installed 4.3.2 in the beginning of june, the
get_browser() function which is used for my statistics didn't work correctly
anymore and didn't return all the information necessary. I'm not sure about
other bugs but I haven't encountered other problems.

--
Ivo Fokkema
PHP & MySQL programmer



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



[PHP] Re: header & headers_sent BUG

2003-07-23 Thread Ivo Fokkema
You might want to check whether or not your header output is getting
buffered. My suggestion is a flush() after the fist call. I'm not an expert
on this, it's just an idea.

HTH


--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands

"James M. Luedke" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello all:
> I am having a hard time with a small piece of code. I was wondering
> if someone may be able to explain why the following code will not work...
I
> have been scratching my head for a few hours now and I am stumped.
>
> 
> header("Location: http://someplace.com";);
>
> if( ! headers_sent())
> header("Location: http://somplaceelse.com";);
>
> ?>
>
> So I would expect this  piece of code to direct me to somplace.com.
> However it does not, and I always end up at somplaceelse.com.
>
> I have done a tcpdump to assist with debugging here is the output below.
>  From the look of it the first header is getting ignored all toghether. Is
> there some way to force changes I made to the headers, that will make
> headers_sent return TRUE?
>
> Thanks,
>
> -James
>
> ---
> GET /tracking/test.php HTTP/1.1
> Host: dev.www.someplace.com
> User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0)
> Gecko/20020623 Debian/1.0.0-0.woody.1
> Accept:
>
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
> Accept-Encoding: gzip, deflate, compress;q=0.9
> Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66
> Keep-Alive: 300
> Connection: keep-alive
> Cookie: toolkitAccess=1
>
> HTTP/1.1 302 Found
> Date: Wed, 23 Jul 2003 10:04:55 GMT
> Server: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSSL/0.9.6d PHP/4.3.1
> mod_perl/1.27
> X-Powered-By: PHP/4.3.1
> Location: http://someplaceelse.com
> Keep-Alive: timeout=15, max=100
> Connection: Keep-Alive
> Transfer-Encoding: chunked
> Content-Type: text/html
> ---
>



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



[PHP] Re: Apache 2.x and PHP

2003-07-22 Thread Ivo Fokkema
"Jean-Christian Imbeault" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Miguel Angelo wrote:
> >
> > Is PHP capable of running on Apache 2.x and if so what version ?
> > And is it stable ?
> PHP will run on Apache 2 but ...
>
> #1 Apache 2 is multi-threaded whereas PHP is not. You need to turn
> Apache 2's multi-threading off.
>
> #2 Turning Apache 2's multi-threading off pretty much loses any
> performance gains Apache 2 has over Apache 1.2.X
>
> #3 I'm not 100% sure that even with multi-threading off PHP is 100%
stable.
>
> Conclusion:
>
> If you want to use PHP on a production server don't use Apache 2.

May I add this little note from the PHP installation txt file :

 
 ATTENTION: Apache 2 Users

   At this time, support for Apache 2 is experimental.  It's
   highly recommended you use PHP with Apache 1.3.x and not
   Apache 2.
(...)
  


--
Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] Re: Warnings when trying to write to file

2003-07-22 Thread Ivo Fokkema
My guess would be you don't have any write permission. Your first error is a
permission denied using fopen(). The rest of your errors is caused by using
the invalid filepointer '$file'. So check if you have any write permission!
I don't have any on my commercial hosting either, but I do on my localhost
(Windows 2000).

HTH,

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands


"Dore Van Hoorn" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I get this warning when trying to write to a .txt file. Strange enough, I
> don't get this error when trying to do the same this on my local server.
> Can anybody help me with this?!
>
> Warning: fopen(respons.txt) [function.fopen]: failed to create stream:
Permission
> denied in
/usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php
> on line 206
>
> Warning: fwrite(): supplied argument is not a valid stream resource in
/usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php
> on line 220
>
> Warning: fwrite(): supplied argument is not a valid stream resource in
/usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php
> on line 238
>
> Warning: fwrite(): supplied argument is not a valid stream resource in
/usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php
> on line 238
>
> Warning: fwrite(): supplied argument is not a valid stream resource in
/usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php
> on line 238
>
> Warning: fclose(): supplied argument is not a valid stream resource in
/usr/local/slash/apache/vhosts/goldore.nl/httpdocs/enquete/bekijken.php
> on line 242
>
>
> This is the code I use:
>
> if($answer == "send")
> {
> $bestand = "respons.txt";
> $file = fopen("$bestand",'a');
> $write = "respondent";
> $query6 = "SELECT $tabel2.questionnumber FROM $tabel2";
> $result6 = mysql_query($query6,$connection);
> $gevonden6 = mysql_affected_rows($connection);
> if($gevonden6 > "0")
> {
> while($myrow = mysql_fetch_row($result6))
> {
> $questionnumber = $myrow[0];
> $write .= " question$questionnumber";
> }
> }
> $swrite .= "\r\n";
> fwrite($file, "$write");
> $questionnumber++;
> $query5 = "SELECT * FROM $tabel1";
> $result5 = mysql_query($query5,$connection);
> $found = mysql_affected_rows($connection);
> if($found > "0")
> {
> while($myrow = mysql_fetch_row($result5))
> {
> $respondent = $myrow[0];
> $write2 = "$respondent";
> for($i=1; $i<$questionnumber; $i++)
> {
> $answer = $myrow[$i];
> $write2 .= " $answer";
> }
> $write2 .= "\r\n";
> fwrite($file, "$write2");
> }
> }
> fclose($file);
>
> In the mysql database I have one respondent, who has given answers to most
> of the 58 questions. Is this perhaps the problem, that there is not a
answer
> to EVERY question, so sometimes $answer in the last for statement will be
> empty?
>
> Thank you all very much in advance!!
>
> Dore.
> +++
> NDore van Hoorn
> Ss1000454 AlfaInformatica-RuG
> E[EMAIL PROTECTED]
> Whttp://www.let.rug.nl/~s1000454
> +++
>



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



Re: [PHP] Re: Help?

2003-07-22 Thread Ivo Fokkema
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Ivo Fokkema ([EMAIL PROTECTED]):
> > I want to warn you though, PHP depricates the use of register_globals =
On,
> > so it would be recommendable to use your modified script and keep coding
> > using $_POST, $_GET and these kind of global variables.
> So php is removing that feature?

Don't know about the future, but its default is off since 4.2.0 because of
security issues that might arise from bad coding. An example on this is on
http://www.php.net/manual/en/security.registerglobals.php.

If it wasn't such a drag for many people to change all of their coding, I'd
say it would be a good idea to just disable it for security issues. When I
realised I really needed to use the $_POST, $_GET and $_SESSION arrays, I
became more aware of the possible security holes of my scripts. It helped me
a lot, I'd say.

Ivo



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



[PHP] Re: Help?

2003-07-21 Thread Ivo Fokkema
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I installed apache1.3.12 as the web server and php5 beta version,I write a
> test.html and test.php like this:
> //test.htm
>
> 
> Name:
> 
> 
> //test.php
>echo "Hello!".$name ;
> ?>
> the same source works well with php4 and apache 1.3.27
> but it doesn't work well in my new enviroment, until I modified test.php
> like this
> //new test.php
>echo "Hello!".$_POST['name'] ;
> ?>
>
> who can tell me which one cause this problem,Is the version php5 not
> satisfy or the apache 1.3.12?
Check your php.ini for this setting : 'register_globals'. With your new
installation, it is set to off, causing $_POST['name'] (the original
variable!) not to be registered to $name. With register_globals set to on,
you can use your first script.

I want to warn you though, PHP depricates the use of register_globals = On,
so it would be recommendable to use your modified script and keep coding
using $_POST, $_GET and these kind of global variables.

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



Re: [PHP] Re: mail function

2003-07-21 Thread Ivo Fokkema
> >Does mail() return true? I mean, do you get printed "U redu je"? If so,
your
> >email should've been sent by PHP.
> >
> >You are really missing a bunch of headers. I'm not sure if this is your
> >problem, but I think it's not a bad idea to include more headers, also
> >because more and more ISP's add some kind of spamfilter which might drop
> >your email. So maybe by adding more headers, you can solve this.
> >
> >I use this:
> >
> >$headers = "MIME-Version: 1.0\r\n";
> >$headers .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
> >$headers .= "X-Priority: 3\r\n";
> >$headers .= "X-MSMail-Priority: Normal\r\n";
> >$headers .= "X-Mailer: PHP/".phpversion()."\r\n";
> >$headers .= "From: Name <[EMAIL PROTECTED]>\r\n";
> >
> >$body = "Whatever is in your email";
> >
> >$to = "Name <[EMAIL PROTECTED]>";
> >$check_mail = mail($to, "Subject", $body, $headers);
>
> When PHP sends an email to a non existing email address such as
> [EMAIL PROTECTED], the warning mail you normally get returned often does not
> arrive in your mailbox. Therefore I add two additional headers:
>
>  ."Reply-To: [EMAIL PROTECTED]"
>  ."Return-path: <[EMAIL PROTECTED]"
>
> and now I do get the notification mail when mail bounces.
That's funny, because I always had that problem, too. By adding Reply-To and
Return-path, it did not fix my problem. Boucing emails never got back to me.
Return-path was overwritten by my hostingserver to '[EMAIL PROTECTED]' and Reply-To
was apparently ignored by the server bouncing the email. Do you think
servers differ in this a lot?

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] Re: mail function

2003-07-21 Thread Ivo Fokkema
> I put this PHP script on web server:
>
>   if (mail("[EMAIL PROTECTED]", "brati", "peda", "From: Peda")== TRUE)
> print("U redu je");
>  else
> print("Greska");
> ?>
>
> But It seems that mail function doesn't work. I don't get any e-mail.
>
> Can anyone tell me what is wrong.

Does mail() return true? I mean, do you get printed "U redu je"? If so, your
email should've been sent by PHP.

You are really missing a bunch of headers. I'm not sure if this is your
problem, but I think it's not a bad idea to include more headers, also
because more and more ISP's add some kind of spamfilter which might drop
your email. So maybe by adding more headers, you can solve this.

I use this:

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";
$headers .= "From: Name <[EMAIL PROTECTED]>\r\n";

$body = "Whatever is in your email";

$to = "Name <[EMAIL PROTECTED]>";
$check_mail = mail($to, "Subject", $body, $headers);

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



Re: [PHP] Sending email with the windows version of php

2003-07-21 Thread Ivo Fokkema
> > hello,
> >
> > My client is wanting to transfer their web site from a system that uses:
freebsd, apache, mysql and php, to a windows based hosting service.
> >
> Did you tell them this is a bad idea.
:)

> > So I was wondering if the Windows version of PHP sends e-mail with the
same commands as Sendmail or do I have to re-write the scripts. Or can you
tell me what form of email sending windows would use.
> >
> if you use the php mail command, you shouldn't have any problems.  In
> the unix version the mail command uses sendmail where the windows
> version connects to a smtp server and sends the message its self.
You would need to set 'SMTP' and 'sendmail_from' in your php.ini. The
'sendmail_path' doesn't work for Windows, so you can leave that blank.

Nothing else changes then...

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] Re: Mail From option in PHP.ini

2003-07-21 Thread Ivo Fokkema
Hi,

Paul is right, you can't change the Return-Path header. On a windows server
you could use the 'sendmail_from' setting in php.ini, but that doesn't work
on Linux/Unix. Also, the -f 5th argument of the mail() function does not
function with safe_mode on in php. It also generates a
X-Authentication-error in the emailheader (for me, at least) and I am told
it can lead to dangerous security problems.

I gave up some time ago to try and fix this problem. When my emails don't
reach the target because visitors don't fill in their correct emailaddress,
I won't receive any delivery errors. I used Reply-To, Error-To and whatever
more, but I couldn't fix it. Maybe something can be added to a later release
of PHP to fix this? I for one would be extremely happy with that.

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands


"Brian S. Drexler" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ok, I want to specify who the mail is coming from by using the
sendmail_path
> option in the PHP.ini.  I've added the [EMAIL PROTECTED] to it, but I want
> to be able to dynmaically change [EMAIL PROTECTED] to [EMAIL PROTECTED] or
> whatever else.  Anyone have any ideas how I can do this?  I'm pulling the
> e-mail I'd like to change it to from a MySQL database but can I rewrite
the
> php.ini file on the fly or am I stuck.  Any help is greatly appreciated.
> Thanks!
>
> Brian
>



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



[PHP] Re: Need Help: Please click on Test Link

2003-07-17 Thread Ivo Fokkema
Well, worked nicely for me...

Can you tell me where you can fetch this kind of information?

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands


"Suhas Pharkute" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> I need your help.
>
> Can you please visit a site
>
> http://sspsoft.com/test/ip2ll.php (in case if you cannot get it, please
> click on http://ns1.webhostdns.us and then click on the website link.)
>
> which should identify your Country, State, City. Please click on one of
the
> buttons to provide feedback.
>
> I am trying to get hits from different parts of the world to make sure
that
> it works.
>
> Planning to develop a webservice from this.
>
> Thanks in advance,
>
> Suhas
>
> _
>
> Encrypt your PHP code for FREE at
>
> http://encphp.sspsoft.com
>
> _
>



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



[PHP] Re: really no way to get byte size of variable?

2003-07-17 Thread Ivo Fokkema
"Baroiller Pierre-Emmanuel" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> did you try count($value) and strlen($value) ?
> count($value) will give size of an array, and strlen($value) size of a
> string ...
Actually, count($value) returns the amount of values within the array, not
the size of it all.
If strlen($value) would be enough for you to determine the amount of bytes,
you could use this for an array (note that keys are stored as well and thus
take memory):

foreach ($array as $key => $val) {
  $total_size += strlen($key) + strlen($val);
}

But I'm really not sure how PHP stores arrays, so I don't know if
$total_size is even close to the amount of bytes used for an array.


--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] Re: Problem with Apache Web Server config file and PHP (please give advice on what problem may be me)

2003-07-17 Thread Ivo Fokkema
It prompts you for downloading the file because Apache doesn't recognize it
as a PHP-file but sends it directly to the browser. The browser then doesn't
find any known extension (.txt, .htm, .html) and prompts for download.

As Marek allready explained, you need to configure Apache to recognize .php
files. Marek sent you the lines you need already. I may add that maybe these
lines need to be different with your Apache version (2), check the
install.txt in your PHP directory for that. You may also need to replace the
directoryname in de config lines for where your PHP is.

Good luck!

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands

"Karen Santmyer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> HI:
>
>  Can anyone refer me to someone that can help with the problem below.
>
>  I installed Apache Web Server on my laptop which has Windows XP.  I
then installed PHP.  I followed the directions in the book I had on
installing apache and php and what to add to the apache configuration file.
>
>   Here is what is happening:  After installing everything, I tested my
Apache web server installation first and saw the apache web server page like
the book said.  Then it said to do a little php program - which had
phpinfo() in it.  But when I retyped the url I got a message that asked me
did I want to download a file, which was the php program file.
>
>   The PHP is 4.3.2 and the apache web server is 2.0.  What am I doing
wrong?  Should I use apache 1.3.2?
>
>Please help.  I understand everything, just don't know why it is
prompting me to download a file.
>
>Thanks.
>
> Karen
>
>
>
>
>
>
> -
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!



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



Re: [PHP] Verifying a certain amount of numbers

2003-07-16 Thread Ivo Fokkema


"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Excellent point! I find my self using regex's a bit to often when there
> are other solutions available.
>
> btw, have you ever tested the difference between
>
> if(ereg('^[0-9]{6}$',$str))
> if(preg_grep('^[0-9]{6}$',$str))
>
> I've been meaning to find out advantages/disadvantages with PERL vs.
> POSIX compatible.
Without getting too far astray from the real subject, I was once writing a
script opening a textfile and modifying the whole contents to create a new
file, using POSIX compatible expressions. My script timed out (30sec+) at
some 400kb. I read Perl compatible was faster, and so I modified my script
to use those. Result : done in a couple of secs.

I bet it depends on the type of expression (these were a bunch of replaces)
but for larger input or many iterations I'd rather use Perl compatible...

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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



[PHP] [SESSION] Session variable deleted prior to command?

2003-07-16 Thread Ivo Fokkema
Hi all,

I'm developing a database system on my local computer (OS/version details at
bottom) with a simple user authentication using sessions. On a successful
login, the previous login time is stored in the $_SESSION array and the new
one is inserted into the database. A welcome message is then displayed,
below which the previous login time should be printed, after which the
variable is deleted.

Yet, PHP seems to delete the variable prior to printing it on the screen,
resulting in the absence of the previous login time, although the command to
delete it from the array is issued AFTER the print () command. When I
refrain from deleting the variable from the SESSION array, the previous
login time is printed just like it should be.

Anyone seen this before and/or knows what to do? When I don't delete the
variable, it keeps displaying it everytime.

This is my code :

-
session_start();
...
$_SESSION[auth] = mysql_fetch_array(mysql_query("SELECT * FROM user WHERE
user = \"$_POST[username]\" AND pass = \"".md5($_POST[password])."\""));
$auth = $_SESSION[auth];
$_SESSION['last_logn'] = $auth['last_logn'];

if (!$auth) {
  ... //not logged in
} else {
  mysql_query("UPDATE user SET last_logn = NOW() WHERE nr = $auth[nr]");
  ...//redirect to index using header()
}

... //index blah blah welcome etc.

if ($_SESSION['last_logn']) {
  print ("  Last login : ".$_SESSION['last_logn']."\n");
  $_SESSION['last_logn'] = "";
}
-

So, you might think this will display the welcome message with the last
login time below it. No, it doesn't. When I quote the line
'$_SESSION['last_logn'] = "";' it does display, but then it keeps doing that
until you log off. Not so elagant. Any ideas/suggestions???

Thank you in advance!

Ivo

--
[Win2000 | Apache/1.3.23]
[PHP/4.2.3 | MySQL/3.23.53]

Ivo Fokkema
PHP & MySQL programmer
Leiden University Medical Centre
Netherlands



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