Re: [PHP] PHP ide?

2007-11-08 Thread Richard Heyes

Eclipse with PDT plugin


Scite. Not quite an IDE per-se, but still very very good and extremely 
versatile.



IDE of champions ;)


That somewhat subjective... :)

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] PHP installation

2007-10-31 Thread Richard Heyes

...
Thanks for the help. I've got it installed now. In the end I found that 
the server came with 5.1.6 installed (:/), which despite not being 
5.2.x, is still a jump from the 5.0.x I had before.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Compilers

2007-10-30 Thread Richard Heyes

Wolf wrote:

Anyone use compilers (linux based or Windoze) and which do you use?

Looking for something free (best) or low cost as we are doing some

> investigation on what methods are best for some of the stuff we have,

and I'm thinking a compiled PHP app should run faster.


There's the free eaccelerator. It doesn't spit out compiled php code, 
but it does have the same effect by caching the generated byte-code.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] PHP installation

2007-10-30 Thread Richard Heyes

Richard Heyes wrote:

Per Jessen wrote:

Richard Heyes wrote:


The following is in config.log:

configure:20028: checking whether libxml build works
configure:20055: gcc -o conftest -g -O2   conftest.c

  -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm 1>&5
/usr/bin/ld: cannot find -lz


Looks like you need to install libz. 


I installed various zlib and zlib-devel packages, but finally went with 
an rpm, but when I run `apachectl configtest` I get this:


Cannot load /usr/lib64/httpd/modules/libphp5.so into server: 
/usr/lib64/httpd/modules/libphp5.so: undefined symbol: 
apr_pool_cleanup_null


OK so now I'm back to compiling PHP after the ridiculous nightmare of 
rpms. I checked /lib and have the following:


[EMAIL PROTECTED] php-5.2.4]# ls -l /lib/libz.so.1.2.3
-rwxr-xr-x 1 root root 71744 Sep 21 19:23 /lib/libz.so.1.2.3

Is PHP looking for a different file?

Thanks.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] PHP installation

2007-10-30 Thread Richard Heyes

Per Jessen wrote:

Richard Heyes wrote:


The following is in config.log:

configure:20028: checking whether libxml build works
configure:20055: gcc -o conftest -g -O2   conftest.c

  -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm 1>&5
/usr/bin/ld: cannot find -lz


Looks like you need to install libz. 


I installed various zlib and zlib-devel packages, but finally went with 
an rpm, but when I run `apachectl configtest` I get this:


Cannot load /usr/lib64/httpd/modules/libphp5.so into server: 
/usr/lib64/httpd/modules/libphp5.so: undefined symbol: apr_pool_cleanup_null


Umm help?

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



[PHP] PHP installation

2007-10-30 Thread Richard Heyes

Hi,

Trying to install PHP, however it's failing with the following:

Configuring extensions
checking whether to enable LIBXML support... yes
checking libxml2 install dir... /usr/lib64
checking for xml2-config path... /usr/bin/xml2-config
checking whether libxml build works... no
configure: error: build test failed.  Please check the config.log for 
details.



The following is in config.log:

configure:20028: checking whether libxml build works
configure:20055: gcc -o conftest -g -O2   conftest.c

 -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm 1>&5
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
configure: failed program was:
#line 20044 "configure"
#include "confdefs.h"


char xmlInitParser();
int main() {
  xmlInitParser();
  return 0;
}



If it helps, this is a bit of an `ls -l` of /usr/lib64:

libxml2.so -> libxml2.so.2.6.27
libxml2.so.2 -> libxml2.so.2.6.27
libxml2.so.2.6.19
libxml2.so.2.6.27

And this is what's at the end of my config.log:

configure:19793: checking whether to enable LIBXML support
configure:19841: checking libxml2 install dir
configure:19870: checking for xml2-config path
configure:20028: checking whether libxml build works
configure:20055: gcc -o conftest -g -O2   conftest.c

 -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm 1>&5
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
configure: failed program was:
#line 20044 "configure"
#include "confdefs.h"


char xmlInitParser();
int main() {
      xmlInitParser();
  return 0;
}


Thanks.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Maximum function nesting level of '100' reached

2007-10-25 Thread Richard Heyes

Fatal error: Maximum function nesting level of '100' reached, aborting!
in /home/Projekte/spectral/modules/xml_mm/classes/xml_mm.class.php on
line 118


It seems pretty self explanatory. Do you have a lot of recursion?

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] how to restart php

2007-10-25 Thread Richard Heyes

Diana wrote:
How can I restart php so it takes changes in my php.ini without having to 
reboot my machine?

I have windows XP



You don't restart PHP, rather the web server whatever that may be. 
Usually it involves restarting the web server service. If you can, just 
restart the computer.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] mail from

2007-10-25 Thread Richard Heyes

Richard Heyes wrote:

in my php.ini, I have this set
sendmail_from = [EMAIL PROTECTED]

yet when I do this command :("[EMAIL PROTECTED]","TEST 
MAIL","TESTING MAIL");
I get this message Warning: mail() [function.mail]: "sendmail_from" 
not set in php.ini or custom "From:" header missing in 
C:\Inetpub\wwwroot\intranet\test.php on line 4


And if instead of using the php.ini directive you use the fourth 
argument to mail()?


Eg:





Oops. That should be:



--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] mail from

2007-10-25 Thread Richard Heyes

in my php.ini, I have this set
sendmail_from = [EMAIL PROTECTED]

yet when I do this command :("[EMAIL PROTECTED]","TEST 
MAIL","TESTING MAIL");
I get this message Warning: mail() [function.mail]: "sendmail_from" not set 
in php.ini or custom "From:" header missing in 
C:\Inetpub\wwwroot\intranet\test.php on line 4


And if instead of using the php.ini directive you use the fourth 
argument to mail()?


Eg:



--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] register globals not working

2007-10-25 Thread Richard Heyes

I have installed php v5 on a windowsXP PC. Server is Apache 2.2.
Even though I have turned register globals on in the ini file,

> the php is still not allowing the use of $HTTP_GET_VARS (and probably

other similier variables), and I am having to change my existing script

> to $_GET before they will run.


Any idea why the directive is being ignored?
Rodney Courtis


On? Register globals is widely considered to be a security hazard. 
Ideally you should be using the $_GET etc variables instead. Anyhoo the 
$HTTP_*_VARS are (IIRC) controlled by the track_vars directive. So turn 
that on, restart Apache, and then try.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Question about time...

2007-10-24 Thread Richard Heyes
I am attempting to get the logic of something figured out and I thought 
someone might be able to confirm what I'm thinking :)


I want to be able to display something like an image of a turkey during 
the month of november from now until I'm dead. I was playing around with 
mktime and it showed very different time stamps for 11/1/07 and 11/1/08
so I can't set it to compare specifically to the timestamp.. But, would 
I be able to have it evaluate the string stored in php as 11/1/07 and 
create a timestamp to compare todays date to, and if it matches within 
the month, have it display the turkey? and if not, have it display a 
different graphic?


I'm attempting to be able to make small changes to my website without 
having to remember to do them or change them :)


I hope I've made enough sense that someone can point me in the right 
direction :)


Well, I hope this makes sense:

';
}
?>

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Close a session knowing it's ID (not the current session)

2007-10-24 Thread Richard Heyes



You'll need to know the session_id of the session you want to close. The 
code above closes/ends the current users session, but simply substitute 
the desired session id (of course you'll need to know this in advance) 
for the call to session_id().


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] window.open() and search engines

2007-10-23 Thread Richard Heyes

If you want search engines to pick up your link then you can always
use . :)


Interesting. I hadn't thought of that.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: window.open() and search engines

2007-10-23 Thread Richard Heyes

Freyjkell wrote:

Richard Heyes wrote:
Can anyone say for sure whether window.open() links get spidered by 
search engines?




Not This Group


Not what group?

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



[PHP] window.open() and search engines

2007-10-23 Thread Richard Heyes
Can anyone say for sure whether window.open() links get spidered by 
search engines?


Thanks.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Php generated html email

2007-10-23 Thread Richard Heyes

Ronald Wiplinger wrote:

How can I create a html email directly from a web page via Php?
The page will include tables, background colors and pictures within the 
tables. The received email should be readable without Internet 
connection (pictures, must be sent with the email)


http://www.phpguru.org/static/htmlMimeMail5.html

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: Unsetting a header

2007-10-22 Thread Richard Heyes

Freyjkell wrote:

D Richard Heyes wrote:
Does anyone know of a way to unset a header? I have an Expires: header 
that I believe Apache is setting, and I don't want it. Thanks.


Do you really need to remove this header?


I do.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes

Richard Heyes wrote:
FWIW, I found what was setting the cache headers - sessions. I may be 
able to use session_cache_limiter(). Not Sure.


Further, I found this to be what I needed:

session_cache_limiter('private_no_expire');

Cheers.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes
FWIW, I found what was setting the cache headers - sessions. I may be 
able to use session_cache_limiter(). Not Sure.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes
Sorry, I didn't articulate what I meant very well. What I meant was that 
you know the churn rate of your pages, so put in sensible expiry headers 
based on that info.


Unfortunately I can't foresee when the pages are changed (it won't be me 
who changes them).


But the better way to solve it is to edit the Apache configuration to 
stop it putting the headers in in the first place. Why can't you do that?


I could. I just don't know how to unset a header.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes
I'm well-aware of what the headers are for, but you can construct expiry 
headers that match the last-modified header.


If I do that the Expiry: header will be in the past and the page will be 
considered expired.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes
Maybe I'm being dense, but why not set it to what you want it to be? 
Clearing it is leaving the decision up to the browser which will not 
necessarily have the effect you want for all users.


Incidentally, it might not be possible if Apache is setting it. Not sure 
if PHP has the ability to override headers being sent by Apache.


The two have different effects. The Expires: header proclaims that the 
page is good for x hours/minutes/days etc. Whereas the browser can use 
the Last-Modified header to figure the staleness for itself. If its 
newer than the copy it has, it needs to download the newer copy.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-21 Thread Richard Heyes

Have you tried setting the value to FALSE, NULL, or something else?


Yes, nada I'm afraid.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-21 Thread Richard Heyes

[EMAIL PROTECTED] wrote:

Try this never gives me a problem. I use it to keep proxy servers from
caching.


But I want the page to be cached...

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-21 Thread Richard Heyes

Try this never gives me a problem. I use it to keep proxy servers from
caching.




Yes but I want to unset an Expires: header and not give a any value.

1. PHP (I believe) is setting an Expires: header.
2. The Expires: header is causing the page to be cached too long,
   Longer than the Last-Modified: header would allow.
3. Setting the Expires: header to garbage, eg: Expires: none causes
   no caching to occur at all.

Let me reiterate, I want this page to get cached, but not based on an 
Expires: header. Rather a Last-Modified header.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



[PHP] Unsetting a header

2007-10-21 Thread Richard Heyes
Does anyone know of a way to unset a header? I have an Expires: header 
that I believe Apache is setting, and I don't want it. Thanks.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: newbie questions

2007-10-21 Thread Richard Heyes

Ravi wrote:


Richard, unfortunately I cannot end the script. I need something like this:

http://www.yahoo.com');
// somehow let the browser move to yahoo.com
// now update the database to store some information about user
exit;
?>


In that case you might want to look at register_shutdown_function().

Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: newbie questions

2007-10-21 Thread Richard Heyes

Ravi wrote:


That was very very helpful. Thanks a ton!

One more question. For every request, I am sending a redirect back to 
the user and the browser takes the user to another url. The problem is 
that the browser is not redirecting until the script finishes. Even if I 
do flush(), the browser waits til script ends. Is there a way to force 
browser to redirect and not wait for the script to end?


In Java I can think of many ways, one is to use threads, hand of data to 
another thread and return the response. Another solution would be to 
store data in memory (static variable) and update only after every 100 
requests.


Not having read the rest of the thread, you could call exit just after 
the redirect header is sent, eg:


http://www.yahoo.com');
exit;
?>

Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Rename does not work

2007-10-19 Thread Richard Heyes

Sascha Braun | CEO @ BRAUN Networks wrote:

I am using the rename function on my local development
system fine. But as soon as I upload the script, the
rename function does not work anymore.

Is there a specific compiler flag needed, to make rename
work on both plattforms?


You're using different platforms for developing and your live version? 
Mistake number one. As for the rename issue, first guess is permissions. 
As in, you don't have them.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Security Question

2007-10-17 Thread Richard Heyes

Does anyone know a good way to protect a directory that a php script NEEDS
to write too?

What I'm doing now:

1. create a directory manually "myDir"
2. chmod 777 myDir
3. password protect the directory with htaccess

Is this the best way, or is there something better?


You could chmod the file/directory to 700 and change the owner to that 
of the webserver (presumably the script is being run via the webserver). 
This has the drawback that anything run from the webserver will have 
write access to the files.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] How to replace define in a require file with mysql?

2007-10-17 Thread Richard Heyes

I have a file linked with require into my program with statements like:

define("_ADDRESS","Address");
define("_CITY","City");

I would like to replace this with a mysql table with these two fields
(out of many other fields).

How can I do that?


I'm not aware of any method of "undefining" an already defined constant. 
Except changing the line in your required file...


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Screenshot from web page

2007-10-16 Thread Richard Heyes

I would like to make web page screenshot and generate an image for
example .jpg or .png using PHP,Apache.

If any one has experiance in doing that please help.

I know that there are lot of services like that, but I don't want to 
use them.

In real I need that to generate screenshot of my local server pages.

  
There is a firefox extension called "screengrab" to do just that... The 
results are, well, perfect! the URL is:


https://addons.mozilla.org/es-ES/firefox/addon/1146



If you're not talking about automated screenshots, and you're using 
Windows, just press your "PrtScr" button. Hold down Alt as well to get 
just the active window. This will put the screenshot on to the 
clipboard, so you'll then need to paste it into paint or other such 
graphics program (PSP, Photoshop) after which you'll then be able to 
save it to a file.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Parsing Strings

2007-10-15 Thread Richard Heyes

Philip Thompson wrote:
> ...



HTH

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] preg_match_all Help

2007-10-12 Thread Richard Heyes

[EMAIL PROTECTED] wrote:

...

It would help to see the input text and to know exactly what you're 
trying to match.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] How to format CLI tabular data?

2007-10-09 Thread Richard Heyes

Daevid Vincent wrote:

I write many CLI scripts in PHP to clean up DB records, etc via crontab
scripts. Often though, I implement command line switches to 'debug' or see
various data as a precaution before actually purging.

Perl has some neat tools built in to format tabular data:
http://www.usenix.org/publications/perl/perl08.html

Does PHP have any tools like this?


The PEAR class Console_Table will do this for you.


I'd prefer not to pull in some PEAR
package or other bloat


PEAR does not automatically mean bloat. It does however automatically 
mean less work for you.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Structure of maintainable websites

2007-10-09 Thread Richard Heyes
So, my question is: are there any good practices that I should be aware 
of or example websites I can study, that will give me the knowledge I 
need? I'm not looking for references on general software design 
approaches, but practical information on how to apply them to PHP websites.


You could do worse than looking at this:

http://www.phpguru.org/static/ApplicationStructure.html

Lots of people like to over complicate their structure, but this (I 
find) usually suffices. Plus it's easy to navigate and interpret.


PS. Smarty has nothing to do with structure - it's got everything to do 
with needlessly reducing performance.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



[Fwd: Re: [PHP] Bind function parameters with create_function ('currying')]

2007-09-05 Thread Richard Heyes


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support
--- Begin Message ---
Of course, my apologies.
I've simplified it from the actual code and also removed the string
parameter as the object one is the problem:

// create the model and replacer function
> $model = new $modelName();
> $replacer = curryModelReplacer($($model);
> // ...
>
> /** Curries model_replacer. */
> function curryModelReplacer($model) {
>return create_function('$matches', "return modelReplacer($model,
> \$matches);");
> }
>
> /** The callback for preg_replace_callback. */
> function modelReplacer($model, $matches) {
>// do the replacement...
> }
>

So effectively I want to create a new anonymous function wrapping
modelReplacer which has the $model parameter already set. The problem is
obviously that I can't put $model in the string.
Is there a better alternative approach for currying in PHP that will enable
me to bind an object to a parameter?

TIA,
--rob


On 9/4/07, Richard Heyes <[EMAIL PROTECTED]> wrote:
>
> > I have a function which is my callback for preg_replace_callback - and
> it
> > needs to be able to access a string and an object outside of itself.
> > When I call create_function I can insert the string, but without
> serializing
> > the object I can't figure out how to make it available to the function
> > without making it global, which seems nasty.
> >
> > I've tried 'currying' the function - creating a new function out of it
> with
> > the string and object parameters bound, but have the same problem - I
> can't
> > get the object into the function.
> > Can anyone point me towards a good solution? I guess I could also create
> a
> > class with the one function, but that seems a wee bit messy to me.
>
> It would be helpful if you could post a bare-bones example.
>
> --
> Richard Heyes
> +44 (0)800 0213 172
> http://www.websupportsolutions.co.uk
>
> Knowledge Base and HelpDesk software
> that can cut the cost of online support
>



-- 
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
"There's a whale there's a whale there's a whale fish" he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.
--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Bind function parameters with create_function ('currying')

2007-09-04 Thread Richard Heyes

I have a function which is my callback for preg_replace_callback - and it
needs to be able to access a string and an object outside of itself.
When I call create_function I can insert the string, but without serializing
the object I can't figure out how to make it available to the function
without making it global, which seems nasty.

I've tried 'currying' the function - creating a new function out of it with
the string and object parameters bound, but have the same problem - I can't
get the object into the function.
Can anyone point me towards a good solution? I guess I could also create a
class with the one function, but that seems a wee bit messy to me.


It would be helpful if you could post a bare-bones example.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: Generating foldout menus in php

2007-09-03 Thread Richard Heyes

Zoltán Németh wrote:

2007. 09. 3, hétfő keltezéssel 16.34-kor Colin Guthrie ezt írta:

Zoltán Németh wrote:

hmm on Linux/Firefox I can not see any custom menu... there's a box
saying "Right click here to see menu" - I tried right click, left click,
double click there and nothing happens. (on right click the standard
firefox context menu appears)

Works for me with FF2 on Linux. Perhaps some extension is getting in the
way?


I checked with 1.5.0.12 and 2.0.0.6, on two separate machines, both have
WebDeveloper and AdBlock plus plugins installed and both run on
(different versions of) Ubuntu...
so it might be WebDeveloper or the AdBlock plus, I don't know...


Wow, I've (now) tried it mine (1.5.13) and it seems to work flawlessly. 
Shocking.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: Generating foldout menus in php

2007-09-03 Thread Richard Heyes

Colin Guthrie wrote:

Zoltán Németh wrote:

hmm on Linux/Firefox I can not see any custom menu... there's a box
saying "Right click here to see menu" - I tried right click, left click,
double click there and nothing happens. (on right click the standard
firefox context menu appears)


Works for me with FF2 on Linux. Perhaps some extension is getting in the
way?


Really? That surprises me since the "layer" it uses is (or was) IE only. 
I guess FF2 supports it.



--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Generating foldout menus in php

2007-09-03 Thread Richard Heyes

I'm looking for a way to generate dropdown/foldout menus (horizontal and
vertical) on the fly, but all the javascript solutions I've seen use
absolute or relative pixel positioning, which means I can't use them because
I don't know at the time of generating a specific menu item how many pixels
across or down the preceding items have already used. I'm currently using a
javascript menu that works really well, but all the top-level menu items
have to be preset with specific x-y pixel coordinates, and all the
subsequent items are then relative to the top-level items. So I can generate
the second-level and subsequent items on the fly but not the top-level
items. Is there a way to use css or dhtml or something else (maybe something
in javascript that I missed) to do this?


Is this: http://www.phpguru.org/static/dynContext.example.html what you 
mean?


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] what is my dns ip address

2007-09-02 Thread Richard Heyes

Stut wrote:

Richard Heyes wrote:

Or read the contents of /etc/resolv.conf

Faster for static DNS servers, but if you're using DHCP assigned
servers, they aren't likely to be in there.


Yes they are.  The DNS resolver has just one place to look, and
that's /etc/resolv.conf.  


The DNS resolver? What? If DNS servers are assigned by DHCP how will 
they be in resolv.conf?


Because dhcpclient overwrites resolv.conf when it gets DNS details from 
a DHCP server.


I see. Didn't know that, (never used DHCP on *nix).

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] what is my dns ip address

2007-09-02 Thread Richard Heyes

Or read the contents of /etc/resolv.conf

Faster for static DNS servers, but if you're using DHCP assigned
servers, they aren't likely to be in there.


Yes they are.  The DNS resolver has just one place to look, and
that's /etc/resolv.conf.  


The DNS resolver? What? If DNS servers are assigned by DHCP how will 
they be in resolv.conf?


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] [EMAIL PROTECTED]: Re: [PHP] what is my dns ip address]

2007-09-01 Thread Richard Heyes

Robert Degen wrote:

Or read the contents of /etc/resolv.conf


I'm not familiar with, but does any MS product have any 
comparable file?


There is a hosts file, but no resolv.conf or equivalent AFAIK.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] what is my dns ip address

2007-09-01 Thread Richard Heyes

Or read the contents of /etc/resolv.conf


Faster for static DNS servers, but if you're using DHCP assigned 
servers, they aren't likely to be in there.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] what is my dns ip address

2007-09-01 Thread Richard Heyes

Olav Mørkrid wrote:

is there a function in php that will return the ip address of the dns
server on the system?

eg.

$dns_ip = get_dns_ip_address();



Don't know of a specific command that returns them, but you could parse 
the output of nslookup and cache the results.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] regular expression question

2007-09-01 Thread Richard Heyes
But how? The +[a-z]{2,} seems to allow at least two a-z clusters, but it 
doesn't include a period. /ml


Almost correct. The plus belongs to whatever comes before it, not after. 
So what you're referring to as matching two or more characters but not 
the period, is this:


[a-z]{2,}

And this will match one or more  "subdomains":

([-a-z0-9]+\.)+

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Round

2007-08-29 Thread Richard Heyes

What if I expected -1 for the last answer?


Then only use abs() if the result from round() is zero;

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Round

2007-08-29 Thread Richard Heyes

Koen van den Boogaart wrote:
No, I want it to go to float(0), so minus the minus. "-0" doesn't exist in 
math, as far as I know. Probably a precision thing.


Ok, then try abs() first then.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Internet Explorer Caching

2007-08-29 Thread Richard Heyes

Charlene wrote:
I've been having problems with Internet Explorer caching php programs.  
I'm using the following code:


   header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
   header("Pragma", "no-cache");
   header("Expires", "-1");

And it used to work, but now, according to Windows Explorer its giving 
it 3 hours to expire.


Are you sure? By default PHP pages/scripts don't send any caching 
headers and hence don't get cached. You can check this using: 
http://www.fiddlertool.com


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Round

2007-08-29 Thread Richard Heyes

Koen van den Boogaart wrote:

Is it expected behaviour that



outputs

float(-0) 



Yes. You (probably) want:



http://uk.php.net/manual/en/function.round.php

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Trying to understand sessions and using them to authenticate...

2007-08-29 Thread Richard Heyes

Ford, Mike wrote:
> On 28 August 2007 15:56, Stut wrote:
>
>> Jason Pruim wrote:
>>> One other question, to logout, can I just call a file that has
>>> session_destroy() and a header("Location: ???"); in it? Or should I
>>> do something else for logging out?
>> foreach (array_keys($_SESSION) as $key)
>>  unset($_SESSION[$key];
>> session_destroy();
>
>$_SESSION = array();
>session_destroy();
>session_commit();
>setcookie(session_name(), "",
>ini_get('session.cookie_lifetime'),
>ini_get('session.cookie_path'),
>    ini_get('session.cookie_domain'));

$_SESSION = array(); will usually suffice.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] phpinfo problem

2007-08-13 Thread Richard Heyes
The default value for short_open_tags was flipped a while back. Might 
I suggest you read the changelog next time you upgrade to a newer 
version - it tells you important stuff like that.


The problem people will have is having to go through ALL the PHP5 
changes when converting from PHP4.


Why is that a problem? I would have thought that that is automatic. 
Surely you're not suggesting that people are upgrading from PHP4 to PHP5 
without exhaustive testing?


> That particular one adds a lot of
characters to files on some PHP4 upgrades, where there are lots of  
- so switching it is the quicker fix.

   ^ on ?

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] phpinfo problem

2007-08-13 Thread Richard Heyes
The default value for short_open_tags was flipped a while back. Might I 
suggest you read the changelog next time you upgrade to a newer version 
- it tells you important stuff like that.


And, FWIW, never use short tags. Always use http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] preg_match_all to match tags

2007-08-11 Thread Richard Heyes

 > < img src="image.jpg">

Your script doesn't catch above ;)

So don't write HTML like that.


 Depends where the HTML is coming from, it might be user input


Ok, add \s* after the initial angle bracket.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] preg_match_all to match tags

2007-08-11 Thread Richard Heyes

 > < img src="image.jpg">


Your script doesn't catch above ;)


So don't write HTML like that.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] preg_match_all to match tags

2007-08-11 Thread Richard Heyes

Richard Heyes wrote:

How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.


preg_match_all('/]*>/Ui');

Off the top of my head. This wouldn't allow for using the right angle 
bracket in the img tag, but that's almost never going to happen in reailty.


Oops that should be:

preg_match_all('/]*>/Ui', $input, $matches);

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] preg_match_all to match tags

2007-08-11 Thread Richard Heyes

How can i match an image tag correctly so it does not cause any issues
with how the user adds the image.


preg_match_all('/]*>/Ui');

Off the top of my head. This wouldn't allow for using the right angle 
bracket in the img tag, but that's almost never going to happen in reailty.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] magic quotes

2007-08-11 Thread Richard Heyes

I added the code to my script and I still ended up escaped quotes.
if(ini_get('magic_quotes_gpc')) $_POST['data'] =
stripslashes($_POST['data']);  Didn't work at all.  I think I read something
about it not working on runtime data. Like gpc if this is correct do you
have another solution?  I put this line in the .htaccess file it didn't work
either: php_flag magic_quotes_gpc off... Is there anyway possible? I don't
need it now but it'd be nice to know for the future dev.


http://www.phpguru.org/article.php?ne_id=58

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Running a server process

2007-08-10 Thread Richard Heyes

That is it works with just me using the site.  I am wondering how this would
effect performance if say 500 people were executing this php function around
the same time and the processing overlapped.  Is there anyway to make an
executable run as a service, I am guessing at the terminology that I should
use here, but I feel there would be a much more efficient way of performing
this task.


Well, ideally you don't run an executable. But if you must, there's some 
Windows program that turns an executable into a service. But then 
there's the consideration of communicating with it, which you could do 
with sockets. Or you could use a file.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



[PHP] Hosting cost

2007-08-10 Thread Richard Heyes

This is off topic so feel free to reply off list.

My question is how much is it reasonable to charge for the following:

1. Building a very small website (you can see it here:
   http://www.cleardebtadvice.co.uk)
2. Hosting it for two years
3. Providing email accounts as need be
4. Probably a days worth of update work

I not interested in actual costs, but more commercial worth.

Thanks.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Forwarding $_POST[]...

2007-08-09 Thread Richard Heyes



I could do something complicated and store the $_POST vars in $_SESSION[],
but what I'd rather do is simply add a var to $_POST[] and resubmit this to
the same .php.

Is their any way to do this, or do I need to rethink things?


There's nothing complicated about using sessions.



--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] javascript in or in ?

2007-08-07 Thread Richard Heyes

C.R.Vegelin wrote:

Are there any rules when to include javascript in  or in  ?
For example, 

</tt><pre style="margin: 0em;">
function reload(form)
</pre><tt>{  var val=form.Chapter.options[form.Chapter.options.selectedIndex].value; 
</tt><tt>   self.location='QueryForm.php?Chapter=' + val ;
</tt><pre style="margin: 0em;">
}



Either really. Both work.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: passthru

2007-08-06 Thread Richard Heyes

Does anyone know way to passthru man pages so they don't show the
ascii formating?

You could:

1) Replace all newlines (ASCII 10) with a  tag. htmlspecialchars()
   will do this for you.


Does it? I thought it only replaced entities. \n is not a "special char"
in html lingo in that you can include them happily in a document and it
is still syntactically correct!

I believe you want the nl2br() function instead here.


Ah yes. My bad.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] passthru

2007-08-06 Thread Richard Heyes
Does anyone know way to passthru man pages so they don't show the ascii 
formating?


You could:

1) Replace all newlines (ASCII 10) with a  tag. htmlspecialchars()
   will do this for you.
2) Use a  tag within which newlines are preserved
3) Use preg_replace to replace non-printable characters (Can't remember
   how exactly, but everything you need is in the manual - you will want
   to strip everything from ASCII 1 - ASCII 32. IIRC.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Adding to time having a timestamp

2007-08-06 Thread Richard Heyes

How can I add a day to a date if I have a timestamp. Here is my line:

list($d,$m,$y,$dayname,$monthname,$am)=explode(' ',date('d m Y D M a',
$timestamp));


Simply add 86400 (number of seconds in a day).

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Problem with php mail

2007-08-05 Thread Richard Heyes

I'm having problem with php mail.  When I try to create an

> html message with only mydomain,

gmail is registering it as a spam while yahoo is not.
Can you suggest solutions to my problem.


Try sending a real message. Messages being too small is one indicator of 
a message being junk.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] About PHP/MYSQL Pagination

2007-08-04 Thread Richard Heyes
I just couldn't find it anywhere, google or yahoo. I know how to make 
first, previous, last, and next links for php/mysql pagination. How do 
you list page numbers in the middle, between previous and next? (ex. << 
first previous | 1 2 3 4 5 | next last >> )


I know how to display them from 1 to whatever by using for loop, but the 
problem comes in when I click "next" from page "5", it does not get 
re-listed starting from page "6".


The PEAR Pager package might be able to help you.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] output the schema

2007-08-03 Thread Richard Heyes

I reword my last post.

I want to take the result and generate the field info to the screen e.g


Well, if you're using MySQL you could use either "DESC ;" or 
"SHOW CREATE ...". But you can't really generate the schema from a 
result set.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] php SHOW

2007-08-03 Thread Richard Heyes
Is there a way to output my data and tables using a php version of SHOW? 
Doesn't have to be pretty HTML just output to screen


If you're referring to PHP data types (arrays, strings, ints etc) you 
could use either var_dump() or print_r().


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Which PHP-Editor to use?

2007-08-02 Thread Richard Heyes
I have worked now for several years happily with homesite 4.5, but now 
it looks like I have to switch to another system as homesite will not 
run without admin rights on a XP machine.


What editors do you use? Do you have any recomendations on a special 
one? I have looked into eclipse, but I would hear from your experience 
which one would you recommend me to switch to?


I used to use Homesite, but it was a buggy POS. Try Scite at 
http://www.scintilla.org.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] $_POST- Vars -> Back-Button

2007-08-01 Thread Richard Heyes
this might be a noob- question, but I simply do not care anymore. After 
a few hours of fiddling with this @/**&%$ (screaming "AAa"), I 
would like to ask you.


So what I have is this: I have a search engine for a car market, which 
has about 30 $_POST- vars. Now when the user clicks on a result link, it 
takes him to the car details page. Now when he hits the back button, he 
either gets the "Page has expired" (IE) or the "Wanna send the form data 
again" message box (FF).


Now I would like to have kind of a "back-button", so the user will see 
the reusult list again without having to deal with this.


I guess what I'm asking for is a one-click re-submission of POST data... 
Do you have a clue on how to do this?


The "resubmit" page is being displayed because the results page is the 
result of a form POST. You can do one of two things:


1. Change your search form to a GET request.
2. Stuff the existing POST data into the session and have your results 
page use that before looking to the POST data.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Changing URLs from Relative to Absolute

2007-07-30 Thread Richard Heyes

I was recently trying to write a script where a user copy and pastes their
HTML code to display something on a listings site and tried to find a way to
change the URL of an image from relative to absolute.
For example  becomes http://domain.com/images/1.jpg";>.
That is easy enough and I created a regexp, but I found that some people
call the img tag differently such as:

Does anyone have experience of this? How can I create a regexp that will
find it in every case?


You could try this (from my rather poor memory):

/http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Authentication

2007-07-28 Thread Richard Heyes

I looked on PHP.net but I couldn't not find anything suitable to answer my
question.

Within PHP, is there a way to pull the name of the user that is currently
logged into the PC?

I know with some of the _SERVER functions you can pull the IP of the machine
and other data, is there a function within this family that would work?


If you're running your PHP script on IIS, maybe. Use print_r():



--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Is it possible to stop an image from being cached?

2007-07-27 Thread Richard Heyes

Dan wrote:

...

You should also look at this:

http://www.mnot.net/cache_docs/

Very informative.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] HTML Email Composing Problem.

2007-07-27 Thread Richard Heyes

 > 0.6 HTML_SHORT_LENGTH  BODY: HTML is extremely short

Well, lengthen it then.

1.5 MIME_BASE64_TEXT   RAW: Message text disguised using base64 
encoding


Don't do that. Use plain text or quoted printable.


Any help/suggestions would be appreciated.


Try HTML MIME mail - it does every thing for you:

http://www.phpguru.org/static/htmlMimeMail5.html

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Hide the real URL

2007-07-26 Thread Richard Heyes



how can I show it like this:




1. Make your links point to 
2. In show.php, try the following:

http://www.mnot.net/cache_docs/ or use Fiddler to
// find out what headers are being sent to your browser:
// http://www.fiddlertool.com

header('Content-Type: image/jpeg');
passthru($file);
}

?>

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: appendChild(), removeChild()

2007-07-26 Thread Richard Heyes

Man-wai Chang wrote:

If the child refers to a file, is it client-side only? I meant it's
nothing like AJAX, right?

Since JS runs on the client, yes.


... or unless the file was cached, right?

I am reading about these stuffs lately. :)


JavaScript (The main part of AJAX) runs on the client. Using AJAX you 
can have it call stuff on your server, but mainly it is client side only.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] appendChild(), removeChild()

2007-07-26 Thread Richard Heyes
Man-wai Chang wrote:
> If the child refers to a file, is it client-side only? I meant it's
> nothing like AJAX, right?

Since JS runs on the client, yes.

-- 
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] magic quotes

2007-07-17 Thread Richard Heyes

What do people on this list usually do with this kind of problem. To
me, the .htaccess seems the easiest solution, since I don't have to
change any scripts.


Use a .htaccess file, or if performance is any sort of concern, put it 
in the server configuration files and turn off .htaccess files.


Failing that you could do it in the script with your 
stripslashes_array() function, but you should only do it when you need 
to. eg. There's no point using it on $_COOKIE if you're not using $_COOKIE.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-16 Thread Richard Heyes

Tom Ray [Lists] wrote:

Richard Heyes wrote:

>> Every single

one of us has been guilty of it at some time or another


You can't make that assumption.

Sure he can. Assumptions are like opinions which are like ...well you 
know what I'm getting at...we all have them. And if someone can honestly 
say they've never stolen ANYTHING in their life, I'd be hard press to 
buy it.


OK so he can make it, though whether he'd be right or not is another 
matter. And assumptions are nothing like opinions.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Re: Pirate PHP books online?

2007-07-16 Thread Richard Heyes

>> Every single

one of us has been guilty of it at some time or another


You can't make that assumption.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] html emails and plain text dectection

2007-07-16 Thread Richard Heyes

Ross wrote:
I am using the code to send an html email (phpmailer class) now I need to 
somehow determine if the recipient uses text only email and change email to 
plain. Is this possible?


No.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] PHP mail with attachment

2007-07-16 Thread Richard Heyes
Use something like http://phpmailer.sf.net/ which handles everything for 
you already :)


Or:

http://www.phpguru.org/static/htmlMimeMail5.html

and

http://www.phpguru.org/downloads/html.mime.mail/

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] preg_replace() help

2007-07-14 Thread Richard Heyes

What am I doing wrong?


Using regular expressions when you don't need to:

$txt = str_replace(' ', ' ', substr($txt, strpos($txt, --)));

Might be a few typos in there. And I may have mixed up the args.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] URLs

2007-07-12 Thread Richard Heyes
This may or may not be a PHP question - I'll let the group decide. Note 
this URL:


http://www.someplace.com/SomeDirectory/SomeFile

compared to this URL:

http://www.someplace.com/SomeDirectory/SomeFile.php

Okay. How does one create the URL with no file extension? Is this done 
through PHP or is this a server setting? Thanks in advance!


A number of ways. You could use mod_rewrite, though you shouldn't if you 
care at all about performance.


Directories. ie. Make SomeFile a directory with an index.php file in it. 
You will end up up with a trailing slash on the URL though.


ForceType (IIRC). Use this directive in Apache to specify that SomeFile 
is actually be parsed by PHP. SomeFile should be a PHP script. Or 
SomeDirectory could actually be a PHP file again used with ForceType 
which inspects the URL and serves up the correct content.


The ForceType method is used on phpguru.org to make "static" look like a 
directory. It's actually a PHP file that shows the correct template 
based on the URL.


Eg:

http://www.phpguru.org/static/positioning.html

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Creating 'Next' & 'Previous' for PHP Photo Gallery

2007-07-10 Thread Richard Heyes

I know that $key holds the sequence of images that are being picked up by
glob() - I¹m just trying to figure out a way to use this $key to generate
the Next & Previous link. The problem is ­ everything is passed on to a
separate page (photo.php) ... What I¹m thinking is determining which Photo
File would be Next or Previous to the one being selected, and passing that
along to the (photo.php) page. I¹m just not able to figure out how to pick
out the next & previous filename and place it in the Query String.


Not sure if this will be of any help, but you could look at the Pager 
class in PEAR.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Re: how PHP is batter?

2007-07-03 Thread Richard Heyes

Colin Guthrie wrote:

Muhammad Hassan Samee wrote:

ASP.net VS PHP?

how PHP is batter?


I think you mean "Why is PHP better?" :p (batter is what you make
pancakes out of, or if you are in Scotland it's means to get beaten up -
e.g. "I'll batter you, ya wee radge" :p)


"radge" ?

What's that in English :) ?

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] calling parent class method from the outside

2007-07-02 Thread Richard Heyes

admin wrote:

Inside the body of method foo() you can of course use syntax like
parent::foo(). But is there a way to call the parent version of
obj->foo() outside the class? That kind of syntax is allowed in C++, for
example: Aclass a; if (a.Aparent::foo()) ...;


Not sure I get your requirement exactly, but you could try this:

class A
{
public function foo ()
{
// ...
}
}

class B {
public parent;

// Constructor
public function __construct ()
{
$this->parent = new A();
}
}


// And then...

$b = new B();
$b->parent->foo();

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk
Currently looking for partnerships

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



Re: [PHP] shuffle or mt_rand

2007-06-29 Thread Richard Heyes

Ryan A wrote:

Hey,

Have a quick question about which is better to get real random values, shuffle 
or mt_rand.

I am trying to shuffle a deck of cards and reading another thread I saw that 
after a

> couple of thousand random generations patterns have been observed
> using rand()... so its better to use mt_rand().

Well they do different things - shuffle() randomises an array, whereas 
mt_rand() gives you a random number. If you want to randomise an array, 
use shuffle(). If you want a random number, use mt_rand().


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Database administration framework

2007-06-26 Thread Richard Heyes
The DB ist mysql. 

No, you didn't understand me clearly.  


I need a framework, toolkit, class call it how you want, with wich I develop
an application that administrates the data's in the database. Something like
Smarty but more specific for what I need. 


The ideea is the following:
I have 20 tables that have data's in them. And these table data's must be
edited with this admin tool.  There are very few joins but there are
references between the tables. 


You could try MySQL TableEditor:

http://www.phpguru.org/static/TableEditor.html

It's a (big) one file class which is good for editing the tables, though 
it's not phpMyAdmin; you can't "administer" the database.


--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] generate an etag header that apache can subsequently use, how?

2007-06-23 Thread Richard Heyes

Jochem Maas wrote:


but ... I need more speed ...


Don't we all? Try these:

1. stat() is slow, try not to use it
2. Don't pass images through PHP if at all possible
3. Get Fiddler (www.fiddlertool.com) - It will let you see the HTTP
   response headers. It will show what's actually being requested from
   you server. Typically, images are cached by the user agent , whereas
   PHP files are not.
4. Don't use mod_rewrite if at all possible
5. Recompile Apache with just the modules you need
6. Recompile PHP with just the stuff you need
   NB: You can always recompile later if your needs change
7. Don't use off the shelf components when you don't need to. PEAR::DB
   is one example - I was using this but then mimicked the API saving
   50k of code. Quite significant if you're not using an accelerator.

--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Encoding of PHP files

2007-06-22 Thread Richard Heyes

Jochem Maas wrote:

Richard Heyes wrote:

Guus Ellenkamp wrote:

What encoding should a PHP file itself have (so not it's output setting).

Plain ASCII AFAIK.


huh?
I generally save my files in the same encoding as the output encoding of the 
site,
this is so that literal strings are output correctly.


I don't know - I'm English.

--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Encoding of PHP files

2007-06-22 Thread Richard Heyes

Guus Ellenkamp wrote:

What encoding should a PHP file itself have (so not it's output setting).


Plain ASCII AFAIK.

--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Is There a Function to .... to [yada] ..... [/yada]?

2007-06-21 Thread Richard Heyes

Stephen wrote:
I can't find one. 
   
  Thanks

  Stephen


Ahh yes, you want the yada() function. Alternatively if you're after 
something to turn  into [yada] you could try the regex functions 
(PCRE).


--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Program Execution and reading results

2007-06-21 Thread Richard Heyes

hmm I thought the OP's question was about how can he get output/return
value from the external program (the file name for example) - maybe it
was my misunderstanding


In which case I would still use shell_exec():



--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Program Execution and reading results

2007-06-21 Thread Richard Heyes

use exec() instead of shell_exec()


Why?

--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Program Execution and reading results

2007-06-21 Thread Richard Heyes

makhan wrote:

Thanks Paul for your response. my issue is not just reading from the output
text file. But my issue is what I would do in the php script while the
program is execting( i.e after issueing shell_exec() command) and how would
i know that file has been written so that i can read it using php.


Not having read the rest of the thread, the script would issue the 
exec() or shell_exec() command and continue only when the command has 
finished. You can  see this (on Unix) by this code:




In effect, this script will wait 60 seconds before ending.

--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



Re: [PHP] Threading

2007-06-20 Thread Richard Heyes
I've done a fair bit of research on threads in PHP in the past, but 
coming up to the conclusion that there is no way to have real multi 
threading in PHP.


There's no way full stop.

> Would anybody here know of any way to use threads in PHP that I may
> have missed? I'm hoping to find a way that would work on most OS's
> without any major changes.

You could look iinto using ticks or forking new processes using pcntl, 
but that's the limit.


--
Richard Heyes
0844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software

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



<    3   4   5   6   7   8   9   >