[PHP] Re: Enabling HTTP_REFERER

2003-03-11 Thread Niels Andersen
I don't mean any disrespect, but I just want to check that the basics are
OK, sometimes I forget stuff like that myself: Did you click a link to go to
your test page?

"Stephen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
For some reason my webhost doesn't allow the HTTP_REFERER variable. I call
it up and it's empty, so I did a print_r($HTTP_SERVER_VARS); and there
wasn't a variable called HTTP_REFERER. I've heard that some servers disable
it. Since I have a dedicated server, how can I enable this variable again?

Thanks,
Stephen Craton
http://www.melchior.us




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



Re: [PHP] no phun intended!!!

2003-03-09 Thread Niels Andersen
LOL

I like PHP, but I also like wet girlies. But the two are not interchangable,
which is a pitty, becouse sometimes I really could use a wet girl, and I
only have PHP



"Khalid El-Kary" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> sorry, but if PHP (a great piece of knowledge) worths a wet girl for you,
so
> you don't know how to appreciate knowledge.
>
> "Both PHP and mod_perl are knowledge, science that's more honourful than a
> wet girl"
>
> Regards,
> Khalid Al-Kary
> http://creaturesx.ma.cx/kxparse/
>
> >http://www.fingers.co.za/arb/mod_perl.jpg
> >
> >If this starts a flame war, I'm going to be rather disappointed at people
> >that's not able to take a joke :P
> >
> >I think it's hilarious though...
> >
> >--
> >me
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> _
> MSN 8 with e-mail virus protection service: 2 months FREE*
> http://join.msn.com/?page=features/virus
>



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



[PHP] Re: save to file

2003-03-09 Thread Niels Andersen
You want to add a new line every time your form is submittet, am I right?

Then you should open the file for appending, using fopen(filename, "a")
instead of "w"

"Ryan Holowaychuk" <[EMAIL PROTECTED]> wrote in message
news:!~!UENERkVCMDkAAQACABgAu5ugyx6+hUW5gsOu6grgVMKA
AAAQGYzyr/XD3kWb/[EMAIL PROTECTED]
> I am trying to save to a text file.  And I have managed to do that part
> now, but what happens is when I save to the file, all the lines get put
> into one big line in the file.
>
> I am creating a roster input that I adding to our website:  No, name
> grade .
>
> The roster will contain 15 players
>
> So right now the implode puts everything on one line in the text file!!!
>
> So I am no sure if anybody can shed some light on this one.
>
> Thanks again
> Ryan
>
>  //create a new file
>$fp = fopen("/place/on/server/" . $HTTP_POST_VARS['team'] , "w");
>
>$file_data = implode("\t\", $_POST);
> //this would return values spit by tabs
> //write to the open file handle
>  fwrite($fp, $file_data . "\r\n");
> //close the file
>  fclose($fp);
>
> ?>
>
>
>
>
>



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



[PHP] Re: read -n lines from end of file - Empty array ?

2003-03-06 Thread Niels Andersen
$file = file('filename');

$line = end($file);
for ($i=0; $line && $i<10;$++)
{
   list (. and so on...
   $line = prev($file);
}


"Webdev" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
How to grab the last -n lines from a data file and display the stored data
Only the the last 10 line numbers coming back when I echo $i

How do I get the list($adnr, $user, $date, $listed   to catch the
datafields

datafile looks like
23|Werner|LastN|Street|etc|etc.|etc||
24|Veronika

// code start


$file = file("data/ads.data");
for ($i = count($file); $i > count($file) - 10; $i--)
foreach($i as $line) {
list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier,
$usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat,
$ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3,
$Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei,
$dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer);

print " $i  $Endzwei $End3 ";

};

// Code end



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



[PHP] Re: _FILES

2003-03-06 Thread Niels Andersen
Yes, $HTTP_POST_FILES is depricated, but it still works in PHP 4.

"John Taylor-Johnston" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> $HTTP_POST_FILES as opposed to $_FILES is older syntax? $HTTP_POST_FILES
is still compliant?
> John
>



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



[PHP] Re: Checking for empty values sent from a form

2003-03-06 Thread Niels Andersen
Since input from a form are strings, you can check like this:

if ($_POST['your_input_name'] == '')
  // field is empty

"Shaun" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there an easy way to scan through an array of values sent from a form
to
> see if any of them are empty?
>
>



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



[PHP] Re: syntax question

2003-03-06 Thread Niels Andersen
By the way, beware of possibly buggy code:

strpos() will return 0 if the string begins with '-', but it will return
FALSE if '-' is not found in the string.

Since both 0 and FALSE will evaluate to boolean false in your condition, you
may get weird results.

Use this instead: (strpos($a, '-') !== FALSE) ?

"Jimmy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm looking through some existing code for a project I'm working on, but
> I keep running into this syntax that I really don't understand. Here's
> an example:
>
> $a=strpos($a,'-')?explode('-',$a,2):array($a);
>
> What do the ? and the : do here?  I'm seeing this sort of thing all over
> and just have no idea what ? : do. Thanks.
>
>



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



[PHP] Re: PHP vs. CGI

2003-03-06 Thread Niels Andersen
That depends on the way you run PHP
If you run it a a server module, it may be more efficient.
If not, then it it less efficient than CGI, as the PHP script engine is a
CGI program itself, and has to compile and run your script after it gets
started itself.


"Spyproductions Support Team" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Does PHP use less system resources than CGI on a server?
>
> I have a bulletin board which is incredibly active, but there is a PHP
> sister to it.
>
> Thanks,
>
> -Mike
>
>



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



[PHP] Template engine extension

2003-03-06 Thread Niels Andersen
I have created a simple template engine extension. It is published at
http://zhat.dk/template/
It is very simple to install and use, and a PHP alternative (an include
file) is also provided.

No documentation available yet (sorry!!!), so have a look at the example
scripts.



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



[PHP] Re: Code Validator

2003-03-03 Thread Niels Andersen
PHP is not text markup, it is a kind of programming language. You can't just
validate code for "correctness", only for valid syntax. It may still contain
bugs. The syntax is checked by the parser, which is invoked when you run
your script.

Regarding HTML-output from your script, you can make sure that it is valid
using HTML templates. Validate the templates and make sure that your script
does not insert invalid content into it.
Use htmlentities() when in doubt.

"Beauford.2002" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Is there a code validater for HTML/PHP.  I have one for just HTML, but
once
> you introduce PHP it doesn't work.
>
> TIA
>
>



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



[PHP] Re: query strings(still broken)

2003-03-03 Thread Niels Andersen
So when you do request for:

your_script.php?var=hello%20world

And put this in your script

you get
hello%20world
printed?

"Sunfire" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> tried everything except session vars and the query string is still
broken...
> no matter what i do for some reason the browser wants to always put %20 in
> the middle of my words (i.e. hello world as one var will come out as
> hello%20world)
>
> any other ideas
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.458 / Virus Database: 257 - Release Date: 2/24/2003
>



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



[PHP] Re: Problems posting

2003-03-03 Thread Niels Andersen
Actually, I did not check the time. But I was online for more than 10
minutes and pressed my refresh button sevaral times. My post did not appear.

"Henry Grech-Cini" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Did you send this post at 17:17 and did it arrive at 17:22?
>
> "Niels Andersen" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > When I post something here, it first appears several hours later. How
can
> it
> > be so?
> >
> >
>
>



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



[PHP] Problems posting

2003-03-03 Thread Niels Andersen
When I post something here, it first appears several hours later. How can it
be so?



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



[PHP] Re: IP Addesses on local network

2003-03-03 Thread Niels Andersen
Do you have a DNS server on you network? Without it, it will not work.

"Chris Blake" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Greetings,
>
> Th command
>
> echo gethostbyaddr("ip.number.inserted.here");
>
> returns the name of the server when it`s an internet address.
> Is there a similar command that will return host names on a local
> network
>
> I tried using the above command putting in a LAN address, but it just
> returned the IP address.
>
> --
> Chris Blake
> Office : (011) 782-0840
> Cell : 083 985 0379
> It is reported that somewhere in the world, every 15 seconds, a woman
> gives birth to a child. She must be found and stopped.
>



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



Re: [PHP] Where to publish extension?

2003-03-03 Thread Niels Andersen
> Not sure how you define an extension, but you could take a look at my
> web site www.phpscriptsearch.com and see if it applies to listing it
> there. But like I said, it depends what you mean by extension.

Extension like in binary that is either an integral part of PHP or a
loadable module.

> As far as getting it into the next distro, not sure, I have put in a lot
> of effort trying to contact various people within the PHP group without
> any success at all.

Oh well... I am sure that they don't know what they are missing.

Regarding my extension, I just make a page for it under my domain and post
the URL in newsgroups...



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



[PHP] Where to publish extension?

2003-03-02 Thread Niels Andersen
Hello!

I have made a really great (or at least that is what I think) extension,
which I think everybody should use :))

Where should I publish it?
Is there any chance that it will make its way into a future distro?



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



[PHP] Re: testing for < 0

2003-03-01 Thread Niels Andersen
Data from POST is a hash table of strings, so you should use this to check
for zero:

if ($_POST['field'] == "0")
 // Zero was entered



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



[PHP] Re: session help

2003-03-01 Thread Niels Andersen

> i am having a terrible time killing the session
> someone please please help me...

This one works for me:
session_start();
$_SESSION = array();
session_destroy();

But I am surprised that there is no single command to kill the session.
The semantics of "session_destroy()" suggest that it does just that. But, as
you have found out, it does not...



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



[PHP] Re: php.ini

2003-03-01 Thread Niels Andersen
Check that php_gd2.dll is in your C:\PHP\ folder.

"Anthony Ritter" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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
>
>
>
>
>



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



[PHP] V_OPEN() causes crash?

2003-03-01 Thread Niels Andersen
Hello,

I did my first PHP extension (a simple template engine), and I found out I
could not ude V_OPEN() - it simply crashed PHP.

I then searched the web and found somebody mentioning something about a
function called VCWD_OPEN(), which works perfectly, but is not
documented

Any idea why did V_OPEN() crashes PHP?



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



[PHP] How to phpize?

2003-02-27 Thread Niels Andersen
I want to compile an extension, let's say the zip extension.
So I do the following:

cd /usr/src/php-4.2.3/ext/zip
phpize

Now, I understand that this should result in a shared library being
produced, but I can't find it.

Also, during the phpize process, I get following warnings:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_us"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
configure.in:17: error: possibly undefined macro: AC_MSG_ERROR
configure:2571: error: possibly undefined macro: AC_DEFINE
configure:2571: error: possibly undefined macro: AC_CHECK_LIB
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_us"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_us"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
autoheader: `config.h.in' is unchanged
You should update your `aclocal.m4' by running aclocal.

Please, tell me what to do, and I will be forever greatfull.



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



[PHP] Re: mysqldump

2003-02-27 Thread Niels Andersen
There mey, but need not be a space. As far as I know, the option scanner in
mysqldump ignores spaces between short options and their values.


"John Taylor-Johnston" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks!
>
> > exec("mysqldump -c -q database -u user -ppassword", $sql);
>
> Why is there no space between the -p and password?
>
> >-ppassword
>
> Am I wrong?
>
> Thanks,
> John
>



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