Re: [PHP] Re: Permissions

2013-08-27 Thread David Robley
Ashley Sheridan wrote:

> On Tue, 2013-08-27 at 16:16 +0930, David Robley wrote:
> 
>> Ethan Rosenberg wrote:
>> 
>> > Dear List -
>> > 
>> > Tried to run the program, that we have been discussing, and received a
>> > 403 error.
>> > 
>> > rosenberg:/var/www# ls -la StoreInventory.php
>> > -rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php
>> > 
>> > rosenberg:/var# ls -ld www
>> > drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www
>> > 
>> > I had set the S bit [probably a nasty mistake] and I thought I was able
>> > to remove the bit. [it doesn't show above]
>> > 
>> > How do I extricate myself from the hole into which I have planted
>> > myself?
>> > 
>> > TIA
>> > 
>> > Ethan
>> 
>> This is in no way a php question, as the same result will happen no
>> matter what you ask apache to serve from that directory.
>> 
>> You have the directory permissions set to 776 not 777.
>> --
>> Cheers
>> David Robley
>> 
>> Steal this tagline and I'll tie-dye your cat!
>> 
>> 
> 
> 
> 776 won't matter in the case of a directory, as the last bit is for the
> eXecute permissions, which aren't applicable to a directory. What

I beg to differ here. If the x bit isn't set on a directory, that will 
prevent scanning of the directory; in this case apache will be prevented 
from scanning the directory and will return a 403.

> It's possible that this is an SELinux issue, which adds an extra layer
> of permissions over files. To see what those permissions are, use the -Z
> flag for ls. Also, check the SELinux logs (assuming that it's running
> and it is causing a problem) to see if it brings up anything. It's
> typically found on RedHat-based distros.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk

-- 
Cheers
David Robley

Artificial Intelligence is no match for natural stupidity.


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



[PHP] Re: Permissions

2013-08-26 Thread David Robley
Ethan Rosenberg wrote:

> Dear List -
> 
> Tried to run the program, that we have been discussing, and received a
> 403 error.
> 
> rosenberg:/var/www# ls -la StoreInventory.php
> -rwxrwxrw- 1 ethan ethan 4188 Aug 26 20:26 StoreInventory.php
> 
> rosenberg:/var# ls -ld www
> drwxrwxrw- 37 ethan ethan 20480 Aug 26 20:26 www
> 
> I had set the S bit [probably a nasty mistake] and I thought I was able
> to remove the bit. [it doesn't show above]
> 
> How do I extricate myself from the hole into which I have planted myself?
> 
> TIA
> 
> Ethan

This is in no way a php question, as the same result will happen no matter 
what you ask apache to serve from that directory.

You have the directory permissions set to 776 not 777.
-- 
Cheers
David Robley

Steal this tagline and I'll tie-dye your cat!


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



Re: [PHP] exec and system do not work

2013-08-26 Thread David Robley
"Ethan Rosenberg, PhD" wrote:

> 
> 
> Ethan Rosenberg, PhD
> /Pres/CEO/
> *Hygeia Biomedical Research, Inc*
> 2 Cameo Ridge Road
> Monsey, NY 10952
> T: 845 352-3908
> F: 845 352-7566
> erosenb...@hygeiabiomedical.com
> 
> On 08/26/2013 07:33 PM, David Robley wrote:
>> Ethan Rosenberg wrote:
>>
>>>
>>> On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:
>>>>
>>>>
>>>>> Tamara Temple  hat am 26. August 2013 um
>>>>> 08:33 geschrieben:
>>>>>
>>>>>
>>>>>
>>>>> On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
>>>>>  wrote:
>>>>>
>>>>>> Dear List -
>>>>>>
>>>>>> I'm lost on this one -
>>>>>>
>>>>>> This works -
>>>>>>
>>>>>> $out = system("ls -l ",$retvals);
>>>>>> printf("%s", $out);
>>>>>>
>>>>>> This does -
>>>>>>
>>>>>> echo exec("ls -l");
>>>>
>>>> Please show the output of the directory listing.
>>>> Please us "ls -la"
>>>>
>>>>>>
>>>>>> This does not -
>>>>>>
>>>>>> if( !file_exists("/var/www/orders.txt"));
>>>>>> {
>>>>>>  $out = system("touch /var/www/orders.txt", $ret);
>>>>
>>>> Maybe you don't have write permissions on the folder?
>>>>
>>>>>>  $out2 = system("chmod 766 /var/www/orders.txt", $ret);
>>>>>>  echo 'file2';
>>>>>>  echo file_exists("/var/www/orders.txt");
>>>>>> }
>>>>>>
>>>>>> and this does not -
>>>>>>
>>>>>> if( !file_exists("/var/www/orders.txt"));
>>>>>> {
>>>>>>  exec("touch /var/www/orders.txt");
>>>>>>  exec("chmod 766 /var/www/orders.txt");
>>>>>>  echo 'file2';
>>>>>>  echo file_exists("/var/www/orders.txt");
>>>>>> }
>>>>>>
>>>>>> Ethan
>>>>>>
>>>>>>
>>>>>
>>>>> When you say "does not work", can you show what is actually not
>>>>> working? I believe the exec and system functions are likely working
>>>>> just fine, but that the commands you've passed to them may not be.
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Marco Behnke
>>>> Dipl. Informatiker (FH), SAE Audio Engineer Diploma
>>>> Zend Certified Engineer PHP 5.3
>>>>
>>>> Tel.: 0174 / 9722336
>>>> e-Mail: ma...@behnke.biz
>>>>
>>>> Softwaretechnik Behnke
>>>> Heinrich-Heine-Str. 7D
>>>> 21218 Seevetal
>>>>
>>>> http://www.behnke.biz
>>>>
>>>
>>> Tamara -
>>>
>>>   > Please show the output of the directory listing.
>>>   > Please us "ls -la"
>>>
>>> echo exec('ls -la orders.txt');
>>>
>>> -rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt
>>>
>>>
>>> Maybe you don't have write permissions on the folder?
>>>
>>> If I perform the touch and chmod from the command line, everything
>>> works.
>>>
>>>
>>>   >> When you say "does not work", can you show what is actually not
>>> working? I
>>>   >> believe the exec and system functions are likely working just fine,
>>> but that
>>>   >> the commands you've passed to them may not be.
>>>
>>> Here are my commands.
>>>
>>> if( !file_exists("/var/www/orders.txt"));
>>> {
>>> echo system("touch /var/www/orders.txt", $ret);
>>> echo system("chmod 766 /var/www/orders.txt", $ret);
>>> echo 'file2';
>>> echo file_exists("/var/www/orders.txt");
>>> }
>>>
>>> If I now try a ls from the command line, the return is
>>>cannot access /var/www/orders.txt: No such file or directory
>>>
>>> The ls -la  works because the file was created from the command line.
>>>
>>> TIA
>>>
>>> Ethan
>>
>> Note that touch and chmod don't return any output, so echoing the result
>> of a system call for those commands will give an empty string.
>>
>> You should be checking the values of $ret for each execution of system to
>> see whether the command was successful or not - the return status of the
>> executed command will be written to this variable. I'd guess that touch
>> is returning 13 - permission denied.
>>
>> if( !file_exists("/var/www/orders.txt"))
>> {
>>system("touch /var/www/orders.txt", $ret1);
>>echo 'touch returned '.$ret1.' /';
>>system("chmod 766 /var/www/orders.txt", $ret2);
>>echo 'chmod returned ' .$ret2.' /';
>>echo 'file2';
>> echo file_exists("/var/www/orders.txt"); }
>>
>> Check the permissions for directory /var/www; you'll probably find it is
>> writable by the user you log on as, but not by the user that apache/php
>> runs as, which is often www - a user with limited privileges.
>>
>> As other(s) have pointed out, there are php functions to do what you want
>> without introducing the possible insecurities involved with system et al.
>>
> 
> David -
> 
> touch returned 1
>   /chmod returned 1
> 

Non-zero return value indicates an error; touch failed and as a result there 
is no file to chmod, hence chmod also failed.

> rosenberg:/var/www# ls orders.txt
> ls: cannot access orders.txt: No such file or directory
> 
> rosenberg:/var# ls -ld www
> drwxr-xr-x 37 ethan ethan 20480 Aug 26 20:15 www

/var/www is only writeable by the user ethan
-- 
Cheers
David Robley

INTERLACE: To tie two boots together.


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



Re: [PHP] exec and system do not work

2013-08-26 Thread David Robley
Ethan Rosenberg wrote:

> 
> On 08/26/2013 11:36 AM, ma...@behnke.biz wrote:
>>
>>
>>> Tamara Temple  hat am 26. August 2013 um 08:33
>>> geschrieben:
>>>
>>>
>>>
>>> On Aug 25, 2013, at 10:41 PM, Ethan Rosenberg
>>>  wrote:
>>>
>>>> Dear List -
>>>>
>>>> I'm lost on this one -
>>>>
>>>> This works -
>>>>
>>>> $out = system("ls -l ",$retvals);
>>>> printf("%s", $out);
>>>>
>>>> This does -
>>>>
>>>> echo exec("ls -l");
>>
>> Please show the output of the directory listing.
>> Please us "ls -la"
>>
>>>>
>>>> This does not -
>>>>
>>>> if( !file_exists("/var/www/orders.txt"));
>>>> {
>>>> $out = system("touch /var/www/orders.txt", $ret);
>>
>> Maybe you don't have write permissions on the folder?
>>
>>>> $out2 = system("chmod 766 /var/www/orders.txt", $ret);
>>>> echo 'file2';
>>>> echo file_exists("/var/www/orders.txt");
>>>> }
>>>>
>>>> and this does not -
>>>>
>>>> if( !file_exists("/var/www/orders.txt"));
>>>> {
>>>> exec("touch /var/www/orders.txt");
>>>> exec("chmod 766 /var/www/orders.txt");
>>>> echo 'file2';
>>>> echo file_exists("/var/www/orders.txt");
>>>> }
>>>>
>>>> Ethan
>>>>
>>>>
>>>
>>> When you say "does not work", can you show what is actually not working?
>>> I believe the exec and system functions are likely working just fine,
>>> but that the commands you've passed to them may not be.
>>>
>>>
>>>
>> --
>> Marco Behnke
>> Dipl. Informatiker (FH), SAE Audio Engineer Diploma
>> Zend Certified Engineer PHP 5.3
>>
>> Tel.: 0174 / 9722336
>> e-Mail: ma...@behnke.biz
>>
>> Softwaretechnik Behnke
>> Heinrich-Heine-Str. 7D
>> 21218 Seevetal
>>
>> http://www.behnke.biz
>>
> 
> Tamara -
> 
>  > Please show the output of the directory listing.
>  > Please us "ls -la"
> 
> echo exec('ls -la orders.txt');
> 
> -rw-rw-rw- 1 ethan ethan 43 Aug 25 23:50 orders.txt
> 
> 
> Maybe you don't have write permissions on the folder?
> 
> If I perform the touch and chmod from the command line, everything works.
> 
> 
>  >> When you say "does not work", can you show what is actually not
> working? I
>  >> believe the exec and system functions are likely working just fine,
> but that
>  >> the commands you've passed to them may not be.
> 
> Here are my commands.
> 
> if( !file_exists("/var/www/orders.txt"));
> {
> echo system("touch /var/www/orders.txt", $ret);
> echo system("chmod 766 /var/www/orders.txt", $ret);
> echo 'file2';
> echo file_exists("/var/www/orders.txt");
> }
> 
> If I now try a ls from the command line, the return is
>   cannot access /var/www/orders.txt: No such file or directory
> 
> The ls -la  works because the file was created from the command line.
> 
> TIA
> 
> Ethan

Note that touch and chmod don't return any output, so echoing the result of 
a system call for those commands will give an empty string.

You should be checking the values of $ret for each execution of system to 
see whether the command was successful or not - the return status of the 
executed command will be written to this variable. I'd guess that touch is 
returning 13 - permission denied.

if( !file_exists("/var/www/orders.txt"))
{
  system("touch /var/www/orders.txt", $ret1);
  echo 'touch returned '.$ret1.' /';
  system("chmod 766 /var/www/orders.txt", $ret2);
  echo 'chmod returned ' .$ret2.' /';
  echo 'file2';
echo file_exists("/var/www/orders.txt"); }

Check the permissions for directory /var/www; you'll probably find it is 
writable by the user you log on as, but not by the user that apache/php runs 
as, which is often www - a user with limited privileges.

As other(s) have pointed out, there are php functions to do what you want 
without introducing the possible insecurities involved with system et al.

-- 
Cheers
David Robley

"Don't try to pull the wool over my eyes," Tom said sheepishly.


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



[PHP] Re: How to upstream code changes to php community

2013-08-12 Thread David Robley
Shahina Rabbani wrote:

> Hi,
> 
> I have done some modifications to the php source code and i tested it with
> php bench and I observed  some improvement.
> 
> I wanted to upstream these code changes to PHP community.
> I searched the wed but i didnt find proper guide to upstream the code to
> php.
> 
> Please help me by  providing the information how to upstream my code
> changes to php  source code community.
> 
> 
> Thanks,
> Shahina Rabbani

Start with https://github.com/php/php-
src/blob/master/README.SUBMITTING_PATCH which is linked from the Community 
menu item on the PHP home page.

-- 
Cheers
David Robley

Enter any 11-digit prime number to continue...


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



[PHP] Re: Include/Require limit?

2013-05-30 Thread David Robley
"Julian Wanke" wrote:

> Hi,
> 
> I use the pretty large Library PHP Image Workshop
> (http://phpimageworkshop.com/) at my project. It is about 75,5 KB.
> Everything works fine but if I try to include a 15 KB file with country
> codes, it fails.
> With the other files I easily get over 100 KB inclusion size, so my
> question;
> Is there a size limitation for include?
> 
> Best regards


Do you get an error message? Try removing the header() in the image output 
and see what happens.

-- 
Cheers
David Robley

PARANOID:Paying MORE for Surge-Protectors than Computers

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



[PHP] Re: Doing something wrong?

2013-05-21 Thread David Robley
Lester Caine wrote:

> I've got a new machine set up with SUSE12.3 but while it has PHP5.4,
> Apache is still stuck at 2.2, so I've downloaded and built 2.4.4 and
> PHP5.4.15 along with the modules I need but I'm having trouble actually
> getting it to load the 'Additional' .ini files.
> phpinfo is showing the change of location of the php.ini file, but nothing
> for the 'Scan this dir for additional .ini files' while the Configure
> shows '--with-config-file-scan-dir=/opt/apache2/conf/php5.d'
> What am I missing?
> It's working on the other machines and loading all the extra modules
> happily.
> 

Did you "make clean" after reconfiguring before re-compiling php? According 
to https://bugs.php.net/bug.php?id=63611 that may be a cause.

-- 
Cheers
David Robley

An ulcer is what you get mountain climbing over molehills.


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



Re: [PHP] Re: mysql_connect noob question

2013-04-21 Thread David Robley
Glob Design Info wrote:

> On 4/21/13 3:27 PM, Stuart Dallas wrote:
>> On 21 Apr 2013, at 20:29, Glob Design Info  wrote:
>>
>>> If that is the case then why does logging in with exactly the same
>>> params from a UNIX shell work fine? Command line login supposedly would
>>> be adding the @localhost or @IP_address as well but isn't. Only when I
>>> pass the variables to the script is that happening.
>>
>> What makes you so sure it's not?
>>
>> It is. I promise you it is. You're not seeing it because you're not
>> getting an error logging in. Do it on the command line again, but use a
>> username that doesn't exist and you will see the host it's adding in the
>> error message.
> 
> Indeed you are correct:
> 
> Last login: Sun Apr 21 15:41:10 on ttys000
> iMac-333:~ glob$ sudo mysql --host=instance43490.db.xeround.com
> --port=8904 --user=fakeuser --password=somepassword
> Password:
> Warning: Using a password on the command line interface can be insecure.
> ERROR 1045 (28000): Access denied for user
> 'fakeuser'@'ip70-162-142-180.ph.ph.cox.net' (using password: YES)
> iMac-333:~ glob$
> 
>>> I am doing exactly as you stated:
>>>
>>>> mysql_connect('localhost', $_POST['username'], $_POST['password']);
>>>
>>> Except that I am first storing $_POST['username'] in local $user and
>>> $_POST['password'] in local $pass first and then passing those to
>>> mysql_connect. And I am connecting to a remote server, not localhost.
>>
>> Side note: why are you putting them in other variables first when you're
>> only going to use them in that one place? It's a waste of memory. It's a
>> minor niggle but it's a pet hate of mine.
> 
> I am using them in other places - printing them on the response page to
> see their values/show the user who logged in, etc.
> 
>>> I have already documented both the exact HTML and PHP code in this
>>> thread and so see no need to post it elsewhere.
>>
>> And you're saying that when, instead of using $_POST variables you
>> hard-code the username and password in the script it work? I doubt it.
> 
> I can assure you it does. However, I may have found the problem: the
> port. As a security measure the BaaS provider appears to have changed
> MySQL to a non-standard port. So
> 
> On the command line:
> 
> sudo mysql --host=instance43490.db.xeround.com --port=8904
> --user= --password=
> 
> WORKS perfectly - entering the MySQL Monitor.
> 
> However, on the same host, same command line:
> 
> sudo mysql --host=instance43490.db.xeround.com:8904 --user=
> --password=
> 
> Does NOT work - returning an error that the host is not found.
> 
> So it appears to be the port, which begs the obvious question: is there
> a way to tell mysql_connect() to use a different port?

Yes - please see the documentation page for mysql_connect, in particular the 
"Server parameters" part.


I assume you have taken notice of the warnings in the documentation about 
deprecation of the mysql_ functions in favour of mysqli_ or PDO.

-- 
Cheers
David Robley

Multitasking: Reading in the bathroom


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



Re: [PHP] mysql_connect noob question

2013-04-19 Thread David Robley
Glob Design Info wrote:

> Sorry. The error displayed is:
> 
> *Warning*: mysql_connect() [function.mysql-connect
> <http://localhost/wservices/function.mysql-connect>]: Access denied for
> user ''@'ip70-162-142-180.ph.ph.cox.net' (using password: YES) in
> */Library/WebServer/Documents/wservices/connect.php* on line *29*
> 
> (But with the real user name, not just '')
> 
> Thanks,
> 
> On 4/19/13 3:28 PM, tamouse mailing lists wrote:
>> On Fri, Apr 19, 2013 at 3:43 PM, Glob Design Info 
>> wrote:
>>> I know this has probably been answered already.
>>>
>>> When I pass a user name and password from a form to my PHP script and
>>> then pass those to mysql_connect it doesn't connect. When I paste those
>>> exact same values into mysql_connect as string literals it works.
>>>
>>> Can anyone tell me why this happens?
>>>
>>> I know the strings are identical to the literals I try in a test but
>>> they don't work when submitted via form.
>>>
>>> $form_user = $_POST[ 'user' ];
>>> $form_pass = $_POST[ 'password' ];
>>>
>>> # Connect to remote DB
>>>
>>> $LINK = mysql_connect( $host, $form_user, $form_pass );
>>
>> Please show the error you are getting from the mysql_connect
>>
>>
>>> And yes, my $host param is correct.
>>>
>>> Thanks,
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>

First guess is that you don't have privileges for 
''@'ip70-162-142-180.ph.ph.cox.net', but you may have privileges for 
''.

And, what are you using for the $host value? If the script and mysql are on 
the same server, it shouldn't need to be anything other than 'localhost'.
-- 
Cheers
David Robley

A man's best friend is his dogma.

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



Re: [PHP] Re: Is BBCode Installed

2013-04-10 Thread David Robley
Stephen wrote:

> On 13-04-10 10:59 PM, David Robley wrote:
>> I ran phpinfo() on my host and searched for "BBCode". Not found.
>>
>> Does this mean that the extension is not installed?
>>
>> If not, how can I tell?
>>
>> Thanks
>>
>> BBCode isn't a php extension, but may be implemented using php or other
>> languages. See http://www.bbcode.org/ for more info.
>>
> Thank you for replying, but:
> 
> http://php.net/manual/en/book.bbcode.php
> 
> 
>   Introduction
> 
> This extension aims to help parse BBCode text in order to convert it to
> HTML or another markup language. It uses one pass parsing and provides
> great speed improvement over the common approach based on regular
> expressions. Further more, it helps provide valid HTML by reordering
> open / close tags and by automatically closing unclosed tags.
> 
> 
That appears to be a PECL extension, not 'core' php and more info on 
installing can be found at http://www.php.net/manual/en/install.pecl.php.

Not having used PECL extensions, I can't say whether they are reflected in 
phpinfo() output.

-- 
Cheers
David Robley

SCUD : Sure Could Use Directions


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



[PHP] Re: Is BBCode Installed

2013-04-10 Thread David Robley
Stephen wrote:

> I ran phpinfo() on my host and searched for "BBCode". Not found.
> 
> Does this mean that the extension is not installed?
> 
> If not, how can I tell?
> 
> Thanks
> 

BBCode isn't a php extension, but may be implemented using php or other 
languages. See http://www.bbcode.org/ for more info.

-- 
Cheers
David Robley

Some people are afraid of heights. I'm afraid of widths

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



Re: FW: [PHP] Accessing Files Outside the Web Root

2013-03-13 Thread David Robley
"Dale H. Cook" wrote:

> At 05:04 PM 3/13/2013, Dan McCullough wrote
> :
>>Web bots can ignore the robots.txt file, most scrapers would.
> 
> and at 05:06 PM 3/13/2013, Marc Guay wrote:
> 
>>These don't sound like robots that would respect a txt file to me.
> 
> Dan and Marc are correct. Although I used the terms "spiders" and
> "pirates" I believe that the correct term, as employed by Dan, is
> "scrapers," and that twerm might be applied to either the robot or the
> site which displays its results. One blogger has called scrapers "the
> arterial plaque of the Internet." I need to implement a solution that
> allows humans to access my files but prevents scrapers from accessing
> them. I will undoubtedly have to implement some type of
> challenge-and-response in the system (such as a captcha), but as long as
> those files are stored below the web root a scraper that has a valid URL
> can probably grab them. That is part of what the "public" in public_html
> implies.
> 
> One of the reasons why this irks me is that the scrapers are all
> commercial sites, but they haven't offered me a piece of the action for
> the use of my files. My domain is an entirely non-commercial domain, and I
> provide free hosting for other non-commercial genealogical works,
> primarily pages that are part of the USGenWeb Project, which is perhaps
> the largest of all non-commercial genealogical projects.
> 

readfile() is probably where you want to start, in conjunction with a 
captcha or similar

-- 
Cheers
David Robley

Catholic (n.) A cat with a drinking problem.


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



Re: [PHP] Mystery foreach error

2013-03-12 Thread David Robley
Angela Barone wrote:

> I think I figured it out.
> 
>  $states = array(
> 'AL' => array( '350','351','352','353', ),
> 'AK' => array( '995','996','997','998','999', ),
> 'AZ' => array( '850','851','852','853','854', ),
> 'WI' => array( '530','531','532', ),
> 'WY' => array( '820','821','822','823','824', ),
> );
> 
> $zip = 35261;
> $state = 'XX';
> 
> $zip_short = substr($zip, 0, 3);
> foreach ($states[$state] as $zip_prefix) {
> if ($zip_prefix == $zip_short) {
> echo "State = $state";
> } else {
> echo 'no';
> }
> }
> ?>
> 
> Running this script, I got the same error as before.  If $state is a known
> state abbreviation in the array, everything is fine, but if someone was to
> enter, say 'XX' like I did above or leave it blank, then the error is
> produced.  I placed an if statement around the foreach loop to test for
> that and I'll keep an eye on it.
> 
> Thank you for getting me to look at the array again, which led me to look
> at the State.
> 
> Angela

Presumably there is a fixed list of State - those are US states? - so why 
not provide a drop down list of the possible choices?

-- 
Cheers
David Robley

"I need to be careful not to add too much water," Tom said with great 
concentration.


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



Re: [PHP] Not counting my own page visits

2013-03-04 Thread David Robley
Angela Barone wrote:

> On Mar 4, 2013, at 11:33 AM, Ashley Sheridan wrote:
>> You can manually write a cookie on your machine, or use a special script
>> that only you visit that contains a setcookie() call (it only need be set
>> once). From there on, you can check the $_COOKIES super global for the
>> presence of your cookie.
> 
> I don't know why, but I can't get cookies to work.  Here's a script I'm
> calling from my browser:
> 
>  $domain = ($_SERVER['HTTP_HOST'] != 'localhost') ?
> $_SERVER['HTTP_HOST'] : false;
> $cookie = setcookie('test2', '123' , time()+60*60*24*30, '/', $domain);
> ?>
> 
> 
> 
> 
> 
> Test Page
> 
> 
> "; ?>
> "; ?>
> 
> 
> 
> The domain is being displayed but the cookie is not.  There's no cookie in
> the browser prefs, either.  What am I doing wrong?
> 
> Angela

Misunderstanding what $cookie contains? It is a boolean, i.e. it will be 
true or false depending on whether the cookie was set or not. To echo the 
contents of a cookie, you need to use the cookie name, viz

"; ?>

-- 
Cheers
David Robley

Oxymoron: Sisterly Love.


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



Re: [PHP] parsing select multiple="multiple"

2013-02-18 Thread David Robley
tamouse mailing lists wrote:

> On Mon, Feb 18, 2013 at 6:54 PM, John Taylor-Johnston
>  wrote:
>> I am capable with . (I suppose I did it
>> correctly? :p )
>> But I haven't the first clue how to parse a  and
>> multiply select name="DPRtype".
>> Would anyone give me a couple of clues please? :)
>> Thanks,
>> John
>>
>>Priority:
>>
>>  >  {echo
>> "selected";} ?>>1
>>  >  {echo
>> "selected";} ?>>2
>>  >  {echo
>> "selected";} ?>>3
>>  >  if (empty($_POST["DPRpriority"])) {echo "selected";}
>>  if ($_POST["DPRpriority"] == "4") {echo "selected";}
>> ?>>4
>>
>>
>>
>>
>>  1. Crimes Against
>> Persons
>>  2. Disturbances
>>  3. Assistance /
>> Medical
>>  4. Crimes Against
>> Property
>>  5. Accidents
>>  /
>> Traffic Problems
>>  6. Suspicious
>> Circumstances
>>  7. Morality /
>> Drugs
>>  8. Miscellaneous
>> Service
>>  9. Alarms
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
> 
> Do test this, but I think all that's required is you make the name an
> array:
> 
> 

More info at http://www.php.net/manual/en/language.variables.external.php 
(search for multiple) and 
http://www.php.net/manual/en/faq.html.php#faq.html.select-multiple

-- 
Cheers
David Robley

Know what I hate? I hate rhetorical questions!


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



[PHP] Re: Newbie is trying to set up OOP With PHP and MySQL or MySQLi database class (using CRUD)

2013-02-15 Thread David Robley
dealTek wrote:

> 
> Thanks for all the help folks,
> 
> 
> PHP-light-PDO-Class
> 
> ok well I found this...
> 
> https://github.com/poplax/PHP-light-PDO-Class
> 
> But it does not seem to recognize the port - I put the port as 8889 but
> keeps saying can't connect port 3306
> 
> Warning: PDO::__construct() [pdo.--construct]: [2002] Connection refused
> (trying to connect via tcp://127.0.0.1:3306) in
> /Users/revdave/Sites/php-fool/pdo3/PHP-light-PDO-Class-
master/class.lpdo.php
> on line 33 Connection failed: SQLSTATE[HY000] [2002] Connection refused
> 
> BTW: I tried to add the port a few places but it didn't work..
> 
> 
> How do we fix this?
> 
> 
> 
> -- config.php
> 
>  $config = array();
> $config['Database'] = array();
> $config['Database']['dbtype'] = 'mysql';
> $config['Database']['dbname'] = 'tester';
> $config['Database']['host'] = '127.0.0.1';
> $config['Database']['port'] = 8889;
> $config['Database']['username'] = 'root';
> $config['Database']['password'] = 'root';
> $config['Database']['charset'] = 'utf8';
> ?>

Change host to localhost - your mysql may be configured not to accept 
requests via tcp.

> 
> ===  class.lpdo.php

> 
> 
> --
> Thanks,
> Dave - DealTek
> deal...@gmail.com
> [db-3]

-- 
Cheers
David Robley

My karma ran over my dogma


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



[PHP] Re: PDO mysql Connection issue

2012-11-28 Thread David Robley
"ad...@buskirkgraphics.com" wrote:

> I am having a PDO mysql connection issue I cant explain.
> 
> On server server1.mydomain.com
> I have a test script
>  $pdo = new PDO('mysql:host=171.16.23.44;dbname=test', 'user','password');
> ?>
> 171.16.23.44 is by an A record called server2.mydoamin.com  they are 2
> different servers.
> This script returns an error:
> ERROR: Access denied for user 'user'@'server1.mydomain.com' (using
> password: YES)
> 
> I find this ODD because that is not the server i am connecting TO but
> FROM. Why would the PDO connection be referring back to its own localhost
> instead of the intended domain.
> I have tried this by fully qualified domain name, same thing.
> I have ensured the route does exist on the connecting server.
> I have ensured there is no local reference to the domain name/IP back to
> its self.
> 
> I log into 171.16.23.44 and there is NO record of the failed attempt.
> I validate the user has remote access rights.
> I validate there is not a firewall rule blocking the host/port/you name
> it. I telnet from the server to the destination via port 3306 it connects.
> 
> BTW (171.16.23.44) IS FAKE I AM USING THE IP AS AN EXAMPLE HERE.
> 
> Any clue as to WHY the host parameter is not setting or is it setting and
> something else is wrong?

You are attempting a connection by u...@server1.mydomain.com

This request is made to the mysql server on host server2.mydomain.com which 
responds with the error that access is denied for the user named 'user' on 
host server1.mydomain.com

The most likely problem is that on server2.mydomain.com you do not have 
mysql privileges for u...@server1.mydomain.com

-- 
Cheers
David Robley

People in the passing lane that don't pass will be shot.


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



[PHP] Re: php form action breaks script

2012-06-14 Thread David Robley
Tim Dunphy wrote:

> Hello list,
> 
>  I was just wondering if I could get some opinions on a snippet of
> code which breaks a php web page.
> 
>  First the working code which is basically an html form being echoed by
>  php:
> 
> if ($output_form) {
> 
>   echo '
>   Subject of email:
>   
>   Body of email:
> cols="40">
>
>   ';
> 
> 
>   }
> 
> However if I change the form action to this, it breaks the page
> resulting in a white screen of death:
> 
> 
>   if ($output_form) {
> 
>   echo ' method="post"  >
>   Subject of email:
>   
>   Body of email:
> cols="40">
>
>   ';
> 
> 
>   }
> 
> Reverting the one line to this:
> 
> echo '
> 
> gets it working again. Now I don't know if it's an unbalanced quote
> mark or what's going on. But I'd appreciate any advice you may have.
> 
> 
> Best,
> tim
> 
If you check your apache log you'll probably see an error message. But the
problem seems to be that your string you are trying to echo is enclosed in
single quotes, and contains a string in  ...etc



Cheers
-- 
David Robley

"I haven't had any tooth decay yet," said Tom precariously.
Today is Sweetmorn, the 20th day of Confusion in the YOLD 3178. 


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



[PHP] Re: MySQL and PHP weirdness

2012-02-14 Thread David Robley
Richard S. Crawford wrote:

> Bear with me here. I have a problem with PHP and MySQL that's been
> stumping me for a couple of days now. I'm not even sure how to describe
> it, so I'll just do my best.
> 
> There's a row in our bugs database that looks like every other row in the
> table, but when it's pulled from the database and displayed in PHP, the
> "description" field -- which is defined as a "mediumtext" field -- is
> displayed as a date field with a value of 12/31/1969. Moreoever, when I
> use PHPMyAdmin to look at the row directly, the "description" field has
> the data that I expect it to.
> 
> Just for fun, here's the text in question:
> 
> Quarterly Course Set Up - Spring 2012 (114)
> Section  Course titleCourse Start Date
> 114MHI214 The Internet and the Future of Patient Care 04/02/2012
> 114MHI212 Health Information Systems Analysis and Design  04/02/2012
> Program administrator 2 users; Laurel Aroner - Susan Catron - Jennifer
> Kremer
> Instructors;
> MHI214; Peter Yellowlees
> MHI212; Robert Balch
> Per instructions from Rita Smith-Simms - I'm creating this task for myself
> and based on instructions given which are that all listed courses are now
> to be backed-up and restored sooner (original course set up time-frame was
> a month before course starts).
> Adding instructions - Follow the 52-step quarterly course set up process
> and information from the course matrix; if matrix incomplete, input
> information during this set up
> As you track your time each day, please include in the notes which courses
> (use project code) you worked on and indicate either working on or
> completed.
> Create and notify by 2/15/2012
> 
> 
> I've made sure there are no odd characters that would mess up how PHP is
> displaying the text. I've tried changing the field type from "mediumtext"
> to "text" but this didn't work.
> 
> If anyone has any ideas as to why this might be happening -- or if I just
> wasn't clear -- please let me know.
> 
> 

If phpmyadmin gives expected results and _your_ code doesn't, I'd be
suspicious of your code :-)

It might be helpful for you to post relevant part(s) ofthe actual code you
are using.



Cheers
-- 
David Robley

Man who run behind car get exhausted.
Today is Sweetmorn, the 46th day of Chaos in the YOLD 3178. 


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



[PHP] Re: Novice MySQL problem

2011-11-14 Thread David Robley
Jim Giner wrote:

> Actually, no it doesn't,  since I have a well-developed sense of all of
> that, but that's not helping to answer the OP's question now, is it?  Stay
> on point.

Probably it helps the OP about as much as your statement that 'I don't know
what the problem here is.  Personally I never use auto-inc fields.'



Cheers
-- 
David Robley

Useless Invention: Kickstand for a tank.
Today is Pungenday, the 26th day of The Aftermath in the YOLD 3177. 


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



[PHP] Re: Novice MySQL problem

2011-11-14 Thread David Robley
Jim Giner wrote:

> 
> "drive view"  wrote in message
> news:cam4sn2ip7yncw2-2soq-vjk8suer7u5x96fvpeqoitkkcaj...@mail.gmail.com...
>> Hi,
>>
>> I'm a novice to MySQL and am currently facing the following difficulty.
>> I'm trying to update a table with a row of data the primary key of which
>> is
>> an ID which I believe is an auto incrementing serial number.  My first
>> question is how to check if this is the case.
>>
> 
> If you are updating a row, you should already know the id of the record,
> so
> in your update statement you reference it in the where clause.   (ie,
> "where rec_id = $curr_rec_key")
> 
>> Secondly while trying to insert such a row leaving out this column mySql
>> is
>> inserting the row at ID 0 (the previous ID's in the table are from 1 to
>> 9),
>> but then will not take further inserts.
>>
>> Thanks for any help available.
>>
>>
>> Regards
>>
>> Toni
>>
> 
> I don't know what the problem here is.  Personally I never use auto-inc
> fields.

That statement tells us you have a poor understanding of the concept of
relational databases, or you don't use relational tables.


Cheers
-- 
David Robley

Sure, it's clean laundry. The cat's sitting on it, isn't he?
Today is Pungenday, the 26th day of The Aftermath in the YOLD 3177. 


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



Re: [PHP] Exporting large data from mysql to html using php

2011-10-27 Thread David Robley
Jim Giner wrote:

> "David Robley"  wrote in message
> news:49.50.34068.1b567...@pb1.pair.com...
>>
>> Consider running EXPLAIN on all your queries to see if there is something
>> Mysql thinks could be done to improve performance.
>>
> 
> Why do so many responders seem to think the problem here is in the
> preparation of the query?
> 
> It is the Approach that it is the problem.  It needs to re-addressed, not
> simply tinkered with.  I don't care if someone figures out how to spew out
> 89M+ records in 5 seconds flat.  What are you doing pulling up that many
> detail records at one time for? Who is going to look at them?  You?  If
> so, see my previous post on how long that is going to take you just to
> examine (!) the first million alone.
> 
> This problem needs a re-working of the data processing and user interfaces
> to allow for the selection of an appropriate amount of individual records
> in any result set, otherwise simply preparing a summary of some sort.

Jason originally said that he was using LIMIT to grab a subset of the data,
so I don't see why you would think he is trying to pull the full data set
in one hit. My response suggesting EXPLAIN was made in the knowledge that
he is using LIMIT.


Cheers
-- 
David Robley

"I was the first to climb Mount Everest," said Tom hilariously.
Today is Setting Orange, the 8th day of The Aftermath in the YOLD 3177. 


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



Re: [PHP] Exporting large data from mysql to html using php

2011-10-25 Thread David Robley
Jason Pruim wrote:

> 
> Jason Pruim
> li...@pruimphotography.com
> 
> 
> 
> On Oct 25, 2011, at 10:51 AM, Jim Giner wrote:
> 
>> I disagree.  It's not about "tuning the queries", it is more about the
>> appl. design that currently thinks it SHOULD do such huge queries.
>> 
>> My approach would be to prompt the user for filtering criteria that
>> automatically would reduce the result set size.  Although at this time I
>> believe the OP mentioned that the db is just telephone numbers so that
>> doesn't leave much room for filter-criteria.
>> 
>> 
> 
> Yes it is just phone numbers... The only select that I'm running on the
> entire site is related to the pagination... A simple: $sqlCount = "SELECT
> COUNT(*) FROM main WHERE state = '{$state}'";
> 
> which limits it to everything inside the state... Unfortunately if you
> look at the possibilities, it's still quite a large dataset... 89 million
> :)
> 
> The rest of the query's will be much more limited to areacode, exchange,
> and in some cases the full phone number... Maybe the better way to do it
> would be not to count the records But set a variable with the total
> count... That way I don't have to load all the data... The data amount
> won't change alot... Easy enough to set a variable...  Just need to see if
> I can integrate that with the pagination...
> 
> Back to the drawing board! :)
> 

Consider running EXPLAIN on all your queries to see if there is something
Mysql thinks could be done to improve performance.



Cheers
-- 
David Robley

Why do they put Braille dots on the keypad of the drive-up ATM?
Today is Prickle-Prickle, the 7th day of The Aftermath in the YOLD 3177. 


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



[PHP] Re: Exporting large data from mysql to html using php

2011-10-24 Thread David Robley
Jason Pruim wrote:

> Now that I've managed to list 3 separate programming languages and
> somewhat tie it back into php here's the question...
> 
> I have about 89 million records in mysql... the initial load of the page
> takes 2 to 3 minutes, I am using pagination, so I have LIMIT's on the SQL
> query's... But they just aren't going fast enough...
> 
> What I would like to do, is pull the data out of MySQL and store it in the
> HTML files, and then update the HTML files once a day/week/month... I can
> figure most of it out... BUT... How do I automatically link to the
> individual pages?
> 
> I have the site working when you pull it from MySQL... Just the load time
> sucks... Any suggestions on where I can pull some more info from? :)
> 
> Thanks in advance!
> 
> 
> Jason Pruim
> li...@pruimphotography.com

Is it possible that you are attempting to display images? And if so, are you
making the mistake of storing them "full size" and using the browser to
resize them? That would have the potential to cause long load times.


Cheers
-- 
David Robley

Give me some chocolate and no one gets hurt!
Today is Pungenday, the 6th day of The Aftermath in the YOLD 3177. 


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



Re: [PHP] Re: Processing newlines in a text area field

2011-10-14 Thread David Robley
On Fri, 14 Oct 2011, you wrote:
> On 11-10-14 03:40 AM, David Robley wrote:
> >> I have a web page with a form with a text area. I enter:
> >>
> >> foo
> >>
> >>
> >> bar
> >>
> >> PHP processes the POST and inserts the record into MySQL.
> >>
> >> The database field is text.
> >>
> >> I use PDO
> >>
> >> For testing I have removed any processing of the text area content.
> >>
> >> Now, no matter how many blank rows I have between foo and bar, in
> >> the database record, I always get a single newline character.
> >>
> >> I am using Firefox 7.0.1.
> >>
> >> Is this normal behaviour? I want to be able to enter more than 1
> >> newline.
> >
> > You may have forgotten that HTML treats all whitespace, such as tabs,
> > newlines and spaces, as a space, unless you wrap the text in PRE
> > tags.
> >
> > To display a line break where your text contains EOL characters, use
> > nl2br()
>
> I am using nl2br() and i get just 1  added. So I went back to the
> database and found only a single newline.
>
> So either MySQL or PDO seems to be getting rid of "excessive" white
> space.
>
> Still no solution.
>
> Stephen

Please keep replies on list so others can help.

I suggest you provide the particular code that is causing the problem, 
perhaps with a sample string that will trigger the problem.

Cheers
-- 
David Robley

Shh! Be vewy quiet, I'm hunting wuntime errors!
Today is Pungenday, the 69th day of Bureaucracy in the YOLD 3177. 

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



[PHP] Re: Processing newlines in a text area field

2011-10-14 Thread David Robley
Stephen wrote:

> I have a web page with a form with a text area. I enter:
> 
> foo
> 
> 
> bar
> 
> PHP processes the POST and inserts the record into MySQL.
> 
> The database field is text.
> 
> I use PDO
> 
> For testing I have removed any processing of the text area content.
> 
> Now, no matter how many blank rows I have between foo and bar, in the
> database record, I always get a single newline character.
> 
> I am using Firefox 7.0.1.
> 
> Is this normal behaviour? I want to be able to enter more than 1 newline.
> 
> Thanks
> Stephen

You may have forgotten that HTML treats all whitespace, such as tabs,
newlines and spaces, as a space, unless you wrap the text in PRE tags.

To display a line break where your text contains EOL characters, use nl2br()



Cheers
-- 
David Robley

Hm..what's this red button fo:=/07http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread David Robley
Tim Streater wrote:

> On 11 Oct 2011 at 10:47, David Robley  wrote:
> 
>> Tim Streater wrote:
>>
>>> On 11 Oct 2011 at 03:03, Paul M Foster  wrote:
>>>
>>>> On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:
>>>>
>>>>> I would like to use the SQLite3 (not PDO) interface to SQLite, and I
>>>>> would like to be able to supply a string containing several SQL
>>>>> statements and have them all executed, thus saving the overhead of
>>>>> several calls. It *appears* that this may be how it actually works,
>>>>> but I wondered if anyone could confirm that.
> 
>>>> The docs appear to agree that this is allowed. See:
>>>>
>>>> http://us.php.net/manual/en/function.sqlite-exec.php
>>>
>>> That's the SQLite interface, though, rather than the SQLite3 one. The
>>> latter just says: "Executes an SQL query ...".
> 
>> Not to be a smartass or anything, but what about TIAS ?
> 
> What that?
> 
> --
> Cheers  --  Tim

Er, Try It And See

A couple of minutes experimentation might have saved you the time of email,
wait for an answer ...


Cheers
-- 
David Robley

Mothers are the necessity of invention -- Calvin
Today is Prickle-Prickle, the 65th day of Bureaucracy in the YOLD 3177. 


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



Re: Re: [PHP] Multiple SQLite statements

2011-10-11 Thread David Robley
Tim Streater wrote:

> On 11 Oct 2011 at 03:03, Paul M Foster  wrote:
> 
>> On Mon, Oct 10, 2011 at 04:14:00PM +0100, Tim Streater wrote:
>>
>>> I would like to use the SQLite3 (not PDO) interface to SQLite, and I
>>> would like to be able to supply a string containing several SQL
>>> statements and have them all executed, thus saving the overhead of
>>> several calls. It *appears* that this may be how it actually works,
>>> but I wondered if anyone could confirm that.
>>
>> --
>> Cheers  --  Tim
>>>
>>
>> The docs appear to agree that this is allowed. See:
>>
>> http://us.php.net/manual/en/function.sqlite-exec.php
> 
> That's the SQLite interface, though, rather than the SQLite3 one. The
> latter just says: "Executes an SQL query ...".
> 
> --
> Cheers  --  Tim

Not to be a smartass or anything, but what about TIAS ?


Cheers
-- 
David Robley

I don't eat snails... I prefer FAST food!
Today is Prickle-Prickle, the 65th day of Bureaucracy in the YOLD 3177. 


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



[PHP] Re: Dreaded Premature end of script headers

2011-08-26 Thread David Robley
tamouse mailing lists wrote:

> I'm encountering this on a script, but I can't figure out where it's
> actually failing. How do I debug this problem???

Look first for unclosed curly braces {}

You might find it useful to try an editor that does bracket matching and
highlighting as an aid to finding the offending code.

Cheers
-- 
David Robley

When I was a kid, I was an imaginary playmate.
Today is Pungenday, the 19th day of Bureaucracy in the YOLD 3177. 


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



Re: [PHP] Re: testing

2011-08-05 Thread David Robley
Daniel Brown wrote:

> On Thu, Aug 4, 2011 at 10:39, Jim Giner 
> wrote:
>>
>> Mailing list, newsgroup, either one - something's changed in the last
>> week or so to interrupt the smooth (or semi-smooth) functioning of it. 
>> The only messages I'm seeing currently are the ones in this single topic.
>>  Why is that???
> 
> Actually, we haven't changed anything at all.  It's always been
> temperamental, but it's always just been a small additional offering.
> As Ash said, this is a mailing list, not a newsgroup.  The fact that
> we offer a newsgroup interface at all is by all means eligible for
> discontinuation, since only about six people use it in any given year.
> 

/me wonders who the other five are :-)


Cheers
-- 
David Robley

"I've mixed up my gloves," Tom said intermittently.
Today is Boomtime, the 71st day of Confusion in the YOLD 3177. 


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



[PHP] Re: Installing PHP

2011-07-06 Thread David Robley
Jim Giner wrote:

> Eureka!
> 
> The whole problem was my unfamiliarity with the php download page.  To
> others - read the choices there very carefully (which I thought I did!) to
> be sure you get the "thread-safe" version.
> 
> Thanks to all who contributed, but David gets the kudos for telling me to
> check the error logs first.

As you become more familiar with managing apache yourself, you will learn
that checking the error log is the 0th thing to do with any apache or
apache related problem, including 500 errors from CGI scripts and checking
for php errors.


Cheers
-- 
David Robley

Windows N'T: as in Wouldn't, Couldn't, and Didn't.
Today is Boomtime, the 41st day of Confusion in the YOLD 3177. 


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



[PHP] Re: Installing PHP

2011-07-05 Thread David Robley
Jim Giner wrote:

> Hi all,
> (Hopefully I posted this in a place that can/will help me)
> 
> I got curious about running php / apache on my own laptop in order to help
> my devl process, instead of writing, uploading and testing on my site.
> 
> Found a nice pair of docs from "thesitewizard.com" that appeared to be
> pretty well-written instructions on installing each of these systems. 
> btw-
> I'm running XpSp2.  Chose the Apache 2.0 and PHP 5.2 (thread-safe?) per
> the recommendations.
> 
> Went thru all instructions step-by-step, testing all the way.  Apache
> works - PHP doesn't.  When I bring up IE and type in localhost I get the
> default apache page as I was told I should see.  When I type
> "localhost/test.php" I get a windows dialog asking what program should run
> the php script.
> 
> In debugging I went to a cmd windows and ran "c:\php\php-cgi test.php" and
> got the expected result from my script - so PHP works.
> 
> End result - they each work separately, but php is not working under
> apache.
> 
> As part of the docs instructions I added the following code to the apache
> conf file:
> 
> 1 - I chose the "configure apache to run php as an apache module.
> 2 - added "LoadModule php5_module "c:/php/php5apache2.dll" as last one of
> those lines
> 3 - added "AddType application/x-httpd-php .php" as the last of those
> lines 4 - added "PHPIniDir "c:/php" as the last line of the conf file.
> 
> Upon adding these lines apache will no longer restart.  In fact adding any
> ONE of these lines breaks Apache.
> 
> Ideas welcome.
> 
> And for those who still love the USofA, Happy Independence Day!

If you are having problems starting apache, the first place to look is your
apache error log.


Cheers
-- 
David Robley

On a radiator repair shop: Best place to take a leak.
Today is Sweetmorn, the 40th day of Confusion in the YOLD 3177. 


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




[PHP] Re: advice on how to build this array from an array.

2011-06-08 Thread David Robley
Adam Preece wrote:

> hi all,
> 
> please forgive me if i do not make sense, ill try my best to explain.
> 
> 
> i have this array or arrays.
> 
> Array ( [name] => super duplex stainless steels [id] => 30 [page_cat_id]
> => 10 [main_nav] => true [cat_name] => material range ) Array ( [name] =>
> standard stainless steels [id] => 31 [page_cat_id] => 10 [main_nav] =>
> true [cat_name] => material range )
>  Array ( [name] => non ferrous [id] => 32 [page_cat_id] => 10 [main_nav]
>  => true [cat_name] => material range )
> Array ( [name] => carbon based steels [id] => 33 [page_cat_id] => 10
> [main_nav] => true [cat_name] => material range )
> 
> is it possible to build an array  and use the [cat_name] as the key and
> assign all the pages to that cat_name?
> 
> what im trying to achieve is a category of pages but i want the cat_name
> as the key to all the pages associated to it
> 
> hope i make sense
> 
> kind regards
> 
> Adam

How is this array created? If it is from a database, you could probably
modify the query to give you what you want.


Cheers
-- 
David Robley

Show me a sane man. I'll cure him for you.
Today is Prickle-Prickle, the 13rd day of Confusion in the YOLD 3177. 


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



Re: [PHP] Announcing New PHP Extension: System Detonation Library (was: phpsadness)

2011-06-04 Thread David Robley
xucheng wrote:

> NO, it did not take server offline and it did just say that in CLI .
> 
> ...
> 
> 2011/6/4  :
>> LOL,
>> That is too funny. I took the wording "System Detonation" literally.
>> Did it take your server offline or did it just say that in CLI.
>>
>>
>>
>> Richard L. Buskirk
>>
>>
>> -Original Message-
>> From: xucheng [mailto:helloworldje...@gmail.com]
>> Sent: Saturday, June 04, 2011 2:55 AM
>> To: Daniel Brown
>> Cc: PHP General
>> Subject: Re: [PHP] Announcing New PHP Extension: System Detonation
>> Library (was: phpsadness)
>>
>> I create a script with : php -r ' detonate();' via the CLI ,
>> and get this :
>>
>> PHP Fatal error:  This system will self-destruct in five four
>> three two one [CONNECTION TO HOST INTERRUPTED] in Command
>> line code on line 1
>>
>> is this an expected result ?
>>
>> 2011/6/3 Daniel Brown :
>>> First of all, a happy Friday to all here.  Hopefully some of you
>>> will be able to pass this on to your boss and get sent home early.
>>>
>>> Second, as dreamed up in the previous thread, I've decided to take
>>> a few moments this morning to build and release a new PHP extension,
>>> which provides a single function: detonate().
>>>
>>> Third, you can read about it and download it here:
>>> http://links.parasane.net/29nh
>>>
>>> That's all, folks.

Daniel, your work here is done :-)

For the others, please just read the source of the extension - detonate.c is
where you need to look.





Cheers
-- 
David Robley

"I won't stand for painting," said Tom uneasily.
Today is Setting Orange, the 9th day of Confusion in the YOLD 3177. 


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



Re: [PHP] Announcing New PHP Extension: System Detonation Library (was: phpsadness)

2011-06-04 Thread David Robley
xucheng wrote:

> I create a script with : php -r ' detonate();' via the CLI ,
> and get this :
> 
> PHP Fatal error:  This system will self-destruct in five four
> three two one [CONNECTION TO HOST INTERRUPTED] in Command
> line code on line 1
> 
> is this an expected result ?
> 
> 2011/6/3 Daniel Brown :
>> First of all, a happy Friday to all here.  Hopefully some of you
>> will be able to pass this on to your boss and get sent home early.
>>
>> Second, as dreamed up in the previous thread, I've decided to take
>> a few moments this morning to build and release a new PHP extension,
>> which provides a single function: detonate().
>>
>> Third, you can read about it and download it here:
>> http://links.parasane.net/29nh
>>
>> That's all, folks.
>>

Did you look at the source before you compiled it?




Cheers
-- 
David Robley

Useless Invention: Open Toed Safety Shoes.
Today is Setting Orange, the 9th day of Confusion in the YOLD 3177. 


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



[PHP] Re: Filtering data not with mysql...

2011-05-18 Thread David Robley
Jason Pruim wrote:

> Hey Everyone,
> 
> Probably a simple question but I wanted to make sure I was right
> before I got to far ahead of my self
> 
> I have a form that I am working on and this form will be emailed to
> the recipient for processing (Not stored in a database).
> 
> When I store in a database, I simply run all the data through
> mysql_real_escape_string() and it's all good...  Without the database,
> is it just as easy as addslashes($var)? or is there more that needs to
> be done?
> 
> In the end, the info will be echoed back out to the user to be viewed
> but not edited and emailed to someone to add the registration collect
> money, etc etc.
> 
> Am I on the right track or do I need to rethink my whole process? :)
> 
> Thanks Everyone!

Addslashes and mysql_real_escape_string are designed to escape certain
characters which would otherwise cause problems when used in a sql query -
as you aren't using a database, you don't need them here.

For the display you'll want to make sure that html entities are rendered
correctly, so process with htmlentities or htmlspecialchars for display.
There is probably nothing you need to do to the emailed version.


Cheers
-- 
David Robley

Honey, PLEASE don't pick up the PH$@#*&$^(#@&$^%(*NO CARRIER
Today is Prickle-Prickle, the 66th day of Discord in the YOLD 3177. 


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



Re: [PHP] An Invitation to Neuroscientists and Physicists: Singapore Citizen Mr. Teo En Ming (Zhang Enming) Reports First Hand Account of Mind Intrusion and Mind Reading

2011-05-17 Thread David Robley
Richard Quadling wrote:

> On 17 May 2011 12:45, Singapore Citizen Mr. Teo En Ming (Zhang Enming)
>  wrote:
>> 16 May 2011 Monday 7:28 P.M. Singapore Time
>> For Immediate Release
>>

>>
> 
> Is it Friday?
> 
> 

Clearly it is Friday on the planet where Mr Wossname lives :-)


Cheers
-- 
David Robley

" ," said Tom blankly.
Today is Boomtime, the 64th day of Discord in the YOLD 3177. 


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



[PHP] Re: php-general Digest 5 May 2011 21:55:09 -0000 Issue 7299

2011-05-06 Thread David Robley
e-letter wrote:

> Readers,
> 
> Looking through the mail lists archives, only the following message
> seems to advise about the possibility to use gnuplot:
> http://marc.info/?l=php-general&m=96248542218029&w=2
> 
> Is it possible to start gnuplot using php, to plot a graph from
> postgresql data. For example, a table is created in the required
> gnuplot data file format so the command for gnuplot would be something
> like:
> 
> plot <"SELECT * FROM gnuplotdatatable;"
> 
> But can't see a php command to start gnuplot in the first step. Any help
> please?

You might find jpgraph useful.


Cheers
-- 
David Robley

Pizza IS the four food groups!
Today is Sweetmorn, the 53rd day of Discord in the YOLD 3177. 


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



[PHP] Re: Installing on a Mac: include_path issues

2011-05-04 Thread David Robley
Ken Kixmoeller wrote:

> Hey, folks -- --
> 
> I am switching over my development (I hope) to a Mac. Having some
> trouble with the configuration. Rudimentary scripts run fine in the
> document_root, but beyond that, my scripts in the include_path are not
> found.
> 
> The include_path has a couple of directories in which I have my
> foundation classes and a clients application classes and other
> programs. For various reasons, I put them into my "Documents/Clients"
> folder. When I create to set the path to these files in PHP, they are:
> 
>  /Users/ken/Documents/Clients/comped_php
>  /Users/ken/Documents/Clients/jaguar_php
> 
> PHP doesn't find them, which has me stumped.
> 
> php.ini shows the include_path correctly, as:
>   
> /Users/ken/Documents/Clients/comped_php:/Users/ken/Documents/Clients/jaguar_php
> 
> the document_root, configured in Apache is: /Users/ken/Sites/
> 
> The errors show as:
> include_once() [function.include]: Failed opening 'smm_header.php' for
> inclusion
>
(include_path='/Users/ken/Documents/Clients/comped_php:/Users/ken/Documents/Clients/jaguar_php')
> in /Users/ken/Sites/smm_registration/smmcomputereducation.php on line 1
> 
> Any ideas or suggestions?
> 
> Thanks,
> 
> Ken

If I remember correctly, include and friends have two parts to the error
message but you've only shown us one. For a guess, is it possible the
apache process doesn't have permissions for those directories and/or the
files within them?



Cheers
-- 
David Robley

I've got Parkinson's disease. And he's got mine.
Today is Setting Orange, the 52nd day of Discord in the YOLD 3177. 


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



Re: [PHP] postgresql database access failure

2011-05-01 Thread David Robley
e-letter wrote:

> The file was changed:
> 
> ...   $value=pg_fetch_result($query,1,1);
> echo 'all files' . var_dump($value);
> ...
> 
> The resultant web page produces:
> 
> bool(false) all files
> 
> The php file was changed again:
> 
> ...   $value=pg_fetch_result($query);
> echo 'all files' . var_dump($value);
> ...
> 
> The resultant web page produces:
> 
> NULL all files
> 
> The error log shows:
> 
> ...PHP Warning:  pg_fetch_result(): supplied argument is not a valid
> PostgreSQL result resource...
> 
> The objective is to learn how to extract data from a database and
> print to a web browser, but not much progress made so far..!

There is a good example of how to use pg_fetch_result in the docs at
http://php.net/manual/en/function.pg-fetch-result.php.

On the basis of the code shown here, it's a bit hard to determine exactly
what your problem is; however the odds are that the error "supplied
argument is not a valid PostgreSQL result resource" results from a SQL
syntax error, or possibly that you have failed to open a connection to
pgsql. However, there are some tools to help you; see
http://php.net/manual/en/function.pg-result-error.php

For future reference, it helps to post all the code that is relevant to your
problem, so in this case it would help, for example, to see how you are
making the connection to pgsql and how the $query variable is populated.



Cheers
-- 
David Robley

A seminar on Time Travel will be held two weeks ago.
Today is Boomtime, the 49th day of Discord in the YOLD 3177. 


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



[PHP] Re: htaccess question

2011-04-26 Thread David Robley
Al wrote:

> I want to restrict access to all files except one on my site and in parent
> dir. Thought this should work; but it doesn't.
> 
> 
> Order Deny,Allow
> Deny from all
> Allow from xx.36.2.215
> 
> 
> xx.36.2.215 is actual value IP
> 
> This file makes a captcha image and is called with
>  in file
> /dir/control.php
> 
> makeScodeImg.php is=> /dir/includes/makeScodeImg.php
> 
> Works fine if "allow all" just for testing
> 
> Thanks

Seems like more of a question for an apache group than a php group. Or you
might check the apache docs at:

http://httpd.apache.org/docs/2.2/howto/htaccess.html
http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#allow


Cheers
-- 
David Robley

To be, or not to be, those are the parameters.
Today is Sweetmorn, the 43rd day of Discord in the YOLD 3177. 


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



[PHP] Re: How to write a PHP coding to list out all files and directories as links to them?

2011-04-14 Thread David Robley
Mikhail S wrote:

> How to write a PHP coding to list out all files and directories as links
> to them?
> 
> This is somewhat similar to some index pages. When new file or folder is
> added to the directory, HTML page should display the newly created
> file/folder together with previous ones after it is being refreshed.
> (prefer in alphabatical order)
> 
> How to achieve this sort of functionality in PHP? Please provide sample
> coding as well. (and any references)
> 
> Thanks.
> 
> --
> Mike
> http://jp.shopsloop.com/

Start with http://php.net/manual/en/function.opendir.php for a basic method.

Alternatively you can use the SPL DirectoryIterator class
http://php.net/manual/en/class.directoryiterator.php

http://php.net is your first resource for php



Cheers
-- 
David Robley

Hm..what's this red button fo:=/07http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: a shortcut to set variable

2011-04-12 Thread David Robley
Joe Francis wrote:

> eh, I just want to get a shortcut like
> 
> $id = isset($_GET['id']) ? $_GET['id'] : 0;
> 
> 
> BTW, I'm using PHP5.3+, thanks bros.
> 

That should work - what is not happening that you expect to happen, or the
other way round? 


Cheers
-- 
David Robley

The best way to keep friends is not to give them away.
Today is Boomtime, the 29th day of Discord in the YOLD 3177. 


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



[PHP] Re: putting variables in a variable

2011-03-25 Thread David Robley
Hulf wrote:

> Hi,
> 
> I am making and HTML email. I have 3 images to put in. Currently I have
> 
> $body .="
> 
>   
> 
>   
> 
>   
> 
>   
> 
> ";
> 
> 
> ideally I would like to have
> 
> $myimage1 = "image1.jpg";
> $myimage2 = "image2.jpg";
> $myimage3 = "image3.jpg";
> 
> 
> and put them into the HTML body variable. I have tried escaping them in
> every way i can think of, dots and slashes and the rest. Any ideas?
> 
> 
> Ross

Did you try

$body .="

  
    
  

  
    
  

";

It helps us help you if you can give examples of what you have tried and how
it didn't work as you expected.


Cheers
-- 
David Robley

Terminal glare: A look that kills...
Today is Setting Orange, the 12nd day of Discord in the YOLD 3177. 


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



Re: [PHP] Re: echo?

2011-03-23 Thread David Robley
Jim Giner wrote:

> I am outputting to a  on an html page.  A  doesn't work, nor
> does \n, hence the 
.  Of course, if I don't need the & then I've
> just saved two keystrokes.  :)  Also - I do believe I tried ($i+1) and
> that didn't work either.
> 
> "Paul M Foster"  wrote in message
> news:20110323034621.go1...@quillandmouse.com...
>> On Tue, Mar 22, 2011 at 10:50:54PM -0400, Jim Giner wrote:
>>
>>> Yes - it is J and I.  I tried using $i+1 in the echo originally but it
>>> wouldn't run.  That's why I created $j.
>>
>> Yes, the substitution creates a syntax error unless surrounded by
>> parentheses or the like.
>>
>>> And just what is wrong with the old cr/lf sequence?  How would you have
>>> done
>>> it?
>>
>> You're using HTML-encoded entities for 0x0d and 0x0a. You can simply
>> use 0x0d and 0x0a instead. If you're running this in a web context, you
>> should use "" instead of CRLF. At the command line, I'm not
>> familiar with running PHP on Windows. In *nix environments, it's enough
>> to use "\n", just as they do in C. It might even work in Windows; I
>> don't know. If not, you should be able to use "\r\n". You can also try
>> the constant PHP_EOL, which is supposed to handle newlines in a
>> cross-platform way.
>>
>> Paul
>>
>> --
>> Paul M. Foster
>> http://noferblatz.com
>> http://quillandmouse.com

It's possibly worth reinforcing at this stage of the game that 
 and 

are incorrectly formed strings to represent CR and LF, in that they should
have a closing semicolon to delimit the end of the entity. I think this was
pointed out elsewhere but I believe it deserves repeating.


Cheers
-- 
David Robley

Sumo Wrestling: survival of the fattest.
Today is Pungenday, the 10th day of Discord in the YOLD 3177. 


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



[PHP] Re: Sorting an array

2011-03-01 Thread David Robley
Ron Piggott wrote:

> 
> I need help to know how to sort the words / phrases in my array.
> 
> Variable name: $words_used
> print_r( $words_used ); Current output: Array ( [187] => Sin [249] =>
> Punished [98] => Sanctuary [596] => Sing [362] => Anointing Oil ) Desired
> result: Alphabetical sort: Array ( [362] => Anointing Oil [249] =>
> Punished [98] => Sanctuary [187] => Sin [596] => Sing )
> 
> The #?s are the auto_increment value of the word in the mySQL database. 
> The number is not representative of alphabetical order, but the order it
> was added to the database.
> 
> Thank you for your assistance.
> 
> Ron

Like the man said - asort. May I recommend you to http://php.net where you
will find the answer to most of your queries, simply by looking under a
generic area, such as array (http://php.net/array) for this particular
problem. Surely you have been around here long enough to be able to find
things in the documentation, or at least try there first, by now?




Cheers
-- 
David Robley

Do fish get thirsty?
Today is Setting Orange, the 60th day of Chaos in the YOLD 3177. 


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



Re: [PHP] New to list and to PHP

2011-02-19 Thread David Robley
Daniel Brown wrote:

> On Fri, Feb 18, 2011 at 14:03, Pete Woodhead 
> wrote:
>> Hi I'm Pete Woodhead.  I'm new to the list and to PHP.  To be honest I
>> very new to code writing.
>> Thought this would be a good way to learn good habits as well as good
>> code writing.
>> Looking forward to learning and participating.
> 
> Fantastic.  As the new guy, you're expected to sweep the floors
> here each Tuesday and Saturday evening.  Lesson one: buy a broom.
> 
A shovel might also be useful - Dan forgot to mention the stables...



Cheers
-- 
David Robley

On a radiator repair shop: Best place to take a leak.
Today is Sweetmorn, the 51st day of Chaos in the YOLD 3177. 


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



Re: [PHP] Finding split points in an article for inserting ads

2011-02-15 Thread David Robley
Brian Dunning wrote:

> Yes, thanks, what I'm looking for is how to do that.
> 
> On Feb 15, 2011, at 1:38 PM, Simon J Welsh wrote:
> 
>> Assuming you're only using  tags, count the number of opening 
>> tags, divide by three. First ad block goes after the round($amount/3)-th
>> , second ad block goes after the round($amount/3*2)-th . ---
>> Simon Welsh

Try substr_count ??


Cheers
-- 
David Robley

Sure, it's clean laundry. The cat's sitting on it, isn't he?
Today is Boomtime, the 47th day of Chaos in the YOLD 3177. 


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



Re: [PHP] Re: bread and buytter php

2011-02-04 Thread David Robley
On Sat, 5 Feb 2011, Kirk Bailey wrote:
> If I wanted to reinvent the wheel, I would not have wasted the
> list's bandwidth, I would go burn the hours I do not have to spare
> on rewriting things already written years before by someone else.
>
> On 2/4/2011 12:46 AM, David Robley wrote:
> > Kirk Bailey wrote:
> >> Where is a good place for bread and butter day in day out routinely
> >> needed functionality in php?
> >
> > Content management system? Framework? PEAR? Write your own
> > library/classes?
> >
> >
> >
> > Cheers

Well, I fear I could not be more specific as your request fitted in the 
category of IDFMA

It must be Friday still somewhere...


Cheers
-- 
David Robley

Math is the language God used to write the universe.
Today is Sweetmorn, the 36th day of Chaos in the YOLD 3177. 

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



[PHP] Re: bread and buytter php

2011-02-03 Thread David Robley
Kirk Bailey wrote:

> Where is a good place for bread and butter day in day out routinely
> needed functionality in php?
> 
Content management system? Framework? PEAR? Write your own library/classes?



Cheers
-- 
David Robley

Iraqi Bingo B-52..F-16..A-10.. F-18..F-117..B-2
Today is Setting Orange, the 35th day of Chaos in the YOLD 3177. 


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



Re: [PHP] nl2br problem

2011-02-01 Thread David Robley
David Hutto wrote:

> If project names are indications of programmer's Freudian insights,
> then what is the FCKEditor?

Perhaps that questions should be asked of the lead developer's parents, who
had the temerity to name him Frederico Caldeira Knabben.


Cheers
-- 
David Robley

"I need an injection," Tom pleaded in vain.
Today is Pungenday, the 33rd day of Chaos in the YOLD 3177. 


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



Re: [PHP] No SMTP server? Can't get mail()

2011-01-24 Thread David Robley
Paul S wrote:

> On Sun, 23 Jan 2011 12:40:25 +0700, David Robley 
> wrote:
> 
>> Paul S wrote:
>>> I'm a little new to PHP.
> 
> David starts:
>> Nobody seems to have mentioned it, but the SMTP info is only needed on a
>> Win
>> system. The following is an extract from a default php.ini file:
>>
> 
> Well, I have just RTF mail() Manual and you are ABSOLUTELY correct SMTP
> info is not needed for PHP mail(). SORRY for that confusion.
> 
> Where my confusion started, I guess, and why I was trying to get
> confirmation of the SMTP server name
> and try mail() at the same time was the mention of both in a "SMTP" option
> in the default php config.php
> file for the email list program that I am trying to get running, as
> follows ...
> 
> # If you want to use the PHPMailer class from
> phpmailer.sourceforge.net, set the following
> # to 1. If you tend to send out html emails, it is recommended to do so.
> define("PHPMAILER",1);
> 
> # To use a SMTP please give your server hostname here, leave it blank to
> use the standard
> # PHP mail() command.
> define("PHPMAILERHOST",'');"

This gives you the option to use mail() (not SMTP) on the localhost - i.e
the server where the script is running, probably your ISP or hosting
company;

or;

to set the MAILERHOST to an external mail server using SMTP, maybe gmail,
yahoo mail, the mail provided by your ISP


> I'm still confused! :-( I can't even put my confusion into words hahahaha.
> 
> Is it SMTP server that uses sendmail or sendmail uses an SMTP server???

Not going there if you are as fresh to the Internet as your question
suggests :-)
> 
> PHPMAILER doesn't need an SMTP server name?
> 
> OK, I've just googled PHPMAILERHOST and see "confusing" a few times. I
> will follow it from here for now.
> 
>> mail() should be functional; if mail() is returning true then your next
>> step
>> in the debug process would be to check the mail logs, if they are
>> accessible to you.
> 
> Well, I am glad you agree!
> 
> no access that I know of.
> No telnet.
> and
> no helpful replies from the staff, ever
> and
> No PHPINFO and no echo of even what Apache server version I am using (see
> blocked info in my post above)
> RANT: I could put just this whole project aside by just using an old v.
> simple emaillist program that uses mail().! I'm about to give up here.
> 
>>
>> On the other hand, using an SMTP class will give you a bit more
>> functionality.
>>
> 
> I'll check SMTP classes out. Thank you.

phpMailer is an SMTP class :-) See also swiftmail, and probably quite a few
others. Generally they will handle both sending mail from the localhost -
where the script is, mail() - or a remote SMTP host.




Cheers
-- 
David Robley

Happiness is finding special characters .
Today is Prickle-Prickle, the 24th day of Chaos in the YOLD 3177. 


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



Re: [PHP] No SMTP server? Can't get mail()

2011-01-22 Thread David Robley
Paul S wrote:

> On Fri, 21 Jan 2011 13:41:21 +0700, Peter Lind 
> wrote:
> 
>> Probably not the solution you were looking for, but I've always found
>> mail()
>> very unstable and I tend to use a mail library instead. Like phpmailer or
>> swiftmailer. Easier to configure and figure out problems with.
>>
>> Regards
>> Peter
> 
> Peter, that is warranted advice here.
> 
> I'm a little new to PHP. I'm set up to develop Apache/PHP/MySQL on my PC
> uploading results to a unix server. My situation here is that I am trying
> to get a PHP Mailing List program running for a friend's business web site
> (on unix). That program has 2 options for mailing: 1) mail()/SMTP and
> 2) phpmailer options. Mail()/SMTP works, at least, on my PC. But I can't
> get either of
> the two emailing options to work on the UNIX server. (Whatever those mail
> problems are, it is mangled with odd PHP/MySQL problems on unix).
> I'm just 'back here' starting debugging with the mail()/SMTP option on
> unix and my conclusion based on feedback above (thank you) is that email
> IS reaching the unix SMTP server but is not being forwarded (and that's
> unresolved now).
> 
> My mentioned "SMTP server echo problem" is irrelevant. Maybe they fixed it
> last night, or maybe I was smoking something yesterday. It IS echoing
> correctly.
> I finally figured out that part of my problem was misunderstanding a
> warning
> message caused by my not single quoting SMTP (yikes!).
> 
> Or maybe I was just
> enraged over my lack of success all day yesterday to confirm Apache server
> information on the unix server (which would help me guarantee that I have
> the same Apache/PHP/MySQL configurations between the PC and unix servers).
> But today the SMTP server info IS echo'd on the unix server. From the Unix
> server ...
> 

Nobody seems to have mentioned it, but the SMTP info is only needed on a Win
system. The following is an extract from a default php.ini file:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = m...@example.com

; For Unix only.  You may supply arguments as well
(default: "sendmail -t -i").
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra
parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

mail() should be functional; if mail() is returning true then your next step
in the debug process would be to check the mail logs, if they are
accessible to you.

On the other hand, using an SMTP class will give you a bit more
functionality.




Cheers
-- 
David Robley

Supernovae are a Blast
Today is Pungenday, the 23rd day of Chaos in the YOLD 3177. 


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



Re: [PHP] Re: query strings and other delights

2011-01-13 Thread David Robley
kbai...@howlermonkey.net wrote:

> ...Holy cow... nothing to extract the query string, it's automatically
> part of the environment. So I just do work with the $_GET string, it's
> in there already... yikes.
> 
> 

You might find phpinfo() particularly useful as an indicator of how php is
configured and most of the built in variables such as environment
variables.

Also http://php.net/manual/en/language.variables.external.php
http://php.net/manual/en/reserved.variables.php

Spend a little while perusing the documentation at php.net - it is very
good. And php.net/function-name is a handy way of looking up a specific
function.



Cheers
-- 
David Robley

Diagonally parked in a parallel universe.
Today is Prickle-Prickle, the 14th day of Chaos in the YOLD 3177. 


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



[PHP] Re: HTML errors

2011-01-11 Thread David Robley
David McGlone wrote:

> Hi Everyone, I'm having a problem validating some links I have in a
> foreach. Here is my code:
>   "http://www.w3.org/TR/html4/loose.dtd";>
> 
> my PHP code:
> $categorys = array('home', 'services', 'gallery', 'about_us',
> 'contact_us', 'testimonials');
> foreach($categorys as $category){
> $replace = str_replace("_", " ", $category);
> echo "$replace";
> }
> 
> Validator Error:
> an attribute value must be a literal unless it contains only name
> characters
> 
> ?ome>home href=index.php?page=services>services 
> I have tried various combinatons and different doctypes. I'm beginning to
> wonder if this code is allowed at all.
> 
> 

In this tag you aren't getting the href value enclosed in quotes which I
suspect would trigger the validator error.





Cheers
-- 
David Robley

"I'll take that," said Tom appropriately.
Today is Boomtime, the 12nd day of Chaos in the YOLD 3177. 


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



[PHP] Re: Re: Re: PHP extension for equivalen of "getent"?

2011-01-08 Thread David Robley
Michelle Konzack wrote:

> Hello David Robley,
> 
> Am 2011-01-08 16:25:38, hacktest Du folgendes herunter:
>> You might find http://xchm.sourceforge.net/ useful :-)
> 
> [ 'apt-cache policy xchm' ]-
> xchm:
>   Installiert: 2:1.14-4
>   Kandidat: 2:1.14-4
>   Versions-Tabelle:
>  *** 2:1.14-4 0
> 900 ftp://ftp2.de.debian.org lenny/main Packages
> 100 /var/lib/dpkg/status
> 
> 
> and it crash all the time...  :-(
> 
> Thanks, Greetings and nice Day/Evening
> Michelle Konzack
> 

It's not Friday, so I won't go Off Topic and suggest you try compiling from 
source :-)


Cheers
-- 
David Robley

"Boy, these blintzes are good!" said Tom judiciously.
Today is Pungenday, the 8th day of Chaos in the YOLD 3177. 


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



[PHP] Re: Re: Re: PHP extension for equivalen of "getent"?

2011-01-07 Thread David Robley
Michelle Konzack wrote:

> Hello Tommy Pham,
> 
> Am 2011-01-07 19:31:17, hacktest Du folgendes herunter:
>> There's the chm download for the times when you're unplugged :)
> 
> I was never able to open ths chm files under Debian
> 
> Thanks, Greetings and nice Day/Evening
> Michelle Konzack
> 

You might find http://xchm.sourceforge.net/ useful :-)



Cheers
-- 
David Robley

Everyone has photographic memory...some don't have film!
Today is Pungenday, the 8th day of Chaos in the YOLD 3177. 


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



Re: [PHP] Newbie Question

2011-01-01 Thread David Robley
Joshua Kehn wrote:

> On Jan 1, 2011, at 7:36 PM, Adolfo Olivera wrote:
> 
>> Hi,
>>I'm new for php. Just trying to get my hello  world going on godaddy
>> hosting. Can't getting to work. I think sintax it's ok. I was
>> understanding that my shared hosting plan had php installed. Any
>> suggestions. Thanks,
>> 
>> Happy 2011!!
>> 
>> PS: Please, feel free to educate me on how to address the mailing list,
>> since again, I'm new to php and not a regular user of mailing lists,
> 
> 
> Can you post the code that you are using?
> 
> It should look something like the following:
> 
> 
> 

And normally would need to be saved as a .php file so the contents will be
handled by php.


Cheers
-- 
David Robley

A fool and his money are my two favourite people.
Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. 


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



Re: [PHP] code quest - ECHO?!?

2010-12-12 Thread David Robley
Kirk Bailey wrote:

> Ok, so what is echo, and how is it different from print.
> 
> The code in code quest used echo. I have a copy of learning php 5.0 from
> O'Reilly, and noplace does it mention echo. Why? What's the difference?
> IS there a difference? Is there an advantage to either? Please clarify
> for this newbie.
> 

The documentation says it all better than I can:

http://php.net/manual/en/function.echo.php
http://php.net/manual/en/function.print.php

Cheers
-- 
David Robley

OPERATOR! Trace this call and tell me where I am.
Today is Sweetmorn, the 54th day of The Aftermath in the YOLD 3176. 


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



Re: [PHP] Template engines

2010-11-11 Thread David Robley
On Thu, 11 Nov 2010, Robert Cummings wrote:
> On 10-11-11 02:20 AM, David Robley wrote:
> > Daniel P. Brown wrote:
> >> On Wed, Nov 10, 2010 at 20:59, Nathan Rixham  
wrote:
> >>> I went back to using a pre hypertext processor, seemed like a
> >>> really powerful templating engine that was v familiar to use :p
> >>
> >>  Pre-hypertext preprocessor?  Perl?
> >
> > Pre Hypertext Processor - the acronym sounds familiar :-)
>
> I think I saw something about that on someone's Personal Home Page!
>
> Cheers,
> Rob.

Perchance they were talking about a Form Interpreter ? 



Cheers
-- 
David Robley

"Here's someone who can't speak!" exclaimed Tom dumbfoundedly.
Today is Setting Orange, the 23rd day of The Aftermath in the YOLD 3176. 

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



Re: [PHP] Template engines

2010-11-10 Thread David Robley
Daniel P. Brown wrote:

> On Wed, Nov 10, 2010 at 20:59, Nathan Rixham  wrote:
>>
>> I went back to using a pre hypertext processor, seemed like a really
>> powerful templating engine that was v familiar to use :p
> 
> Pre-hypertext preprocessor?  Perl?
> 

Pre Hypertext Processor - the acronym sounds familiar :-)



Cheers
-- 
David Robley

Coming Soon!! Mouse Support for Edlin!!
Today is Setting Orange, the 23rd day of The Aftermath in the YOLD 3176. 


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



Re: [PHP] Disabling an extension on a perdir basis.

2010-09-12 Thread David Robley
Richard Quadling wrote:

> On 11 September 2010 20:24, Jim Lucas  wrote:
>> As I thought, looking through the docs, it looks like the only way to set
>> the options that are only settable via the php.ini file is to use a per
>> directory php.ini file.  But, the problem with that is, it only works
>> with the CGI/FASTCGI SAPI version of php.  It won't work with the apache
>> mod version.
>>
>> So, I guess the question back to you is, what is your setup like?  And if
>> it isn't CGI/FASTCGI SAPI are you willing to change to that setup?
>>
>> Read More: http://www.php.net/manual/en/configuration.file.per-user.php
> 
> Thanks for that. FastCGI. Will do some more work on it now.
> 
> 
If you are wanting to disable parsing of php files on a per-directory basis,
you can do this via .htaccess using

php_flag engine 1|0 (or on|off if you prefer)

http://php.net/manual/en/apache.configuration.php#ini.engine Rather well
hidden - took me a few minutes to dig it out :-)



Cheers
-- 
David Robley

If you would know a man, observe how he treats a cat.
Today is Setting Orange, the 36th day of Bureaucracy in the YOLD 3176. 


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



[PHP] Re: Text editor for Ubuntu with FTP

2010-07-31 Thread David Robley
Jordan Jovanov wrote:

> Hello to All,
> 
> I only whant to star discussion for who is the best programm to write
> php and html script. I use dreamweaver, but now I change my OS to ubuntu
> and I want some suggestions for some Text editor for FTP for Ubuntu
> 
> 
> Thanks A lot
> Jordan Jovanov

Ah, it's the time of year for an editor thread again :-) Have a look at
http://www.php-editors.com/ or
http://en.wikipedia.org/wiki/List_of_PHP_editors or even google "php
editor"

As for "best" that can be very subjective depending on what _you_ want the
editor to do.


Cheers
-- 
David Robley

System going down at 1:45 p.m. for disk crashing.
Today is Pungenday, the 67th day of Confusion in the YOLD 3176. 


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



[PHP] Re: eval and HEREDOC

2010-07-20 Thread David Robley
Sorin Buturugeanu wrote:

> Hello,
> 
> I am having trouble with a part of my templating script. I'll try to
> explain:
> 
> The template itself is HTML with PHP code inside it, like:
> 
> 
> 
> And I have the following code as part of the templating engine:
> 
> $template = file_get_contents($file);
> $template = "return << $template = eval($template);
> 
> The problem is that the eval() HEREDOC combination gives the following
> output:
> 
> 
> 
> If in the HTML file (template) I use
> 
> 
> 
> I get   as an output.
> 
> I have tried closing the php tag like this:
> 
> $template = "return <<".$template."\nTEMPLATE;\n";
> 
> but the extra ?> only gets outputed as HTML.
> 
> This is my first post to this mailing list, so I great you all and thank
> you for any kind of solution to my problem.
> 
> Thank you!

Possibly your php environment has short-tags turned off.


Cheers
-- 
David Robley

To save trouble later, Joe named his cat Roadkill Fred
Today is Boomtime, the 56th day of Confusion in the YOLD 3176. 


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



[PHP] Re: NULL Date Entries...

2010-07-02 Thread David Robley
Don Wieland wrote:

> In one of my forms, I am building a variable that I can use as an
> INSERT string.
> 
> On my form, I have several DATE fields which exist of 3 fields MM - DD
> - 
> 
> when I build my string it looks like this:
> 
> array('dbf'=>'applicant_dob',
> 'f'=>array('applicant_dob_1','applicant_dob_2','applicant_dob_3'),
> 'req'=>0, 's'=>'/'),
> 
> This enters in the DB fine when there is a DATE, but when these fields
> are left empty, it inserts into the the DB as 2069-12-31.
> 
> How does one deal with this?
> 
> Don Wieland

Aside from all the good advice already offered, if you want to accept a null
date, check what your DB does with it and whether you can set a default for
an empty date. Mysql for example can use -00-00


Cheers
-- 
David Robley

Microsoft - We put the "backwards" into backwards compatibility.
Today is Pungenday, the 37th day of Confusion in the YOLD 3176. 


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



Re: [PHP] NULL Date Entries...

2010-07-02 Thread David Robley
Paul M Foster wrote:

> 
> 
> 
>> 
>> However, checking to ensure the date is indeed valid and not something
>> like 31st February is a good idea I agree! :)
> 
> Wait-- there's not a 31st of February? When did they change that? ;-}
> 
> Paul
> 
I believe it was last February 30th the decision was made...



Cheers
-- 
David Robley

Kids-They're not sleeping, they're recharging!
Today is Pungenday, the 37th day of Confusion in the YOLD 3176. 


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



RE: [PHP] Forward to a Different PHP Script?

2010-05-11 Thread David Robley
Arno Kuhl wrote:

> -Original Message-
> From: Alice Wei [mailto:aj...@alumni.iu.edu]
> Sent: 11 May 2010 10:55 AM
> Subject: [PHP] Forward to a Different PHP Script?
> 
> Hi,
> 
> I am not sure if this makes sense, but here is a snippet of what I have:
> 
> $q=$_GET["q"];
> 
> //find out which feed was selected
> if($q=="Herald Times")
>   {
>   $xml=("http://www.heraldtimesonline.com/rss/news.xml";);
>   }
>   else{
>
>//execute a whole different php program, like
> http://localhost/mypages/another_program.php
>exit;
>   }
> 
> Is it possible that I could do something like this? If yes, what is the
> name of the function that I should use?
> Thanks for your help.
> 
> Alice
> _
> 
> 
> Use include(mypages/another_program.php);
> 
> Cheers
> Arno

Alternatively you could use header() to perform a redirect to another
page/site/whatever. With the warning that there should be no output 
before the call to header; but see also output buffering if needed.


Cheers
-- 
David Robley

I owe, I owe, it's off to work I go.
Today is Sweetmorn, the 58th day of Discord in the YOLD 3176. 


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



Re: [PHP] replying to list

2010-04-21 Thread David Robley
Ashley Sheridan wrote:

> On Wed, 2010-04-21 at 13:00 +0200, Nick Balestra wrote:
> 
>> Not really i think, because by replying it just direct reply to the OP,
>> while other systems like google groups for example by replying you just
>> post to the list, and actually make more sense.
>> 
>> the easy way is to hit reply and change the "to" into
>> php-general@lists.php.net or reply to all and replace "to" with the "cc".
>> I think the best practice is to take this 5 second to take care of this
>> in order to avoid duplicate message to others.
>> 
>> cheers
>> 
>> Nick
>> 
>> On Apr 21, 2010, at 12:45 PM, Karl DeSaulniers wrote:
>> 
>> > Exactly.
>> > :)
>> > 
>> > Karl
>> > 
>> > On Apr 21, 2010, at 5:38 AM, David McGlone wrote:
>> > 
>> >> Maybe it's not how the list is set up, but instead how people are
>> >> replying to the list.
>> > 
>> > Karl DeSaulniers
>> > Design Drumm
>> > http://designdrumm.com
>> > 
>> > 
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> > 
>> 
>> 
> 
> 
> I'm only on one other mailing list, but it behaves exactly the same as
> the php-general one. It makes sense really to me, as the email is coming
> from the person who wrote it, and it's behaving as if we're just bcc'd
> in as a list. I think the fault is with the email clients that don't
> understand mailing lists.
> 
> Incidentally, I saw someone mention the Evolution email client in this
> thread. It's what I use, and it does have a reply to list option (but I
> tend to be a bit lazy and hit reply to all as the option is in a menu
> and not on the toolbar :-/ )
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk

This is an oldie but I think it is still a goodie in respect of this
discussion.

http://www.unicom.com/pw/reply-to-harmful.html


Cheers
-- 
David Robley

On an electrician's truck: Let Us Remove Your Shorts
Today is Sweetmorn, the 38th day of Discord in the YOLD 3176. 


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



[PHP] Re: Server-side postscript-to-PDF on-the-fly conversion

2010-03-26 Thread David Robley
Rob Gould wrote:

> Is there a free solution out there that will enable me to take a
> PHP-generated postscript output file, and dynamically, on-the-fly convert
> it to a PDF document and send to the user as a download when the user
> clients on a link?
> 
> More description of what I'm trying to do:
> 
> 1)  I've got a web-page that accepts some user input
> 2)  They hit SUBMIT
> 3)  I've got a PHP file that takes that input and generates a custom
> Postscript file from it, which I presently serve back to the user.  On a
> Mac, Safari and Firefox automatically take the .ps output and render it in
> Preview.
> 4)  However, in the world of Windows, it seems like it'd be better to just
> convert it on-the-fly into a PDF, so that the user doesn't need to worry
> about having a post-script viewer app installed.

Ghostscript is the first thing that comes to my mind; alternatively googling
for "convert postscript pdf" or similar might turn up other options.


Cheers
-- 
David Robley

To a cat, "NO!" means "Not while I'm looking."
Today is Sweetmorn, the 13rd day of Discord in the YOLD 3176. 


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



[PHP] Re: Event Handling

2010-03-15 Thread David Robley
Alex Major wrote:

> Greetings all,
> 
> I'm currently looking at building a web application, however I've run into
> an area of development I've not come across before. The web site in its
> basic form allows users to send cars from a point and then the car will
> arrive at another point. When the car is set on its way, the start time,
> travel duration and end time are all known and stored in a MySQL database,
> what I would like to happen is that an event is triggered on the server at
> the end time and then an e-mail is sent to the user. This should happen
> regardless of whether someone is browsing the website or not.
> 
> I don't believe that I'll be able to solely use PHP, I have spent the
> afternoon trying to look at potential solutions but I have to admit I've
> drawn a blank. Google hasn't been helpful (64 pages so far), as any
> searches related to "event handling" bring up a load of JavaScript
> tutorials/help for 'onclick' events etc. I have searched through the PHP
> documentation and found "libevent"
> (http://www.php.net/manual/en/book.libevent.php ), I don't believe that is
> what I require (although in all honesty the lack of documentation on it
> means I'm quite in the dark as to its purpose). Another potential
> candidate I came across was a PHP/Java bridge
> (http://php-java-bridge.sourceforge.net/pjb/ ), whereby I could use the
> java virtual machine, register events with it and then callback PHP
> scripts, although this seems extremely long winded.
> 
> I was hoping that someone might have some experience with this kind of
> issue and could point me in the right direction. I'm sure I've missed
> something right in front of me.
> 
> Alex.

I think what you want is something to trigger a php script every
$period-of-time; if your host supports it, cron is the means of executing
an application at regular intervals down to a minute granularity. There are
some web-based cron services also, but they may not have the same
granularity as a locally based cron.


Cheers
-- 
David Robley

"Wow!" barked Tom, with a bow.
Today is Prickle-Prickle, the 1st day of Discord in the YOLD 3176. 


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



[PHP] Re: PHP in HTML code

2010-03-12 Thread David Robley
Martine Osias wrote:

> An HTML/PHP code migrated to a different hosting platform seems to behave
> differently. The PHP statements within HTML fields or within tables  does
> not execute
> 
> PHP within table:
> 
> 
>align="left">
>  
> 
> This PHP code doesn't print in the HTML page.
> 
> PHP within form field:
> 
>  readonly="">
> 
> This PHP code shows on the page when it shouldn't. The same variable is an
> input and an output in this form:
> 
> 

> 
> Are there times when the http://www.php.net/manual/en/ini.core.php#ini.short-open-tag for more info.

I'd suggest you move away from using short tags, if for no other reason than
portability.


Cheers
-- 
David Robley

A conclusion is simply the place where you got tired of thinking.
Today is Boomtime, the 72nd day of Chaos in the YOLD 3176. 


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



[PHP] Re: App to put a whole PHP Site in CD/DVD

2010-03-04 Thread David Robley
Juan wrote:

> Hi,
> I need an application to run mysql/php/apache or similar in one cd, to
> make a presentation.
> 
> The presentation itself is a php site that uses mysql to do some
> queries, to show data, and I would like to know how to embbed php and
> mysql to one cd for a presentation. I mean; one cd containing the
> whole site, and when the user inserts it on the cd/dvd reader it's
> able to use the website like if him/her would be using the http
> protocol. So, this application should let me put mysql/php/apache in
> the cd, then it should work from the cd.
> 
> I would like to use some free software application, I would like to
> avoid using commercial branches because I need this for a commercial
> project that isn't able to pay licenses. Also I preffer Free Software.
> 
> So, if you know some appplication that helps me to develop this, and
> also if I would be able to make the cd multiplatform for the principal
> OS ( Gnu/linux, win, mac ) even better.
> 
> Thanks a lot.
> 
> Juan

Rather than providing an identical environment, you could use HTTrack
http://www.httrack.com/ to create a static mirror of the site which has all
the functionality of the dynamic site in static html form. Just stick the
mirror on a CD with an appropriate autorun.inf if you want it to autostart.



Cheers
-- 
David Robley

Sure, it's clean laundry. The cat's sitting on it, isn't he?
Today is Pungenday, the 63rd day of Chaos in the YOLD 3176. 


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



[PHP] Re: [php] & [mysql] select and subselect

2009-11-17 Thread David Robley
Allen McCabe wrote:

> I have a page on my site where I can optionaly filter by certain fields
> (order by filesize or file category), but I am implementing a shopping
> cart type of idea where users can submit an order.
> 
> As administrators, my coworkers and I need to be able to filter orders by
> their contents. For example:
> 
> View all orders for "Jack and the Beanstalk," where an order may have Jack
> and the Beanstalk and other items.
> 
> I have an order table that keeps track of the order_id, the date, the
> status, etc. I also have an order_lineitem table that is the contents of
> the order. This has a one-to-many structure (without foreign keys because
> it is mysql).
> 
> I was baffled as to how to filter the orders by the item_id that appears
> in the order_lineitem table.
> 
> I just came up with this, but I'm not sure how the mysql_queries will
> handle an array. Do I have to do some extensive regular expression
> management here to get this to work, or will it accept an array?
> 
>  
> if (isset($_POST['showid']))
>$showid = $_POST['showid'];
>$subSQL = "SELECT order_id FROM afy_show_lineitem WHERE show_id =
> {$_POST['showid']};";
>$subResult = mysql_query($subSQL);
>$where = "WHERE";
>$extQuery = 'order_id = {$subResult}';
>   }
> 
> $resultOrders = mysql_query("SELECT * FROM afy_order {$where}
> {$extQuery};") or die(mysql_error("Could not query the database!"));
> 
> ?>
If $_POST['showid'] is likely to be an array, use implode to create a comma
separated string of values, then use IN to build the query.

$ids = implode(',', $_POST['showid'];
$subSQL = "SELECT order_id FROM afy_show_lineitem WHERE show_id IN ($ids)"

But you need also to check your logic - your query above will have two WHERE
in it and will fail miserably :-) And your call to mysql_error will
probably not help you either, as the (optional) argument should be a link
identifier, not a string of your choosing.



Cheers
-- 
David Robley

MS-DOS: celebrating ten years of obsolescence
Today is Sweetmorn, the 29th day of The Aftermath in the YOLD 3175. 


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



Re: [PHP] Re: Converting tables into forms

2009-11-02 Thread David Robley
Bastien Koert wrote:

> On Wed, Oct 28, 2009 at 8:53 AM, Bob McConnell  wrote:
>> From: Ashley Sheridan
>>
>>> On Tue, 2009-10-27 at 21:07 -0700, ben...@gmail.com wrote:
>>>
>>>> I am trying to take MySQL tables and use the table structure to
>> create
>>>> HTML/PHP forms in as few steps as possible for further development. I
>>>> have a project that has hundreds of tables and requires hundreds of
>>>> forms to be created and don't want to do so field by field by hand.
>>>>
>>>> On Tuesday, October 27, 2009, Allen McCabe 
>> wrote:
>>>> > Please explain with much greater detail.
>>>> >
>>>> > On Tue, Oct 27, 2009 at 6:12 PM, ben...@gmail.com
>>  wrote:
>>>> > Does anyone have a quick way of converting tables into forms?
>>>> >
>>>
>>> There is still the issue of exactly what db fields will translate
>> into.
>>> Where is a good time to use radio buttons instead of select lists, or
>>> checkboxes instead of select-multiple lists? What about text fields in
>>> the db? Should they be textareas or text inputs? Do all the db fields
>>> need to be translated as visible fields? Should you hide ID fields?
>>>
>>> There are so many questions, that you might be better off rolling your
>>> own, as a one-size-fits-all will not always work for everyone.
>>
>> I have a feeling in the pit of my stomach that your project is going to
>> create a support nightmare. Either you will have to hand code forms for
>> each table, or find a framework that dynamically creates the forms from
>> schema and create suitable maps for each form. In either case, it will
>> take weeks or months to complete and be nearly impossible to maintain
>> when tables are changed or added.
>>
>> If your solution requires you to create hundreds of forms, which could
>> take months to code, you need to take another look at the problem. I
>> don't believe you have thought it through very well.
>>
>> Bob McConnell
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
> symfony might be another option, but it will take you some time to
> sort out the yaml config.
> 
> 
Recent versions of symfony (at least >= 1.0) can create the schema.yml from
an existing database structure or a .sql file.



Cheers
-- 
David Robley

This building is so high, the elevator shows movies.
Today is Sweetmorn, the 14th day of The Aftermath in the YOLD 3175. 


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



Re: [PHP] windows 5.2.10 PHP not working with phpinfo

2009-08-31 Thread David Robley
hack988 hack988 wrote:

> Please set log_error=on,error_reporting=E_ALL,error_log=syslog in
> php.ini and then,see error detail in syslog.
> 
> 2009/8/31 Fred Silsbee :
>> I got 5.3 working but found out there was no php_mssql.dll for it.
>> Somebody (who didn;t know) said I had to return to 5.2.8 but I found no
>> 5.2.8 so I am trying 5.2.10
>> _problem: under IE8:
>> http://72.47.28.128:8080/phpinfo.php
>> with:
>> > phpinfo();
>> ?>
>>
>> I get :
>> The website cannot display the page
>> HTTP 500
>> Most likely causes:
>> ?The website is under maintenance.
>> ?The website has a programming error.
>> ___
>>
>> I installed :
>> php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext
>> AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32
>>
>> I installed FastCGI 1.5 !
>>
>> In php.ini I put :
>> 
>>
>> cgi.force_redirect = 0                  // for CGI
>>
>> extension_dir =  "C:\PHP\ext"
>>
>> commented out
>> ;doc_root = "C:\inetpub\wwwroot" // for IIS/PWS
>> leaving
>> doc_root =
>> _
>> IIS 5.1 properties->configuration I added .php  C:\PHP\php5ts.dll
>> GET,HEAD,POST,DEBUG
>>
>> Maybe php-win.exe
>> _
>>
>> I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\
>>
>> I created an environment variable (and rebooted) PHPRC =
>> C:\PHP;C:\PHP\ext
>>
>>
>> I never found any statement of the necessity of requiring CGI
>>
>> The instructions ramble around
>>

Hmm, if there is a 500 error there should be entries in the apache error log
which probably give a pointer to the problem.



Cheers
-- 
David Robley

"I'll pay off that customs official," said Tom dutifully.
Today is Pungenday, the 24th day of Bureaucracy in the YOLD 3175. 


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



Re: [PHP] Invoking functions stored in a separate directory?

2009-08-22 Thread David Robley
Clancy wrote:

> $ok = include (HOST_PATH.'/Halla.php');

Because you are assigning the result of the include to a variable. Try 

include (HOST_PATH.'/Halla.php');

and it will work as you expect. And similarly for 

define ('HOST_PATH','../Engine');


Cheers
-- 
David Robley

Dynamic linking error: Your mistake is now everywhere.
Today is Prickle-Prickle, the 15th day of Bureaucracy in the YOLD 3175. 


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



[PHP] Re: Rounding down?

2009-08-22 Thread David Robley
Ron Piggott wrote:

> Is there a way to round down to the nearest 50?
> 
> Example: Any number between 400 and 449 I would 400 to be displayed; 450
> to 499 would be 450; 500 to 549 would be 500, etc?
> 
> The original number of subscribers is from a mySQL query and changes each
> day.  I am trying to present a factual statement: "There have been over
> ### subscribers in 2009" type of scenereo.
> 
> Ron

Modulus - http://php.net/manual/en/language.operators.arithmetic.php



Cheers
-- 
David Robley

Oxymoron: Split level.
Today is Prickle-Prickle, the 15th day of Bureaucracy in the YOLD 3175. 


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



Re: [PHP] open source forum

2009-07-26 Thread David Robley
mrfroasty wrote:

> Hello,
> 
> I need some advice in picking a PHP forum for a group of people, I know
> there are couple of them but could somebody from here give advice on
> which one to choose.
> 
> ***My strongest requirements I need localization support, as that
> software might need to be translated into a language other than English.
> ***Also the software should be a little bit easy to use, interms of
> administration as the clients computer literacy isnt so high enough.
> ***LAMP based software please :-)
> ***ofcourse open source software... :-P
> 
> I know this phpBB, but what are other options?I have never played with a
> forum before.
> 
> 
> Thanks for the input...
> 
> GR
> mrfroasty
> 

Have a look at the assortment of forums (fora?) at
http://php.opensourcecms.com/scripts/show.php?catid=5&cat=Forums

They have sandbox sites that you can play with and get a feel for the
application. 


Cheers
-- 
David Robley

After a number of decimal places, nobody gives a damn.
Today is Boomtime, the 61st day of Confusion in the YOLD 3175. 


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



Re: [PHP] Re: A form and an array

2009-07-23 Thread David Robley
Jason Carson wrote:

>> Jason Carson wrote:
>>
>>> Hello everyone,
>>>
>>> Lets say I have a file called form.php with the following form on it
>>> that
>>> redirects to index.php when submitted. I would like to take the values
>>> of
>>> the text fields in the form and put them into an array, then be able to
>>> display the values in that array on index.php Does anyone know how I
>>> would
>>> do that?
>>>
>>> Here is my form...
>>>
>>> 
>>> 
>>>   
>>> Option1
>>> 
>>>   
>>>   
>>> Option2
>>> 
>>>   
>>>   
>>> 
>>> 
>>>   
>>> 
>>> 
>>
>> You'll find they are already in an array which you can access as
>> $_POST['option'] - from there foreach() should be the next step.
>>
>>
>> Cheers
>> --
>> David Robley
>>
>> Polls show that 9 out of 6 schizophrenics agree.
>> Today is Setting Orange, the 59th day of Confusion in the YOLD 3175.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> I am new to programming. How would I use foreach()to display the entries
> in the array?

You could read TFM which has an example -
http://php.net/manual/en/control-structures.foreach.php


Cheers
-- 
David Robley

Why are you wasting time reading taglines?
Today is Setting Orange, the 59th day of Confusion in the YOLD 3175. 


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



[PHP] Re: A form and an array

2009-07-23 Thread David Robley
Jason Carson wrote:

> Hello everyone,
> 
> Lets say I have a file called form.php with the following form on it that
> redirects to index.php when submitted. I would like to take the values of
> the text fields in the form and put them into an array, then be able to
> display the values in that array on index.php Does anyone know how I would
> do that?
> 
> Here is my form...
> 
> 
> 
>   
> Option1
> 
>   
>   
> Option2
> 
>   
>   
> 
> 
>   
> 
> 

You'll find they are already in an array which you can access as
$_POST['option'] - from there foreach() should be the next step.


Cheers
-- 
David Robley

Polls show that 9 out of 6 schizophrenics agree.
Today is Setting Orange, the 59th day of Confusion in the YOLD 3175. 


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



[PHP] Re: Sub Menu System?

2009-07-17 Thread David Robley
David Stoltz wrote:

> Folks,
> 
> I'm developing a rather large site in PHP. The main horizontal nav bar
> never changes, no matter how deep you are in the site. However, on the
> left side is a vertical "sub-menu" system. This menu is proving to be a
> real pain to program. I have it limited the menu system to 3 levels:
> 
> MAIN:
>  |___Secondary pages
>|___Tertiary pages
> 
> For each level, and each folder, I have a file called subnav.php, which
> contains the links for that page. It has its own code to determine the
> page it's on, and highlight the appropriate menu item.
> 
> The problem is when I need to move pages, or add pages, it's proving to
> be a REAL PAIN to maintain this type of structure.
> 
> Does anyone know of any off-the-shelf product that can create/maintain a
> sub-menu system like this?
> 
> I don't mind starting over at this point, but I'm hoping there is
> something I can just purchase, so I can concentrate on the rest of the
> sitehopefully the menu system would support PHP and ASP.
> 
> Thanks for any information!

I know your pain :-) I can't point you to a bolt on solution, but what you
probably want is a tree structure of some sort. Have a read of
http://www.sitepoint.com/print/hierarchical-data-database/ for the
concepts; scroll down to Modified Preorder Tree Traversal.

There seem to be a few nested set classes out there to manage this sort of
structure, e.g. http://www.edutech.ch/contribution/nstrees/index.php or
search on "nested trees".


Cheers
-- 
David Robley

A mind is a terrible thing to ... er ... h?
Today is Pungenday, the 52nd day of Confusion in the YOLD 3175. 


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



Re: [PHP] When did you start here? Was - RFC/Survey for Our Newer Folks

2009-07-13 Thread David Robley
Ashley Sheridan wrote:

> On Sunday 12 July 2009 15:54:27 Daniel Brown wrote:
>> On Sun, Jul 12, 2009 at 09:45, Ashley Sheridan
> wrote:
>> > Yeah, I'll put it down to old age and not my reading laziness!
>>
>> You're just lucky Tedd got to you first, Ash.  I was going to
>> fairy-slap you for messing up the rotation!  You've been here, what,
>> about a year now?  ;-P
>>
>> And here's hoping there will be more to come.
> 
> About a year and a half now I think.
> 

I just have to take this slightly(?) off topic, as that is expected
behaviour here :-).

I thought I had been around for about five years or so, but a quick search
on marc turned up contributions from me as far back as September 2000

http://marc.info/?l=php-general&m=96822528212538&w=2

On reflection, I suspect that the marc archives may not go back as far as
when I first joined what was then a mailinglist only (I think!). Although I
find contributions to other mailing lists back as far as 1995. $deity, I
must be getting old.



Cheers
-- 
David Robley

I have enough trouble single-tasking!
Today is Prickle-Prickle, the 48th day of Confusion in the YOLD 3175. 


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



Re: [PHP] Re: Call to object function, want to PHP interpret returned string

2009-07-06 Thread David Robley
John Allsopp wrote:

> David Robley wrote:
>> John Allsopp wrote:
>>
>>   
>>> Hi
>>>
>>> At the top of a webpage I have:
>>>
>>> >> include_once("furniture.php");
>>> $myFurniture = new furniture();
>>> echo $myFurniture->getTop("my company title");
>>> ?>
>>>
>>> to deliver the first lines of HTML, everything in HEAD and the first
>>> bits of page furniture (menu, etc).
>>>
>>> In the furniture object in getTop(), I want to return a string that
>>> includes the CSS file that I call with an include_once. But the
>>> include_once isn't interpreted by PHP, it's just outputted. So from:
>>>
>>> $toReturn = ">> Transitional//EN' 
>>> >> include_once('styles3.txt');
>>> ?>
>>> ...";
>>>
>>> return $toReturn;
>>>
>>> I get
>>>
>>> >> include_once('styles3.txt');
>>> ?>
>>>
>>> in my code.
>>>
>>> Do I really have to break up my echo $myFurniture->getTop("my company
>>> title"); call to getTopTop, then include my CSS, then call getTopBottom,
>>> or can I get PHP to interpret that text that came back?
>>>
>>> PS. I may be stupid, this may be obvious .. I don't program PHP every
>>> day
>>>
>>> Thanks in advance for your help :-)
>>>
>>> Cheers
>>> J
>>> 
>>
>> First guess is that your page doing the including doesn't have a filename
>> with a .php extension, and your server is set to only parse php in files
>> with a .php extension.
>>
>>
>>
>> Cheers
>>   
> Ah, thanks. It's a PHP object returning a string, I guess the PHP
> interpreter won't see that.
> 
> So, maybe my object has to write a file that my calling file then
> includes after the object function call. Doesn't sound too elegant, but
> is that how it's gotta be?
> 
> Cheers
> J
I think I misunderstood your explanation :-) Can you show the actual content
of furniture.php? I wonder if there are missing  tags??



Cheers
-- 
David Robley

And it's only ones and zeros.
Today is Boomtime, the 41st day of Confusion in the YOLD 3175. 


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



[PHP] Re: Call to object function, want to PHP interpret returned string

2009-07-06 Thread David Robley
John Allsopp wrote:

> Hi
> 
> At the top of a webpage I have:
> 
>  include_once("furniture.php");
> $myFurniture = new furniture();
> echo $myFurniture->getTop("my company title");
> ?>
> 
> to deliver the first lines of HTML, everything in HEAD and the first
> bits of page furniture (menu, etc).
> 
> In the furniture object in getTop(), I want to return a string that
> includes the CSS file that I call with an include_once. But the
> include_once isn't interpreted by PHP, it's just outputted. So from:
> 
> $toReturn = " Transitional//EN' 
>  include_once('styles3.txt');
> ?>
> ...";
> 
> return $toReturn;
> 
> I get
> 
>  include_once('styles3.txt');
> ?>
> 
> in my code.
> 
> Do I really have to break up my echo $myFurniture->getTop("my company
> title"); call to getTopTop, then include my CSS, then call getTopBottom,
> or can I get PHP to interpret that text that came back?
> 
> PS. I may be stupid, this may be obvious .. I don't program PHP every day
> 
> Thanks in advance for your help :-)
> 
> Cheers
> J

First guess is that your page doing the including doesn't have a filename
with a .php extension, and your server is set to only parse php in files
with a .php extension.



Cheers
-- 
David Robley

If you saw a heat wave, would you wave back?
Today is Boomtime, the 41st day of Confusion in the YOLD 3175. 


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



Re: [PHP] supplied argument errors

2009-06-24 Thread David Robley
PJ wrote:

> Lex Braun wrote:
>>
>>
>> On Tue, Jun 23, 2009 at 4:10 PM, PJ > <mailto:af.gour...@videotron.ca>> wrote:
>>
>> I think there is something I do not understand in the manual about
>> mysql_fetch_assoc(), mysql_affected_rows()
>> The code works, but I get these annoying messages.
>> snippet:
>>
>> 
>> What are the warnings?
> 1 .supplied argument is not a valid MySQL result resource
> 2. supplied argument is not a valid MySQL-link resource
> 
> snippet:
> $result = mysql_query($sql, $db); // this is following an UPDATE
>   $row = mysql_fetch_assoc($result); // warning... 1.
>   if (mysql_affected_rows($result) !== -1) //warning...2.
> print_r($result); // returns 1
> 
> another:
>  $sql = "DELETE FROM book_categories WHERE bookID = $bid";
> $result = mysql_query($sql, $db); // warning...1.
>   $row = mysql_fetch_assoc($result); // warning...1.
> if (mysql_num_rows($result) !== 0) {
> the last:
>   $result = mysql_query($sql,$db); // following an INSERT
> if (mysql_affected_rows($result) == -1) {  // warning2.
> 
> 
> 

Oh for $deity's sake, haven't you yet learned to a) echo your query and b)
use mysql_error() as aids to debugging errors with mysql ???



Cheers
-- 
David Robley

Imagery is All In The Mind.
Today is Setting Orange, the 29th day of Confusion in the YOLD 3175. 


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



Re: [PHP] Re: Dynamic Titles

2009-06-12 Thread David Robley
On Sat, 13 Jun 2009, you wrote:
> Well, im no longer getting any errors now, but its still not working.
> You can see it here: http://www.newtuts.com. When you go there, it
> should say "Photoshop tutorials, Flash tutorials . . .". This should be
> the default page. When you click on "Support", the title should become
> "Newtuts Help". But instead, it just says "echo $title". Any more
> ideas?
>
>
>
> Austin Caudill
>
> --- On Fri, 6/12/09, David Robley  wrote:
>
>
> From: David Robley 
> Subject: [PHP] Re: Dynamic Titles
> To: php-general@lists.php.net
> Date: Friday, June 12, 2009, 3:34 AM
>
> Austin Caudill wrote:
> > Hello, im trying to make the CMS system im using more SEO friendly by
> > giving each page it's own title. Right now, the system assigns all
> > pages the same general title. I would like to use PHP to discertain
> > which page is being viewed and in turn, which title should be used.
> >
> > I have put in the title tags the variable "$title". As for the PHP im
> > using, I scripted the following:
> >
> > $url = "http://'.$_SERVER['SERVER_NAME']''.$_SERVER['REQUEST_URI']'";
> > switch ( $url )
> > {
> > default:
> > $title = "Photoshop tutorials, Flash tutorials, and more! Newtuts
> > Tutorial Search"; break;
> >
> > case "$config[HTTP_SERVER]help.php" :
> > $title = "Newtuts Help";
> > break;
> > }
> >
> > Right now, im getting this error:
> > Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
> > expecting T_STRING or T_VARIABLE or T_NUM_STRING in
> > /home/a7201901/public_html/includes/classes/tutorial.php on line 803
> >
> > Can someone please help me with this?
> >
> >
> >
> > Thanks!
>
> I'm guessing that line 803 is
>
> $url = "http://'.$_SERVER['SERVER_NAME']''.$_SERVER['REQUEST_URI']'";
>
> which is full of mismatched quotes :-) Try any of
>
> $url = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
> $url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
> $url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
>
> Cheers

Forwarding to the list for the benefit of others.

As you haven't shown the code that is supposed to produce the title, we're 
back to guessing again. Looking at the source of your Support page, I see 
the the Title tags are empty.

If you are seeing echo $title is it possible you forgot to use php tags 
around the php code?




Cheers
-- 
David Robley

"I haven't had any tooth decay yet," said Tom precariously.
Today is Prickle-Prickle, the 18th day of Confusion in the YOLD 3175. 

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



[PHP] Re: Dynamic Titles

2009-06-12 Thread David Robley
Austin Caudill wrote:

> Hello, im trying to make the CMS system im using more SEO friendly by
> giving each page it's own title. Right now, the system assigns all pages
> the same general title. I would like to use PHP to discertain which page
> is being viewed and in turn, which title should be used.
> 
> I have put in the title tags the variable "$title". As for the PHP im
> using, I scripted the following:
> 
> $url = "http://'.$_SERVER['SERVER_NAME']''.$_SERVER['REQUEST_URI']'";
> switch ( $url )
> {
> default:
> $title = "Photoshop tutorials, Flash tutorials, and more! Newtuts Tutorial
> Search"; break;
> 
> case "$config[HTTP_SERVER]help.php" :
> $title = "Newtuts Help";
> break;
> }
> 
> Right now, im getting this error:
> Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
> T_STRING or T_VARIABLE or T_NUM_STRING in
> /home/a7201901/public_html/includes/classes/tutorial.php on line 803
> 
> Can someone please help me with this?
> 
> 
> 
> Thanks!
I'm guessing that line 803 is

$url = "http://'.$_SERVER['SERVER_NAME']''.$_SERVER['REQUEST_URI']'";

which is full of mismatched quotes :-) Try any of

$url = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
$url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$url = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

Cheers
-- 
David Robley

Life is only as long as you live it.
Today is Pungenday, the 17th day of Confusion in the YOLD 3175. 


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



Re: [PHP] php dev environment

2009-05-25 Thread David Robley
Eddie Drapkin wrote:

> -- Forwarded message --
> From: Eddie Drapkin 
> Date: Mon, May 25, 2009 at 3:24 AM
> Subject: Re: [PHP] php dev environment
> To: Lester Caine 
> 
> 
> 
> Vim? Vi? PFT
> 
> If you're gonna CLI, CLI *like a man* and use emacs!

I'm sure someone once said that emacs would make a great operating system,
if only it had a decent editor :-)



Cheers
-- 
David Robley

I am Homer of Borg. Prepare to be... h donuts...
Today is Setting Orange, the 72nd day of Discord in the YOLD 3175. 


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



[PHP] Re: Display Image

2009-05-25 Thread David Robley
Vernon St . Croix wrote:

> 
> I am trying to send images to my browser using the header function, but
> keep on getting 'No image Available'.
> 
> Can someone please help!!

Some code would help diagnosis. Also, try removing the header and calling
the script; if there is an error in your image script there should be an
error message.


Cheers
-- 
David Robley

Oxymoron: Rap Music.
Today is Setting Orange, the 72nd day of Discord in the YOLD 3175. 


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



Re: [PHP] Strange charecters

2009-03-05 Thread David Robley
Ashley Sheridan wrote:

> On Wed, 2009-03-04 at 08:02 -0500, Bastien Koert wrote:
>> On Wed, Mar 4, 2009 at 2:10 AM, Paul Scott  wrote:
>> 
>> > On Wed, 2009-03-04 at 10:09 +0530, Chetan Rane wrote:
>> > > I am using ob_start() in my application. However I am getting this
>> > > error about headers already sent.
>> > >
>> >
>> > _Any_ output will set that error off. Check for Notices, Warnings,
>> > echo's, prints and var_dumps in your code.
>> >
>> > -- Paul
>> >
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>> check for a blank space above the > 
> Or a trailing space after the ?> of any include files.

Or a byte order mark at the beginning of a file saved as unicode




Cheers
-- 
David Robley

Some things have got to be believed to be seen.
Today is Prickle-Prickle, the 64th day of Chaos in the YOLD 3175. 


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



[PHP] Re: verify text in field

2009-02-26 Thread David Robley
PJ wrote:

> Is there a shorter way of determining if a field contains text?
> This works but I wonder if I can K.I.S.S. it? I really only need to know
> if there is or is not a field containing the text specified. I don't
> need to see it.
>   
>   // Request the text
>   $text = "Joe of Egypt";
>   $sql = "SELECT title FROM book WHERE title LIKE '$text'";
>   $result = mysql_query($sql);
>   if (!$result) {
> echo("Error performing query: " .
>  mysql_error() . "");
> exit();
>   }
> 
>   // Display the text
>   while ( $row = mysql_fetch_array($result) ) {
> echo("" . $row["title"] . "");
>   }
>   if ($row["title"] == "")
>   echo ("Empty!")
> 
> ?>
> 

In addition to other answers, don't forget to escape the string you are
passing to the query with mysql_real_escape_string(), otherwise your query
will have problems with some characters e.g. apostrophe.


Cheers
-- 
David Robley

"I refuse to make an agenda," Tom said listlessly.
Today is Pungenday, the 58th day of Chaos in the YOLD 3175. 


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



Re: [PHP] Re: Simple Search Logic Issue...

2009-02-17 Thread David Robley
Bastien Koert wrote:

> [snip]
>>
>>
>>
>> For example LIKE 'c' will only match a field that contains just 'c'
>>
>> LIKE '%c' will match a field starting with 'c' and containing any number
>> of characters
>>
>> [/snip]
>> Cheers
>> --
>> David Robley
>>
>> Make like a banana and split.
>> Today is Sweetmorn, the 46th day of Chaos in the YOLD 3175.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> hate to do this at a late date, but %c will match anything ending in
> 'c'...'c%' will match anything starting in 'c'
> 
Um, of course that is exactly what I told my fingers to type, but somehow
they didn't listen to me :-)



Cheers
-- 
David Robley

... "I will not raise taxes on the middle class." -- Bill
Today is Pungenday, the 48th day of Chaos in the YOLD 3175. 


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



[PHP] Re: Simple Search Logic Issue...

2009-02-15 Thread David Robley
revDAVE wrote:

> Newbie question...
> 
> 
> I have a search page with multi lines of search criteria:
> 
> Name
> Topic
> Message
> Etc...
> 
> I'm hoping to get results based on what criteria I type - but I'm not
> getting what I expect. I think it's just getting results where in addition
> to getting search criteria I type - ALSO none of the search fields can be
> blank (not what I hoped) ...
> 
> Like I type just 'c' in the name field and it shows 3 records (other
> search fields filled up) ... But I have many more records with name
> containing 'c'
> 
> Goal: to search for what I type in whatever search fields and not worry
> about whether others are blank or not - like:
> 
> Name contains 'c'
> 
> Charles
> Chuck
> Chuck
> Chas
> 
> Or
> 
> Name contains 'c' and topic contains 'test1'
> 
> Maybe just charles fits this criteria
> 
> --
> 
> 
> I made a simple results page,
> 
> ... More code here ... ( DW CS3 )
> 
> $name_list1 = "-1";
> if (isset($_GET['Name'])) {
>   $name_list1 = $_GET['Name'];
> }
> $top_list1 = "-1";
> if (isset($_GET['Topic'])) {
>   $top_list1 = $_GET['Topic'];
> }
> $mess_list1 = "-1";
> if (isset($_GET['Message'])) {
>   $mess_list1 = $_GET['Message'];
> }
> mysql_select_db($database_test1, $test1);
> $query_list1 = sprintf("SELECT * FROM mytable WHERE Name LIKE %s and
> Message LIKE %s and Topic LIKE %s ORDER BY mytable.id desc",
> GetSQLValueString("%" . $name_list1 . "%", "text"),GetSQLValueString("%" .
> $mess_list1 . "%", "text"),GetSQLValueString("%" . $top_list1 . "%",
> "text"));
> 

You do understand how LIKE works? You need to use wildcard characters if you
want to match other than the exact string you pass to it.

For example LIKE 'c' will only match a field that contains just 'c'

LIKE '%c' will match a field starting with 'c' and containing any number of
characters

LIKE '%c%' will match a field containing 'c' anywhere

If you are using that syntax, I'd suggest echoing your query to make sure
that it is as it should be; I'm wondering if you are actually enclosing
string values in single quotes in your query?

As for multiple selection criteria, you need to test whether the passed in
value is set or not, and only include set values in the query.

OT: sprintf syntax is so hard to read :-)

Cheers
-- 
David Robley

Make like a banana and split.
Today is Sweetmorn, the 46th day of Chaos in the YOLD 3175. 


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



[PHP] Re: More questions about SESSION use

2009-01-31 Thread David Robley
Terion Miller wrote:

> So now I have SESSIONs set: user, AdminID, AdminLogin
> 
> but I'm trying to use them without showing them in links...currently the
> pages only load if I make the links like this:
> 
>  target="mainFrame">Home
> 
> I thought the whole purpose of having/using Sessions is to not have to
> pass variables in url's, but if I remove the session in the link above
> when I click to it, It logs me out, even though it IS holding the SESSION
> (which I checked by revealing my variables) so I guess I am confused about
> this bit of code, I think its saying if the SESSION is there great if not
> logout... but even when I expose the variables and see that the session is
> passing from page to page it keeps sending me to the logout page:
> 
> This is how it was originally written:
> if (empty($_SESSION['AdminLogin']) || $_SESSION['AdminLogin'] !=  true){
> header ("Location: LogOut.php");
> $_SESSION['user']=$UserName;
> $_SESSION['AdminID']=$AdminID; <--*I added this one originally the
> script only used 'user' and 'AdminLogin'* but passed them in urls
> }
> 
> 
> Is the above part not needed since the Session is already active? Should I
> be not using the header part (honestly I havent read up on that chapter
> yet)

Are you using session_start()? 


Cheers
-- 
David Robley

The Hubbell works fine; all that stuff IS blurry!
Today is Boomtime, the 32nd day of Chaos in the YOLD 3175. 


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



[PHP] Re: HTTP Error 500 - IsapiModule

2008-12-19 Thread David Robley
Gary Maddock-Greene wrote:

> Hi, Don't know if this is the right group but I am having real problems
> trying to connect to my MySQL db with php. I am trying to create a search
> form. I can connect and display in my browser a simple call to a db record
> but when I try to execute my search script I get a 500 Internal Server
> error: IsapiModule / ExecuterequestHandler. I'm stumped! Any help please
> or pointers. Thanks Gary

The first thing when you get a 500 error, which is a server error not php,
is to check the server error log.


Cheers
-- 
David Robley

The best defense against logic is stupidity.
Today is Pungenday, the 61st day of The Aftermath in the YOLD 3174. 


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



RE: [PHP] checking local file size

2008-12-17 Thread David Robley
John Pillion wrote:

>> > I already downloaded that, thanks.  How do I apply it is my question.
>> > There's no documentation for the installation of it, that I see
>> 
>> 'Course it is :)
>> 
>> http://www.php.net/manual/en/install.pecl.php
>> 
>> Linked from here: http://pecl.php.net/doc/index.php
>> 
> 
> I tried installing it like the documentation said... but I got the
> following errors. I contacted the hosting service (dreamhost) and they
> said they don't
> provide support for pecl, though they do support perl.  Anyone?
> 
> --
> 
> $ pecl install uploadprogress
> 
> Failed to download pecl/uploadprogress within preferred state "stable",
> latest release is version 0.9.1, stability "beta", use
> "channel://pecl.php.net/uploadprogress-0.9.1" to install Cannot initialize
> 'uploadprogress', invalid or missing package file Package "uploadprogress"
> is not valid install failed
> 
> 
> 
> $ pecl install uploadprogress-beta
> 
> Cannot install, php_dir for channel "pecl.php.net" is not writeable by the
> current user
> .com/

Um, sudo? Or be root when you install as the PEAR/PECL structure is usually
owned by root.


Cheers
-- 
David Robley

"This is a sick bird," said Tom illegally.
Today is Sweetmorn, the 59th day of The Aftermath in the YOLD 3174. 


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



Re: [PHP] Good PHP book?

2008-12-17 Thread David Robley
Daniel Brown wrote:

> On Tue, Dec 16, 2008 at 17:11, Jay Moore  wrote:
>>
>> Ok.  Let me back them up to these reel-to-reel tapes quick, just in case.
> 
> Just be careful that you don't get the Michaelangelo or Friday The
> 13th viruses especially if you're converting over on a C-64 1541
> drive.
> 

What? They were cross platform? I recall copping Michaelangelo on Win 3.n
from some commercial software floppy. Not nice - it cleaned out the FAT or
something equally nasty. A reinstall was called for :-)


Cheers
-- 
David Robley

"I already showed you how to do that," Tom said tautly.
Today is Sweetmorn, the 59th day of The Aftermath in the YOLD 3174. 


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



Re: [PHP] Good PHP book?

2008-12-17 Thread David Robley
Lupus Michaelis wrote:

> Daniel Brown a écrit :
> 
>> You'd be surprised.  The "For Dummies" series is one of the
>> best-selling franchises in mainstream publishing history.
> 
>Best-selling are not a proof of quality.
> 

Viz: Windows Version xx.x


Cheers
-- 
David Robley

Windows: XT emulator for an AT.
Today is Sweetmorn, the 59th day of The Aftermath in the YOLD 3174. 


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



[PHP] Re: Days until Easter and Christmas

2008-11-15 Thread David Robley
Ron Piggott wrote:

> Is there a way to modify this code so it will always be the *next*
> Christmas and Easter?
> 
>  
> $todays_date_seasonal_format = DATE("Y-m-d");
> $next_Christmas = DATE("Y") . "-12-25";
> $next_Easter = date("D d M Y", strtotime("2009-03-21
> +".easter_days(2009)." days"));
> $days_until_Christmas = ( strtotime($next_Christmas) -
> strtotime($todays_date_seasonal_format) ) / 86400;
> $days_until_Easter = round(( strtotime($next_Easter) -
> strtotime($todays_date_seasonal_format) ) / 86400);
> 
> echo $days_until_Christmas . "";
> echo $days_until_Easter . "";

Have you tried incrementing the year value by one when you define
$next_[holiday]


Cheers
-- 
David Robley

He who always plows a straight furrow is in a rut.
Today is Setting Orange, the 28th day of The Aftermath in the YOLD 3174. 


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



[PHP] Re: Missing DLLs

2008-11-13 Thread David Robley
[EMAIL PROTECTED] wrote:

> 
> So, that error message about a missing DLL, when it's really a "sub" DLL
> that is missing...
> 
> Is that something in PHP source that could be fixed to specify WHICH dll
> is really missing?
> 
> Or is that just Windows being stupid?
> 
> Mr. Spock has calculated that a quick hack change to that error message to
> be more specific would save approximately 3,141.59 man-hours per week...
> 
> :-)
> 
> I'm happy to put it in bugs.php.net as a feature request, if it's actually
> IN php, but don't want to waste the resources to mark it as junk if
> there's no way PHP could do that.
> 
> Richard "someday I'll re-learn C and download PHP source and start
> hacking" Lynch

IIRC there is a little windows app called dependcywalker which you can point
at an application and it will tell you what libraries are required to run
that application. Google will find it for you.


Cheers
-- 
David Robley

We now return you to your regularly scheduled flame-throwing
Today is Boomtime, the 25th day of The Aftermath in the YOLD 3174. 


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



  1   2   3   4   5   6   7   8   9   10   >