Re: [PHP] ldap_add - Server is unwilling to peform

2011-01-26 Thread a...@ashleysheridan.co.uk
You could add a line in to your code:

include ldap-blue-pill;

That should fix any performance issues ;)

(note, I did try posting earlier with a much funnier reply, but the email was 
rejected because of a certain 'v' word!) 

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: CHARLES HUNT ch5...@yahoo.com
Date: Wed, Jan 26, 2011 15:53
Subject: [PHP] ldap_add - Server is unwilling to peform
To: Daniel Brown danbr...@php.net
Cc: php-general@lists.php.net


Win 2000 Active Directory.

I'll give ldap_mod_add a shot.


- Original Message 
From: Daniel Brown danbr...@php.net
To: CHARLES HUNT ch5...@yahoo.com
Cc: php-general@lists.php.net
Sent: Wed, January 26, 2011 9:39:32 AM
Subject: Re: [PHP] ldap_add - Server is unwilling to peform

On Wed, Jan 26, 2011 at 10:17, CHARLES HUNT ch5...@yahoo.com wrote:
 Hello-
 I am trying to add create a user account with the ldap_add function.  However 
I
 get the error below when it is invoked.  Does anyone have ideas what may be
 causing this error?  What I can look into?  Anything would be helpful.

 Warning: ldap_add() [function.ldap-add]: Add: Server is unwilling to perform
 in C:\xampp\htdocs\Infrastructure\al_ldap.php on line 354

What LDAP server are you using (Active Directory, openLDAP,
iPlanet, eDirectory, et cetera)?  You may want to try swapping out
ldap_add() for ldap_mod_add().

http://php.net/ldap_mod_add


-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/


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



Re: [PHP] Installing PEAR

2011-01-25 Thread a...@ashleysheridan.co.uk
(sorry for top post)

As he mentioned using lynx ( and I'm assuming the OS rather than the browser 
here, as I'm not aware of the browser having those sorts of capabilities) then 
could it be that all the pear packages don't exist?

Mostly, pear packages can just be copied into your app directories or in an 
include path that apache is aware of and things will just work, so that might 
be a viable solution if the repositories don't work out.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Shawn McKenzie nos...@mckenzies.net
Date: Tue, Jan 25, 2011 18:44
Subject: [PHP] Installing PEAR
To: Nilesh Govindarajan nil...@itech7.com
Cc: php-general@lists.php.net


On 01/25/2011 11:25 AM, Nilesh Govindarajan wrote:
 On 01/25/2011 10:32 PM, Ethan Rosenberg wrote:
 Dear List --

 How do install PEAR on Linux?  I installed lynx and as root, I ran the
 command lynx -source http://pear.php.net/go-pear | php.  It seemed to
 install, but the command pear did not work.  From the root directory I
 ran the command find . -name pear.  There was no file found.  I also
 tried Pear, with the same results.

 Help and advice, please.

 Ethan

 MySQL 5.1  PHP 5.3.3-6  Linux [Debian (sid)]


 
 If you are using php from the repositories, there must be a pear package
 as well in the repos. Check for them.
 

Yes, I'm on Ubuntu and just used 'apt-get install php-pear'.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: RES: [PHP] email address syntax checker

2011-01-21 Thread a...@ashleysheridan.co.uk
That won't accept dozens of different types of email addresses. It won't even 
match some value domains.

Valid email addresses can contain virtually any character in the local part 
(although in the main they will require being inside quotation marks), and the 
@ symbol is included in that!

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Alejandro Michelin Salomon amichel...@hotmail.com
Date: Fri, Jan 21, 2011 12:14
Subject: RES: [PHP] email address syntax checker
To: 'Donovan Brooke' li...@euca.us
Cc: php-general@lists.php.net



Donovan:

Try this

function EmailCheck ( $sEmail )
 {
 
$regexp=/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z
]{2,}$/i;

 if ( !preg_match($regexp, $sEmail) )
return false;

 return true;
 }

Alejandro M.S.
-Mensagem original-
De: Donovan Brooke [mailto:li...@euca.us] 
Enviada em: quinta-feira, 20 de janeiro de 2011 01:14
Para: php-general@lists.php.net
Assunto: [PHP] email address syntax checker

Hi Guys,

I'm waddling my way through database interaction and thought someone on 
the list may already have a simple email checker that they'd like to 
share...

you know, looking for the @ char and dots etc..

I did a quick search of the archives and found a couple elaborate 
things.. but
I'm looking for something simple. This job will have trusted users and
the checker is more to help them catch mistakes when registering.

Thanks!,
Donovan


-- 
D Brooke

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



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



Re: [PHP] [PHP]: permission problem www-data

2011-01-18 Thread a...@ashleysheridan.co.uk
you could use the chown method in php, which should do what you need.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Moses jam...@gmail.com
Date: Tue, Jan 18, 2011 09:44
Subject: [PHP] [PHP]: permission problem www-data
To: php-general@lists.php.net

Hi Everyone,

I am creating a file in PHP script which takes a value from a form and
writes it
to a file. However, i don't have the mode permission for the file instead it
is owned
by www-data.What can i do to ensure that the file is owned by me.


drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
-rw-r--r-- 1 www-data www-data   40 2011-01-17 23:39 32238.hydro

Thanks.


Re: [PHP] [PHP]: permission problem www-data

2011-01-18 Thread a...@ashleysheridan.co.uk
Because the web server is what runs php as a module, and the web server has its 
own user for security reasons. You could try chmod but that is generally a last 
resort.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Moses jam...@gmail.com
Date: Tue, Jan 18, 2011 10:17
Subject: [PHP] [PHP]: permission problem www-data
To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk
Cc: php-general@lists.php.net




Re: [PHP] How to get cpu consumption of a php script

2011-01-17 Thread a...@ashleysheridan.co.uk
I can't think of anything except using top or ps. If you can't guarantee what 
process runs what individual script, are you able to just track them all 
globally, and check for differences as you start and stop scripts. Perhaps run 
certain scripts under different users which should give them their own pid (i 
believe, but not tested this) that let's you track them more easily.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Tanoor Dieng newstan...@gmail.com
Date: Mon, Jan 17, 2011 10:23
Subject: [PHP] How to get cpu consumption of a php script
To: php-general@lists.php.net

Hi everybody,
I'm a php developper for a high traffic website. Our web servers run with
lightty?

We have some issues with the cpu consumption of our servers.

The problem is that, we don't know exactly which script consumes so much
cpu.
So, we cant to figure out how much cpu does a php script take.

We have tried 3 methods:

1) Microtime: microtime at the beginning and at the end and make the diff.
The problem with that is that it takes the execution time of the script, but
in our script we make:
- connection to database
- connection to memcache
- connection to session server

All of this is not taken into account, so microtime is not that accurate

2) Shell command: we get the pid of the process executing the script and
make a 'top' on this pid . The problem  is that the php-cgi manages many
threads so it's not accurate too.

Is there other methods for dealing with this problem.

Thanks,
best regards,

Tanoor.


Re: [PHP] Command line PHP

2011-01-07 Thread a...@ashleysheridan.co.uk
(sorry for top post, still not worked out how not to on phone)

Can you not just code it like you normally would any app that doesn't use a 
framework? I've been writing some cli data importers at work. Basic really, 
with only classes used that I need, no framework needed (its very simple) and 
all the output is just echo statements with new lines rather than br tags.

getopt() is your friend for command line arguments, but not all windows systems 
will support it, although Linux is fine.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: la...@garfieldtech.com la...@garfieldtech.com
Date: Fri, Jan 7, 2011 16:55
Subject: [PHP] Command line PHP
To: php-general@lists.php.net

Hi folks.  I have a project coming up that will involve writing a 
non-trivial command line PHP application.  Most of it will be nice and 
abstracted and standalone and all of that jazz, but it will need to do 
command line interation.  I'm not sure yet if it will be interactive or 
if I just need to parse lots of command line switches.

Has anyone used a CLI-handling library they like?  I recall briefly 
using the PEAR CLI library many many years ago and disliking it because 
it was only barely a step above the raw PHP-CLI SAPI, and still required 
lots of if-else branching in my code.  I don't know if there's anything 
better since then, however.  I prefer clean OO to procedural, but can 
work with procedural if needs be.  The fewer dependencies it has the 
better as well.

Any recommendations?

(Open source, GPLv2-compatible required.)

--Larry Garfield

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



Re: [PHP] Regex for telephone numbers

2010-12-31 Thread a...@ashleysheridan.co.uk
Sorry for top-post, on phone.

What about mobile phone numbers (cell phones you call them in the US) do they 
conform to the same format? I know there have been times myself when I've been 
without a landline number leaving me with only my mobile as a means of contact.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Ethan Rosenberg eth...@earthlink.net
Date: Fri, Dec 31, 2010 14:03
Subject: [PHP] Regex for telephone numbers
To: Nathan Rixham nrix...@gmail.com
Cc: php-general@lists.php.net php-general@lists.php.net


At 07:11 AM 12/31/2010, Nathan Rixham wrote:
Ethan Rosenberg wrote:
FYI [to all the list] -- I thank all for their input.  I only 
needed US phones, and I am forcing the user of the form to conform 
to xxx-xxx- as the input format.

out of interest, why are you forcing you're users to conform to that 
input format? you could simply strip all non-numeric chars then 
format how you like to save, thus giving users a looser, more 
friendly, experience.
+
Nathan -

This expression will be used to search a database which will contain 
patient data resulting from medical research.  At the initial visit a 
medical record number will be assigned to the patient.  Other 
information will be collected at that point; eg,  the telephone 
number. At subsequent visits, the patient will be referenced by 
his/hers medical record number.  If the patient either forgot their 
clinic card, or cannot remember their medical record number, a search 
will be performed.  One of the many parameters that can be used in 
the search is the phone number. It is easier if all the data has a 
fixed format.  The form for  the initial visit will use a regex that 
will validate the phone number. As  the research will be performed in 
the US, only US numbers have to be validated.

Hope this helps.

Ethan




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



Re: [PHP] Re: Regex for telephone numbers

2010-12-31 Thread a...@ashleysheridan.co.uk
Erm, you say regex is overkill, then use one in your example!

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Al n...@ridersite.org
Date: Fri, Dec 31, 2010 15:53
Subject: [PHP] Re: Regex for telephone numbers
To: php...@lists.php.net, php-general@lists.php.net



On 12/29/2010 7:12 PM, Ethan Rosenberg wrote:
 Dear List -

 Thank you for all your help in the past.

 Here is another one

 I would like to have a regex which would validate that a telephone number is
 in the format xxx-xxx-.

 Thanks.

 Ethan

 MySQL 5.1 PHP 5 Linux [Debian (sid)]


Regex is over-kill.

$phoneNum = preg_replace(%\D%, '', $phoneNum);//Remove everything except 
digits

$phoneNum = ltrim($phoneNum,'1');//Remove leading 1s

if(strlen($phoneValue) != 10)
 {
throw new Exception(Phone number must be 10 digits, without leading a 1. Check 
your entry carefull);
 }

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



Re: [PHP] File-Upload per Drag-N-Drop?

2010-12-29 Thread a...@ashleysheridan.co.uk
On a slight tangent, but is that signature why I'm not able to read any of 
michelles emails on my phone? For some reason, only her emails get stuck and 
won't download, so I have to wait til someone else replies.

To answer the question on this, I've not yet seen a cross platform answer to 
this question; only several different platform dependent solutions from one 
vendor to handle each main OS.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Michael Shadle mike...@gmail.com
Date: Wed, Dec 29, 2010 21:38
Subject: [PHP] File-Upload per Drag-N-Drop?
To: Michelle Konzack linux4miche...@tamay-dogan.net
Cc: PHP - General php-general@lists.php.net


On Wed, Dec 29, 2010 at 10:30 AM, Daniel P. Brown
daniel.br...@parasane.net wrote:

    That's more of a frontend question to which you and your
 six-million-line signature should check Google to find the answer.
 Don't get me wrong, Michelle, we've always tried to help out even with
 off-topic questions, but this is really pushing it a bit too far with
 all of the non-PHP questions you've been asking lately.

a) +1 - this isn't php-general anymore this feels like
michelle-development-requests (with a horribly long signature) - but I
don't mean to be harsh.

b) HTML5 should be what you want, at some point very soon.

Silverlight isn't fully cross platform
Java is your most universal applet language
fFash has odd issues, but would be second best
but HTML5, that's going to address it all.

Google for plupload it has all the different upload applet types and
tries to determine which one will be best for you. has the client side
and server side pieces included.

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



Re: [PHP] MP3 Player and PHP

2010-12-22 Thread a...@ashleysheridan.co.uk
You've missed a crucial part of php; its not a client-side language, its all 
run on the server. So you can't have a music player built in it running in a 
web browser. For that you need something like flash or java.

There is a way potentially with html5, but not all support the audio tag 
(internet explorer for example) and not all support the same codecs.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Don Wieland d...@dwdataconcepts.com
Date: Wed, Dec 22, 2010 15:06
Subject: [PHP] MP3 Player and PHP
To: php-general@lists.php.net

Hello,

Can someone recommend a web MP3 player? I need the following options:

1) Location and Duration of mp3 display (seconds)
2) The ability to pass a start and end parameter and play a part of  
the song
3) Loop parameter
4) Call to the player to grab the mp3 Location and set it to a field  
so i can insert it via PHP to mySQL
5) Work is most popular browsers

Free would be nice but I am will to pay a bit if it offers everything  
I need.

Any suggestions would be appreciated.

Don

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



Re: [PHP] Problem with Include

2010-12-21 Thread a...@ashleysheridan.co.uk
(Apologies for top posting; on my mobile just now.)

Not true. Refactoring code is one of the main tasks of a developer. None of us 
produce perfect code, and some code is less perfect than other code. It's 
instinct to want to fix bad code when we're maintaining it or having to add new 
features to it.

For the same reason car enthusiasts tinker with and tune their cars, good 
developers will do the same with code, be it in the form of consolidating 
common code to include files or other ways. To not do so seems to me to avoid 
ones nature really!

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Ravi Gehlot r...@ravigehlot.net
Date: Tue, Dec 21, 2010 18:12
Subject: [PHP] Problem with Include
To: Paul M Foster pa...@quillandmouse.com
Cc: php-general@lists.php.net


If something is working and you don't know exactly whats under the hood then
you are wasting your time in trying to re-invent your own wheel and waste
your time and resources to modify something that isn't needed to be touched.
Good programmers make good use of their time as well. We need to keep in
check with new technology, learn new trends and also master our weakness. If
we keep changing this or that or moving that or this then oh well...there
goes 1 day worth of work to figure stuff out.

Just my take on this. If you think different, then no problems.

Regards,
Ravi.


On Tue, Dec 21, 2010 at 10:23 AM, Paul M Foster pa...@quillandmouse.comwrote:

 On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote:

  On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot r...@ravigehlot.net
 wrote:
   Why mess with something that is already working? If you are trying to
 make
   it pretty then you are not solving a problem. You are creating one.
 
 
  Define working. I've had programs 'work', but more experienced would
  say it's flawed in some respect. Does it perform the immediate task?
 
  Now define pretty. Is it aesthetically pleasing to you, or to someone
  else with less, or maybe more experience.
 
  By defining the two above, you then define whether it's a problem. To
  you, or to them, or to the original designer?

 Beware of more experienced programmers. I recently talked to an
 ex-boss of mine who had a programmer flake out on him. One of his
 customers threatened to take this flaky code to another company and get
 their opinion about whether it was good code or not. My ex-boss
 explained that, of course, they'd shoot it down. Because that's what
 programmers do-- they complain about other programmers' code. I'd never
 heard that idea expressed aloud. But when I thought about it, I realized
 it was true. Hell, look at the content of this list. ;-}

 Paul

 --
 Paul M. Foster

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




Re: [PHP] All records not displaying...

2010-12-19 Thread a...@ashleysheridan.co.uk
I'm not sure what this line us all about:

if (mysql_num_rows($result) == !'0')

You're basically saying; if the number of rows is equal to the not of the 
string 0, what I think you may want in this case is just != 0.

The next line is causing your problem though. You're grabbing the first row 
with that $row= line, and not doing anything with it. Take that out and it 
should be ok.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Gary gp...@paulgdesigns.com
Date: Sun, Dec 19, 2010 15:46
Subject: [PHP] All records not displaying...
To: php-general@lists.php.net

I have an issue that the first record in a query is not being displayed.  It
seems that the first row in alphabetical order is not being brought to the
screen.

I have run the query in the DB and it displays the correct result, so it has 
to be in the php.

I have a MySQL DB that lists beers.  I have a column for 'type' of beer
(imported, domestic, craft, light). The queries:

$result = MySQL_query(SELECT * FROM beer WHERE type = 'imported' AND stock
= 'YES' ORDER by beername );

When I run the query

if (mysql_num_rows($result) == !'0') {
$row = mysql_fetch_array($result);

  echo 'h3Imported Beers/h3';
  echo 'table width=100% border=0 cellspacing=1 cellpadding=1
id=tableone summary=

  thBeer/th
  thMaker/th
  thType/th
  thSingles/th
  th6-Packs/th
  thCans/th
  thBottles/th
  thDraft/th
  thSize/th
  thDescription/th';

  while ($row = mysql_fetch_array($result)) {

 echo 'tr td' . $row['beername'].'/td';
 echo 'td' . $row['manu'] . '/td';
 echo 'td' . $row['type'] . '/td';
 echo 'td width=40' . $row['singles'] . '/td';
 echo 'td width=20' . $row['six'] . '/td';
 echo 'td width=40' . $row['can'] . '/td';
 echo 'td width=20' . $row['bottles'] . '/td';
 echo 'td width=40' . $row['tap'] . '/td';
 echo 'td' . $row['size'] . '/td';
 echo 'td' . $row['descrip'] . '/td';
'/tr';
}
 echo '/tablebr /';

}

All but the first row in alphabetical order are displayed properly.

Can anyone tell me where I am going wrong?
-- 
Gary

BTW, I do have a bonus question that is about javascript in this same file, 
so if anyone want to take a stab at that, I'll be happy to post it.






__ Information from ESET Smart Security, version of virus signature 
database 5715 (20101219) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Problem with Include

2010-12-19 Thread a...@ashleysheridan.co.uk
Is your server even set up to recognise .inc files as php? You can't just put 
any old extension on and expect the server to know what to do with it.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Tamara Temple tamouse.li...@gmail.com
Date: Sun, Dec 19, 2010 17:07
Subject: [PHP] Problem with Include
To: Bill Guion bgu...@comcast.net
Cc: php-general@lists.php.net



On Dec 19, 2010, at 10:43 AM, Bill Guion wrote:

 In an effort to clean up some code, I tried taking four lines out of  
 6 or 7 programs and putting them into an include file. The file  
 structure is

 Root
  data
clubs.php
  include
fmt.inc

 Originally, clubs.php had the following code:

 ?PHP
 $file_name= basename($_SERVER['PHP_SELF']);
 $last_modified = filemtime($file_name);
 print(This page last modified );
 print(date(m/j/y, $last_modified));

 ?

 This code works - on the web page I get

 This page last modified 12/18/2010

 which is correct.

 So then I did the following:
 Create an include file, fmt.inc with the following code:

 $file_name= basename($_SERVER['PHP_SELF']);
 $last_modified = filemtime($file_name);
 print(This page last modified );
 print(date(m/j/y, $last_modified));

 and then in the original file, I have

 ?PHP
 include ../include/fmt.inc;
 ?

 On my web page, I then get

 $file_name= basename($_SERVER['PHP_SELF']);$last_modified =  
 filemtime($file_name);print(This page last modified );  
 print(date(m/j/y, $last_modified));

 (all on one line).

 I would really like to understand why the include construct doesn't  
 give the same results as the original?

 -= Bill =-

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


Whenever you see PHP code emitted to the web page, it means it wasn't  
wrapped in ?php..?. If your include file above is complete, it's  
missing these tags.


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



Re: [PHP] empty() in email message

2010-12-13 Thread a...@ashleysheridan.co.uk
How are these variables being given their values by php? If you're making use 
of register_globals then you're asking for problems.

Perform some sanity checks on your data, like using a regex of /^\d+$/ to check 
for numerical values, and turn globals off; its a security breach waiting to 
happen.

Get the values from $_GET or $_POST and treat each one as malicious until you 
know its within the bounds of your application as a real value.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Gary gp...@paulgdesigns.com
Date: Mon, Dec 13, 2010 17:47
Subject: [PHP] empty() in email message
To: php-general@lists.php.net

I have an email message

$msg =  'Name: $fname ' . ' $lname\n'
. Phone: $phone\n
. Email: $email\n

and it works fine, however in this message there are about 30 variables that 
are being called...as such

. Order: beefschnitzel $beefschnitzel\n
. Order: beefstrips $beefstrips\n
. Order: cheesesausage $cheesesausage\n
. Order: crumbedsausage $crumbedsausage\n
. Order: chucksteak $chucksteak\n
. Order: cornedbeef $cornedbeef\n
. Order: dicedsteak $dicedsteak\n
. Order: filletmignon $filletmignon\n

I want to only send the message if the submitter enters an amount in the 
form for the corresponding variable, instead of having a bunch of empty 
messages.  So I have been trying to use the empty() function as such:

. if empty($beefolives){''} elseif (isset($beefolives)) { 'Order: beefolives 
$beefolives\n'}

But I am getting the error

Parse error: syntax error, unexpected T_IF

Can someone point me in the right direction?

Thank you
-- 
Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5699 (20101213) __

The message was checked by ESET Smart Security.

http://www.eset.com





-- 
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 a...@ashleysheridan.co.uk
And the obvious difference, print returns  true on success. I'm not sure what 
would cause an echo it print to ever fail, so it really doesn't make a huge 
difference.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Alexandru Patranescu dreal...@gmail.com
Date: Sun, Dec 12, 2010 18:56
Subject: [PHP] code quest - ECHO?!?
To: Kirk Bailey kbai...@howlermonkey.net
Cc: php-general@lists.php.net


They are almost identical.
Echo supports multiple parameters like echo $a, $b;
print is 20% slower than echo (by some tests).
echo is shorter than print so it's easy to write.
In fact it's all a matter of taste. The same reason we user die instead of
exit.

Alex



On Sun, Dec 12, 2010 at 6:23 PM, Kirk Bailey kbai...@howlermonkey.netwrote:

 Groovy; they appear to be identical in all but name. IDENTICAL. Or am I
 missing a subtle definition difference?



 David Robley wrote:

 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



 --
 end

 Very Truly yours,
- Kirk Bailey,
  Largo Florida

  kniht+-+
 | BOX |   +-+think



Re: [PHP] Fw: Spoofing user_agent

2010-11-25 Thread a...@ashleysheridan.co.uk
You need to set it in the header request you make. Putting it in the script 
you're using as a spider with ini_set won't do anything because the Target site 
doesn't know anything about it.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Ron Piggott ron.pigg...@actsministries.org
Date: Thu, Nov 25, 2010 08:25
Subject: [PHP] Fw: Spoofing user_agent
To: php-general@lists.php.net

I have wrote a script to generate a sitemap of my web site.  It crawls all of 
the site web pages.  (About 30,000)  

I need help to spoof the user_agent variable so the stats program running in 
the background ( “AWSTATS” ) will treat the crawl as a bot, not browsing usage. 
 

The sitemap generator is a cron job.  I tried the syntax:
ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)'/);

This didn’t work.  The browsing was attributed to the dedicated IP address.

How do I get AWSTATS to access this, such as other entries under the 
“Robots/Spiders visitors” heading:
Unknown robot (identified by 'bot*') 

I don’t mean any ill will by changing this setting.  Thanks for the help.

Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info

Re: [PHP] mysql help (sorry, a bit OT)

2010-11-16 Thread a...@ashleysheridan.co.uk
It's always best practice to have a staging server for testing these sorts of 
things.

If in doubt, run it in a transaction, but don't commit it, I.e. roll it back. 
That way you'll see if it would run but nothing actually changes.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Gary php-gene...@garydjones.name
Date: Tue, Nov 16, 2010 13:35
Subject: [PHP] mysql help (sorry, a bit OT)
To: php-general@lists.php.net

Is there a way to check the syntax of a query, short of running it? I've
got an insert to do (but of course it's a valid question for any query
that changes the db contents) and would like to know that the sql I am
generating (in php - see! not so off-topic!) is correct. 

What I don't want to do is run it for testing (live system *sigh*) and
find out it is correct (it will change the db), but... I have to test it
to check that the syntax (at least) *is* correct.


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



Re: [PHP] protecting email addresses on a web site

2010-11-16 Thread a...@ashleysheridan.co.uk
Sorry for top post on phone.

Depending on the type of site and location an email address might be legally 
required. For example, a business website in the UK requires a value email 
address to be made accessible to all your visitors, which includes blind 
people, so no image-only addresses.

Spam is just a fact of life now, and the only real method of protection is a 
decent spam filter.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Bastien Koert phps...@gmail.com
Date: Tue, Nov 16, 2010 21:02
Subject: [PHP] protecting email addresses on a web site
To: Grega Leskovšek legr...@gmail.com
Cc: a...@ashleysheridan.co.uk, HallMarc Websites 
sa...@hallmarcwebsites.com, Dotan Cohen dotanco...@gmail.com, David 
Mehler dave.meh...@gmail.com, php-general php-general@lists.php.net


On Tue, Nov 16, 2010 at 3:36 PM, Grega Leskovšek legr...@gmail.com wrote:
 I tried this:
 ?php echo span
 class=\safety\sssa/moc.li...@ood.sulpcoj\moc.li...@ood.sulpcoj:otliam\=ferh
 a/span;
 ?
 and css:
 .safety { direction:rtl; unicode-bidi: bidi-override; }
 for the address jocplus@gmail.com
 but I haven't managed it to display properly
 Could someone please direct me, I believe if I put the
 a class=safety href=mailto:jocplus@gmail.com;vicaversa/a...
 it does not really protect the email address, because in mailto: it
 has to be as defined jocplus@gmail.com
 Thanks,
 -- When the sun rises I receive and when it sets I forgive -
 http://moj.skavt.net/gleskovs/
 Always in Heart, Grega Leskovšek




 2010/6/15 Ashley Sheridan a...@ashleysheridan.co.uk:
 On Tue, 2010-06-15 at 13:02 -0400, HallMarc Websites wrote:


 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]
 Sent: Monday, June 14, 2010 10:52 AM
 To: Dotan Cohen
 Cc: HallMarc Websites; David Mehler; php-general
 Subject: Re: [PHP] protecting email addresses on a web site

 On Mon, 2010-06-14 at 17:50 +0300, Dotan Cohen wrote:

  On 14 June 2010 15:36, HallMarc Websites sa...@hallmarcwebsites.com
 wrote:
   Another is a CSS solution where you type the email address backwards and
   then use the CSS style declaration:
   style=direction: rtl; unicode-bidi: bidi-override;
  
 
  How does that work with screen readers? How about copy-paste?
 


 I don't think there's an accessible way of doing this. Anything that
 allows a screen reader to speak the email address would also be
 susceptible to spammers email scrapers.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



 Copy-n-paste just gives you the email address backwards; screen readers,
 because we are using logical ordering and it is stored in memory the way we
 expect to read it, will read it correctly.

 I was not aware that email harvesters used screen readers. Do you have some
 documentation I could read to get up to speed on this?

 Marc Hall
 HallMarc Websites
 So many spammers, so few bullets...


 __ Information from ESET Smart Security, version of virus signature
 database 5199 (20100615) __

 The message was checked by ESET Smart Security.

 http://www.eset.com




 I didn't say the harvesters used screen readers. I'm saying that if
 something is in plain text that a screen reader can understand, what's
 to stop an email address harvester? It's not worth their time to analyse
 every image (think about where Google is with image searching right now,
 and they have a lot more resources at their disposal) but it is easy
 enough to read text in a web page. At a push, it's possible to believe
 that some might be using rendered CSS to see how an email is rendered.

 Thing is, it's nigh on impossible to hide an email address. Use it once
 on a mailing list like this and it's there for the whole world to see on
 archive listings. I even though that my email wouldn't be found in
 a .pdf CV I'd made, but thanks to Google it is now!

 Basically, it might not be worth the effort to hide email addresses, and
 instead see about setting up spam filtering at the server level. You
 don't have to download and filter it your end, and it saves on
 bandwidth.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk




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



Why not just make a simple contact form and never show the address?

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Re: String manipulation

2010-11-14 Thread a...@ashleysheridan.co.uk
What about something like this:

$pos = (strpos(' ', $string, 76))?strpos(' ',$string, 76):strlen($string);

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Ron Piggott ron.pigg...@actsministries.org
Date: Sun, Nov 14, 2010 20:48
Subject: [PHP] Re: String manipulation
To: php-general@lists.php.net


How would I write an IF statement that looks for the first space space (“ “) 
left of the 76th character in a string or br, which ever comes first --- OR 
the end of the string (IE the string is less than 76 characters long? I 
specifically want is it’s character position in the string.  Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info

Re: [PHP] question about preventing polling for more than once

2010-11-12 Thread a...@ashleysheridan.co.uk
Have you checked for any cookies left by that website?

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: 肖晗 xiaohan2...@gmail.com
Date: Fri, Nov 12, 2010 15:14
Subject: [PHP] question about preventing polling for more than once
To: php-general@lists.php.net

I noticed that some websites such as
polldaddyhttp://polldaddy.com/account/home.php has
fascinating poll service. And I am just curious about how it prevents user
from polling the same poll for more than once. Or more accurately, I am a
dynamic IP user. And I found that if I have polled once for a certain poll
and after some time, I changed my IP when I got connected to the Internet
again, I cannot poll the previous one for the second time. So I am confused
how polldaddy http://polldaddy.com/account/home.php can figure out that I
have polled even if I had changed my IP. Is there any way to achieve that?

Thanks in advance.


Re: [PHP] Chinese words on a PHP web page

2010-11-04 Thread a...@ashleysheridan.co.uk
You could do it using the 1234; type codes, or copy it directly from another 
source, like a character map program.

Bear in mind that if you do the latter, you'll need to output a utf 8 meta tag 
with the html output too.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Ernie Kemp ernie.k...@sympatico.ca
Date: Thu, Nov 4, 2010 16:52
Subject: [PHP] Chinese words on a PHP web page
To: 'PHP General List' php-general@lists.php.net

 

I’m writing a program that allows the user to click the flag and the test will 
change to that language and display.

 

I’m trying to convert from English  to Chinese using characters such as “ 
æ­“è¿Ž” The browser interprets these into, in this case, Japanese but my code 
needs to display in Chinese.

 

The internet is giving all kinds of code to convert from English into the 
Chinese language.

 

I need to put in Unicode characters that the browser will make the final change 
into Chinese words.  I’m using define(CHARSET,UTF-8);

 

So the question is how does one enter Chinese Unicode??

 

 

Thanks,

/Ernie

 



Re: [PHP] Fwd: Mail delivery failed: returning message to sender

2010-11-01 Thread a...@ashleysheridan.co.uk
It's not to do with hosting, its an auto reply when you email sascha.braun 
which gave the same aware reply to me, and I'm on a Linux box at home!

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Ben Brentlinger b...@benbrent.com
Date: Mon, Nov 1, 2010 08:29
Subject: [PHP] Fwd: Mail delivery failed: returning message to sender
To: php-general@lists.php.net

it could be that the person whom you tried email has reached the quota 
on their inbox.  It's also possible that the person you tried emailing 
gave you a fake email address and it's also possible that your domain 
might be hosted on a cheap hosting account with a company that has been 
known for other people using their service to host websites that have a 
bulk mailing script meant for sending spam.  The possibility to what 
could be going on are endless, but out of all the possibilities I can 
think of, I can't imagine a spammer hijacking your site to send malware 
from it being one of the more likely possibilities especially if you 
have a hosting account with cpanel, which is harder to gain unauthorized 
access to a cpanel hosting account than it is to gain access to a web 
server's FTP, especially if you allow public FTP uploads to the site, 
that can be a breading ground for hackers to upload a password sniffing 
script onto your site via FTP that would track back to their server, 
which would allow them to hack into your website.  Cheap, no name 
webhosting companies are more likely breading grounds for those kinds of 
shady charachters.  If you have an account with one of those no name 
companies, I'd recommend changing webhosts immediately, otherwise, you 
should be ok.  If you do, though, and you're not sure who to switch to, 
I'd recommend hostgator 
http://secure.hostgator.com/%7Eaffiliat/cgi-bin/affiliates/clickthru.cgi?id=BenBrent.
 


They're not as big as 11 or Godaddy, but there one of the biggest 
webhosting companies that use cpanel.  I wouldn't recommend any 
webhosting company that doesn't use cpanel because anything else is 
either harder to use, not as secure or both.

On 11/1/2010 3:56, Ashley Sheridan wrote:
 On Sun, 2010-10-31 at 20:06 -0500, Tamara Temple wrote:

 Is this something I need to worry about?? Is my mail sending some
 malware??

 Begin forwarded message:

 From: Mail Delivery Subsystemmailer-dae...@immosky.ch
 Date: October 31, 2010 7:37:54 PM CDT
 To: Tamara Templetamouse.li...@gmail.com
 Subject: Mail delivery failed: returning message to sender

 This message was created automatically by mail delivery software.

 A message sent by

   php-general-return-309188-sascha.braun=immosky...@lists.php.net

 could not be delivered to all of its recipients.
 The following address(es) failed:

   sascha.br...@immosky.ch

 The following text was generated during the delivery attempt(s):

 sascha.br...@immosky.ch
 (reason: 550 This message contains malware
 (winnow.malware.wa.webinjection.1450.UNOFFICIAL))

 -- This is a copy of the message, including all the headers.

 Received: from [192.168.1.110] (helo=mailin01.ims-firmen.de)
 by mail01.ims-firmen.de with esmtp (Exim 4.69)
 
 (envelope-fromphp-general-return-309188-sascha.braun=immosky...@lists.php.net
 )
 id 1PCiPJ-0001i7-R8
 for sascha.br...@immosky.ch; Mon, 01 Nov 2010 01:37:53 +0100
 Received: from pb1.pair.com ([76.75.200.58] helo=lists.php.net)
 by mailin01.ims-firmen.de with esmtp (Exim 4.72)
 
 (envelope-fromphp-general-return-309188-sascha.braun=immosky...@lists.php.net
 )
 id 1PCiPs-00047o-Sb
 for sascha.br...@immosky.ch; Mon, 01 Nov 2010 01:38:29 +0100
 Authentication-Results: pb1.pair.com header.from=tamouse.li...@gmail.com
 ; domainkeys=bad
 DomainKey-Status: bad
 X-DomainKeys: Ecelerity dk_validate implementing draft-delany-
 domainkeys-base-01
 X-Host-Fingerprint: 76.75.200.58 pb1.pair.com
 Received: from [76.75.200.58] ([76.75.200.58:2084] helo=lists.php.net)
 by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP
 id EF/73-24094-FDB0ECC4 forsascha.br...@immosky.ch; Sun, 31 Oct
 2010 19:37:51 -0500
 Received: (qmail 51732 invoked by uid 1010); 1 Nov 2010 00:37:02 -
 Mailing-List: contact php-general-h...@lists.php.net; run by ezmlm
 Precedence: bulk
 list-help:mailto:php-general-h...@lists.php.net
 list-unsubscribe:mailto:php-general-unsubscr...@lists.php.net
 list-post:mailto:php-general@lists.php.net
 List-Id: php-general.lists.php.net
 Delivered-To: mailing list php-general@lists.php.net
 Received: (qmail 51725 invoked from network); 1 Nov 2010 00:37:02
 -
 Authentication-Results: pb1.pair.com header.from=tamouse.li...@gmail.com
 ; sender-id=pass; domainkeys=bad
 Authentication-Results: pb1.pair.com
 smtp.mail=tamouse.li...@gmail.com; spf=pass; sender-id=pass
 Received-SPF: pass (pb1.pair.com: domain gmail.com designates
 209.85.214.170 as permitted sender)
 X-DomainKeys: Ecelerity dk_validate implementing draft-delany-
 domainkeys-base-01
 

Re: [PHP] questions about if statements regarding a checkbox

2010-10-31 Thread a...@ashleysheridan.co.uk
What is the code you're using now? You have a syntax error, but without seeing 
the code, we are all left to guessing what the problem could be.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Ben Brentlinger b...@benbrent.com
Date: Sun, Oct 31, 2010 03:56
Subject: [PHP] questions about if statements regarding a checkbox
To: php-general@lists.php.net

I tried that, but I'm getting the syntax error that says unexpected 
T_IF.  Probably because I'm trying to process this information directly 
in an email rather letting a mysql database handle the data, which I 
find harder to set up when writing a script from scratch than it would 
be to code a php script to send the data in an email.

On 10/30/2010 22:28, ad...@buskirkgraphics.com wrote:

 input type=checkbox name=test

 If check it will submit the value of 'on'

 So

 If($_POST['test'] == on')
 {
 Do this
 }else{
 Do this
 }


 Richard L. Buskirk


 -Original Message-
 From: Ben Brentlinger [mailto:b...@benbrent.com]
 Sent: Saturday, October 30, 2010 10:05 PM
 To: php-general@lists.php.net
 Subject: [PHP] questions about if statements regarding a checkbox

 hello,

 I'd like to know the proper code to use in a php script that processes a
 form with a checkbox in order to send one email if the checkbox has been
 checked and another email if the checkbox hasn't.  I tried if($check ==
 true) and I tried putting the word true in double quotes, and both of
 them caused the unexpected variable syntax error.  The only problem
 is, all I could think to use was that line of code I just used, I'm not
 sure what the proper syntax is for checkbox when using the if statement
 to send one email when the checkbox is checked and a different email
 when it's not checked.  I'm wanting to send an email to the site admin
 with the information given by the person who filled out the form that
 contains the checkbox.


 Thanks,

 Ben


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



Re: [PHP] search is not case insensitive

2010-10-31 Thread a...@ashleysheridan.co.uk
This isn't a php question but a mysql one. Take out the lower() part of the sql 
statement, as like is case insensitive by default.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Dr Michael Daly g...@holisticgp.com.au
Date: Sun, Oct 31, 2010 04:47
Subject: [PHP] search is not case insensitive
To: php-general@lists.php.net

Hi
Using a php search form produces a nil return on any information that is
capitalised within a mysql database; retrieval is fine for non-capitalised
data. Could someone tweak this please? The relevant code I think is as
follows:

// Description is a BLOB in MySQL... we need to UPPER the blob
//values to make the search case-insensitive.

$query = SELECT C.*, A.surname, A.name, A.surname_prefix, A.id AS user
FROM pbcs_user A, pbcs_join_table_user_app B, pbcs_appointment C.

WHERE A.id = B.user_id AND B.appointment_id = 
C.id .

AND LOWER(C.description) LIKE 
'%.strtolower($search_for).%' AND
C.start_time  $start_time AND C.start_time  $end_time ORDER BY
C.start_time;
$result = pbcs_db_query($query);

Thanks
Michael
Melb, Aust.

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



Re: [PHP] include html

2010-10-31 Thread a...@ashleysheridan.co.uk
This can only be done with javascript, as the iframe is client-side, which php 
knows nothing about.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Karl DeSaulniers k...@designdrumm.com
Date: Sun, Oct 31, 2010 03:32
Subject: [PHP] include html
To: php-general php-general@lists.php.net

Hello,
I am looking for a solution to inject some dynamic html into an  
iframe and rework the css from the results.
Is there a way to do this in PHP? I am not talking about just using  
the src attribute of the iframe either.

Basically,
I want to call on a web page, grab the html code, replace the link  
tag with my own and insert it into an iframe on my page.

I am sure this is not as complicated as I am making it, but I have  
been trying with Ajax for the past couple of days and no luck.
So I was wondering if there was a php alternative to do this with. Or  
if it is even possible or ok to do so.

I am building a website for a tshirt company that uses another  
company to get garments and promo items to print on.
The client wants to just have those pages load on top of their  
website, but wants the layout to go with their look and feel. their css.
We have the go ahead from the other companies to do so as well.

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com



Re: [PHP] a question about user and permission on linux

2010-10-31 Thread a...@ashleysheridan.co.uk
If its Apache on Linux (as most hosting will be) then the user will generally 
be either apache, www, or http.

Thanks,
Ash
http://www.ashleysheridan.co.uk



Re: [PHP] a question about user and permission on linux

2010-10-31 Thread a...@ashleysheridan.co.uk
There isn't a php user. If php scripts are executed through the web server, 
they belong to the server. If they are cli scripts, then they belong to the 
user that executed them, or the user the process that executed them is running 
as.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Ryan Sun ryansu...@gmail.com
Date: Sun, Oct 31, 2010 18:43
Subject: [PHP] a question about user and permission on linux
To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk

Then whats the user of php?
On 10/31/2010 2:39 PM, a...@ashleysheridan.co.uk wrote:
 If its Apache on Linux (as most hosting will be) then the user will 
 generally be either apache, www, or http.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk






Re: [PHP] Character encoding hell

2010-10-26 Thread a...@ashleysheridan.co.uk
Have you tried using the utf8 meta tag rather than using the htmlentities() 
function? That should solve the first issue, as I reckon the problem lies with 
the way your encoding the filename.

Linux filesystems have far less limitations on filenames, so it could be that 
windows is doing something odd which coincides with what php is doing. I'm not 
at my machine right now to test, but you should be able to pass the filename in 
the url with url_encode and on the server convert it back with url_decode to 
give you the original filename back.

Lastly, have you made sure your php scripts are saved as utf8, as that can 
sometimes solve some odd problems with character encoding.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Marc Guay marc.g...@gmail.com
Date: Tue, Oct 26, 2010 18:00
Subject: [PHP] Character encoding hell
To: php-general php-general@lists.php.net

Again, if it helps, a link formatted in the same way to the same file
links correctly on a windows machine.

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



Re: [PHP] Character encoding hell

2010-10-26 Thread a...@ashleysheridan.co.uk
Where is the filename coming from? Is it hard-coded in the script or is your 
script reading it from a directory listing?

Have you checked to see if that filename is what you think it is on the Linux 
server?

Was Apache the web server both times, or was iis used on windows? If it was, 
look for any errant .htaccess files causing problems.

Lastly, what happens if you directly request that file from with the browser 
itself, without php scripts in the equation.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Marc Guay marc.g...@gmail.com
Date: Tue, Oct 26, 2010 18:22
Subject: [PHP] Character encoding hell
To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk
Cc: php-general php-general@lists.php.net


 Have you tried using the utf8 meta tag rather than using the htmlentities()
 function? That should solve the first issue, as I reckon the problem lies
 with the way your encoding the filename.

The page is being encoded in UTF-8.  Without htmlentities() the
special character is displayed as a black triangle with a question
mark in it.  Does that indicate that the filename isn't being stored
as UTF-8?

 Lastly, have you made sure your php scripts are saved as utf8, as that can
 sometimes solve some odd problems with character encoding.

This didn't seem to change anything.

Marc

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



Re: [PHP] I need some thoughts on code duplication and separation

2010-10-21 Thread a...@ashleysheridan.co.uk
Bit late to this one, but what about an mvc framework like codeigniter? It's 
perfectly acceptable to use if statements and loops in the view, which would 
solve your problem. You can set a trigger variable in the controller, and in 
the header view, check to see if its set and output your javascript lines as 
appropriate.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Peter Lind peter.e.l...@gmail.com
Date: Thu, Oct 21, 2010 07:01
Subject: [PHP] I need some thoughts on code duplication and separation
To: David McGlone da...@dmcentral.net
Cc: php-general@lists.php.net


On 21 October 2010 04:59, David McGlone da...@dmcentral.net wrote:
 On Thu, 2010-10-21 at 04:05 +0200, Rico Secada wrote:
 Hi.

 I am working on a small system where I am both trying to avoid code
 duplication and at the same time I am trying to keep the presentation
 logic separated from the application logic.

 I am using sessions and are avoiding headers already sent problem by
 keeping the HTML out of the application.

 For example, I would like to have a common header.php file, but it is
 difficult to create this since one file needs to have some specific
 Javascript located in the head /head tags, but the other files
 doesn't need this.

 Another file needs to have a specific onload call in the body tag,
 while yet another file also needs to have an onload call, but with
 different attributes.

 I have been looking around in other systems to see what kinds of
 solutions are being used - as inspiration.

 I have been thinking about the following solutions:

 1. Create only ONE header.php file that contains a lot of conditionals
 depending on what file is including it - the output of HTML/Javascript
 changes.

 I believe this would turn into a very ugly hack. Difficult to maintain.

 2. Create a HTML generating class with a set of methods that each
 contains an adequate amount of parameters. Each method maintains its
 own HTML tag. For example, docType($type) would generate the doctype
 specification.

 I believe this is a cleaner solution, but the problem with code
 duplication isn't avoided.

 Some of the presentation logic contains conditionals and the HTML
 changes when the conditional changes, hence the header content changes,
 but the doctype, html, and head doesn't necessarily change and
 they would get duplicated a couple of times in some files.

 3. Avoid the problem all together, use output buffering and completely
 forget about separation between application and presentation.

 I hope I make sense.

 Any thoughts on these kinds of problems?

 sounds like a job for smarty http://www.smarty.net/

 I've used smarty and it's nice.


How does Smarty solve this problem? Just curious.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



Re: [PHP] My truth comes out [1]

2010-10-21 Thread a...@ashleysheridan.co.uk
That's as bad as an if!

What about using settype() on the string? I've not tested it, but it looks like 
it should do the trick.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Russell Dias rus...@gmail.com
Date: Thu, Oct 21, 2010 10:51
Subject: [PHP] My truth comes out [1]
To: php-general@lists.php.net

preg_match(/false/i, $string) ? false : true;



On Thu, Oct 21, 2010 at 7:39 PM, Gary php-gene...@garydjones.name wrote:
 Is there any nice way to convert a string containing either TRUE or
 FALSE to a bool with the appropriate value? I know I can just if
 (strcmp... but, as the song goes on to say ...ugly, so ugly, it's ugly[1]

 Footnotes:
 [1]  Mask, Henry Rollins

 --
 Gary


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



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



Re: [PHP] My truth comes out [1]

2010-10-21 Thread a...@ashleysheridan.co.uk
Because it is an if statement, just in a different form, and preg_match is more 
computational expensive than a direct string comparison.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Russell Dias rus...@gmail.com
Date: Thu, Oct 21, 2010 11:03
Subject: [PHP] My truth comes out [1]
To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk
Cc: php-general@lists.php.net


I'm curious to know why 'thats as bad as an if' ?

It's simple, concise, understandble and does the job. So, I'm curious
to know why exactly its bad?

On Thu, Oct 21, 2010 at 8:01 PM, a...@ashleysheridan.co.uk
a...@ashleysheridan.co.uk wrote:
 That's as bad as an if!

 What about using settype() on the string? I've not tested it, but it looks 
 like it should do the trick.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

 - Reply message -
 From: Russell Dias rus...@gmail.com
 Date: Thu, Oct 21, 2010 10:51
 Subject: [PHP] My truth comes out [1]
 To: php-general@lists.php.net

 preg_match(/false/i, $string) ? false : true;



 On Thu, Oct 21, 2010 at 7:39 PM, Gary php-gene...@garydjones.name wrote:
 Is there any nice way to convert a string containing either TRUE or
 FALSE to a bool with the appropriate value? I know I can just if
 (strcmp... but, as the song goes on to say ...ugly, so ugly, it's ugly[1]

 Footnotes:
 [1]  Mask, Henry Rollins

 --
 Gary


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



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




Re: [PHP] Formatting an ECHO statement.

2010-10-19 Thread a...@ashleysheridan.co.uk
Steady on now, this thread started as a php question, and has only deviated a 
little. Most people on the list don't work purely with php, and I for one dont 
mind the odd off-topic thread, especially when the majority of the list is made 
of good php threads.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Cris S ssski...@gmail.com
Date: Tue, Oct 19, 2010 03:46
Subject: [PHP] Formatting an ECHO statement.
To: php-general@lists.php.net

At 15:12 18 10 10, Shreyas Agasthya wrote:
Thanks all for their input. Some of the learnings  from the thread :

1. i tag is getting deprecated.

Not in HTML5.

2. Use em and strong

Both? Read that shit again, buckwheat. And by that shit I
do mean the standards, not what Joe Bloe told you.

3. Have CSS used to do the kind of stuff I was trying.

Uhm, yeah. @@

  I must inform, this was already in place.

Then why the fuck are we discussing this?

4. Keep an eye on the SE monster.

and on the go fuck yourself monster too.

Holy fuck, I've been lurking for months. I turn away for
one day and this is the non-PHP crap that happens?

Someone needs to hire me now, to keep me busy and stop me
from taking this issue apart one piece at a time. Kee-rist.



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



Re: [PHP] PDO working via Apache but not at the command line?

2010-10-18 Thread a...@ashleysheridan.co.uk
It's most likely because both cli and web modules are using different php.ini 
config files. See what the output of a phpinfo() call in both browser and 
command line.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Scott Baker bak...@canbytel.com
Date: Mon, Oct 18, 2010 21:20
Subject: [PHP] PDO working via Apache but not at the command line?
To: p...@lists.php.net, php-general@lists.php.net

I have the following very simple script that uses PDO/FreeTDS to connect 
to a mssql server. I have PHP Version 5.3.3 running on Linux under 
Apache. When I view this script via apache/firefox I get proper output.

If I try and run this via the command line like php db_dump.php I get 
an error connecting to the DB:

Unable to connect to Omnia: SQLSTATE[HY000] Unable to connect: Adaptive 
Server is unavailable or does not exist (severity 9). Does Apache call 
PHP differently than the cli would? Why would Apache method work find, 
but direct from the command line cause a problem? Do I need to call php 
from the cli with some other argument?

--


$num || $num = 197804;

$dbh = omnia_connect();
$sql = EXECUTE P_SaaS_AccountServiceFeatures_Retrieve $num;
$sth = $dbh-prepare($sql);
$sth-execute();

$foo = $sth-fetchAll(PDO::FETCH_ASSOC);

foreach ($foo as $i) {
 if ($i['ItemStatus'] != 'I') {
 $out .= $i['Component'] . \n;
 }
}

print $out;



function omnia_connect() {
 putenv('FREETDSCONF=/etc/freetds.conf');
 $db = DB_NAME;
 $user = user;
 $pass = pass;

 $dsn = dblib:host=Omnia;dbname=$db;

 try {
 $dbh = new PDO($dsn, $user, $pass);
 } catch (PDOException $e) {
 echo 'Unable to connect to Omnia: ' . $e-getMessage();
 exit;
 }

 return $dbh;
}

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



Re: [PHP] Questions from a Newbie

2010-10-17 Thread a...@ashleysheridan.co.uk
Linux can be run as a GUI, using a window manager.

Aside from that, have a look at the manual pages on php.net, which give some 
good examples of how to use the various mysql functions.

Also, on your development machine, its a good idea to turn on errors, as it can 
indicate where these problems are. You can do this from the php.ini, look for 
display_errors.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Ethan Rosenberg eth...@earthlink.net
Date: Sun, Oct 17, 2010 19:22
Subject: [PHP] Questions from a Newbie
To: Tommy Pham tommy...@gmail.com, php-general@lists.php.net



At 01:41 AM 10/17/2010, Tommy Pham wrote:
  -Original Message-
  From: Ethan Rosenberg [mailto:eth...@earthlink.net]
  Sent: Saturday, October 16, 2010 10:01 PM
  To: php-general@lists.php.net
  Subject: [PHP] Questions from a Newbie
 
  Dear List -
 
  Here are some questions, which I am sure are trivial, but I am a newbie,
and
  cannot find the answers online
 
  I cannot get the following to work.  In my Firefox [Iceweasel] browser, I
  enter the following URL: [w/ the http]
 
localhost/CreateNew.php All I get is a blank browser screen.
 
  The code  contained in the file CreateNew.php is:
 
  /*
*  Create Database test22
*/
htmlbody
  ?php
  $cxn = mysqli_connect($host,$user,$password);
  echoCreate database test22;
  echoCreate table Names2
  (
   RecordNum Int(11) Primary Key Not null default=1
auto_increment,
   FirstName varchar(10),
   LastName varchar(10),
   Height  decimal(4,1),
   Weight0 decimal(4,1),
   BMI decimal(3,1)
   Date0 date
  );
 
  echo   Create table Visit2
  (
   Indx Int(7) Primary Key Not null auto_increment,
   Weight decimal(4,1) not null,
   StudyDate date not null,
   RecordNum Int(11)
  );
 
   $sql= SHOW DATABASES;
  ?
  /body/html
 
  If I search for test22 or Visit2, nothing is found.
 
  I would also like to be able to add data to a table, using PHP, which I
can do
  in MySQL as:
  load data infile '/home/ethan/Databases/tester21.dat.' replace into table
  Names fields escaped by '\\' terminated by '\t'  lines terminated by '\n'
;
 
  Thanks in advance.
 
  Ethan
  ===
  Using Debian(sid)
 

You're reinventing the wheel that's been rolling along very smoothly for a
long time... Google 'phpmyadmin'.  Also, read this entire section [1].

Regards,
Tommy

[1] http://www.php.net/manual/en/book.mysqli.php

Tommy -

Thanks.

As I stated, I am a newbie.

1] I am trying to shorten the learning curve by asking some 
questions, which I understand are probably trivial.  A whole MySQLi 
list of functions at this point is to much for me.  I have to break 
the problem into manageable parts.

2] It has been my experience that using a GUI does not teach the 
whole subject.  Linux, which is the OS I use cannot be run from a GUI.

In the code being discussed, I wish to create a database and add two 
tables.  I also note a MySQL statement that can be used to add data 
to an existing table, and wish to be able to execute this statement 
using PHP.

So, therefore..

Let us try to answer the following two(2) questions:

a] What changes [other than moving the simicolons] have to be made to 
correct the code.

b] What books can you suggest to help w/ MySQL and PHP?  I already 
have the SQL, MySQL  PHP, and HTML books in the . for Dummies 
series.  I need something with a little more depth and detail.

Thanks to all for your excellent help.

Ethan

  Using Debian(sid)
 



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



Re: [PHP] odd while behavior...

2010-10-16 Thread a...@ashleysheridan.co.uk
I wouldn't really use a while statement for this, but a for loop instead, as it 
needs less code:

?php

echo select;

for($i =1;$i=12;$i++)
{
     $dateformat = date(M, mktime(0,0,0, $i,0,0));

     echo HTML

     option value=$i$dateformat $i/option

HTML;
}

echo /select;
?


The other code was starting from 0 and going to 12, which is 13 months! Also, 
you had the variable being compared as a string, which will work in this 
particular case, because php will convert $i to a string before each comparison 
in the loop. While it works in this case, its best practice to use the variable 
type you need to avoid unusual behavior.

The mktime function is unusual in that indexes for months start at 1 and not 0 
as you might expect, but it does indicate that on the manual pages.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Jason Pruim li...@pruimphotography.com
Date: Sat, Oct 16, 2010 16:12
Subject: [PHP] odd while behavior...
To: PHP General list php-general@lists.php.net

Okay so I'm just playing around with some stuff trying to learn more  
and expand my knowledge and I ran into something I don't understand...  
Take the following code:

?PHP

echo select;
$i =0;
 while($i =12) {

 $dateformat = date(M, mktime(0,0,0, $i,0,0));
 $month = mktime(0,0,0, $i,0,0);
 //echo date(M, mktime(0,0,0, $i,0,0));
 //echo brinside whilebr;
 echo HTML
 option value={$i}{$dateformat} {$i}/option
HTML;
 $i++;
 }
echo /select;

?

which does display a select drop down box with the month's in it...  
But on my test server it starts the display at december... With  
setting $i = 1 i would have thought it should start at january?

Any ideas on what I missed? :)


Thanks for looking! :)


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



Re: [PHP] Scripts running twice

2010-10-12 Thread a...@ashleysheridan.co.uk
That's probably it then! Some browsers make multiple requests to speed up 
rendering of a page.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Alexis phplis...@antonakis.co.uk
Date: Tue, Oct 12, 2010 17:16
Subject: [PHP] Scripts running twice
To: php-general@lists.php.net

If you mean how am I triggering the script, then I am simply opening it 
up in my web browser...

On 12/10/10 04:21, Richard Quadling wrote:
 On 11 October 2010 21:37, Alexisphplis...@antonakis.co.uk  wrote:
 Thanks for perservingnope just the two entries per script..one start and
 one stopalso checked the multi tab and that is set to just the once as
 well.
 One thing I forgot to say before is that even if I run the scripts manually,
 then they still run the twice.sorry about missing that bit out...

 On 11/10/10 14:27, Richard Quadling wrote:

 On 11 October 2010 21:20, Alexisphplis...@antonakis.co.ukwrote:

 Thanks for the quick response...checked and no duplicates Richard

 On 11/10/10 14:14, Richard Quadling wrote:

 On 11 October 2010 21:10, Alexisphplis...@antonakis.co.uk  wrote:

 Hi,

 A very vague question here I am afraidI have quite a number of php
 scripts running on a WinXp box using the built in Scheduler.

 Everything worked fine for years until one day an update was
 done...cannot
 remember if it was on PHP, Apache, Mysql or the firefox browser, but
 now
 most but not all, of the scripts run twice!

 I was going to say any help would be appreciated, but due to the nature
 of
 my vagueness as to what was updated, that question becomes a little
 moot.Or
 does it?

 Is there any way of finding out what exactly is triggering the scripts
 to
 run, specifically the second trigger.

 I am not even sure if the script finishes running and then restarts, or
 whether two instances of it are started at the same time.

 Cheers
 Alexis

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



 Take a look in C:\windows\tasks.

 Do you have a load of Copy of  versions?

 If you see multiple versions, just delete them.

 You may need to do this via a command prompt to see the copies.


 OK. When they run, are they running at the same time? If you check the
 scheduled task log file ... C:\WINDOWS\SchedLgu.TXT

 Take a look through the task setup. See if it has been set to run
 twice. On the Schedule tab, there is an option at the bottom - Show
 multiple schedules.

 If this option is set, then the top of the page has a drop down/list
 showing the scheduled versions. Are there more than 1? Is the checkbox
 checked?



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



 Can you cut and paste the command you are using for the task?


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



Re: [PHP] Unknown Table i field list

2010-10-11 Thread a...@ashleysheridan.co.uk
That's the same query.

One thing I did notice (and I wasn't sure if it was a typo as I saw a few in 
the original post) but you've used a period instead of a comma to separate the 
values in the query.

It shouldn't produce the error you're seeing, but sometimes you never know!

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: sueandant hollandsath...@tiscali.co.uk
Date: Mon, Oct 11, 2010 22:26
Subject: [PHP] Unknown Table i field list
To: Gary gp...@paulgdesigns.com
Cc: PHP php-general@lists.php.net


Have you tried :
$query = INSERT INTO formcom(fname, lname, email, comment, ip) VALUES
 ('$fname','$lname','$email'.'$comment','$ip')
 or die('error in query');
tholland
- Original Message - 
From: Gary gp...@paulgdesigns.com
To: php-general@lists.php.net
Sent: Monday, October 11, 2010 8:09 PM
Subject: [PHP] Unknown Table i field list


I am getting an error of unkown talbe formcom in field list.

 I dont understand this.  I have a talbe called formcom in the database, in 
 fact I created this talbe to replace the first one named comments just in 
 case the table name comments was not allowed.

 I have used this same script a number of time, this is the first time I am 
 getting this error

 Here is the scritpt


 $dbc = mysqli_connect('server','username',password','db name')
 or die('Error connecting to MySQL server');

 $query = INSERT INTO formcom(fname, lname, email, comment, ip) . VALUES 
 ('$fname','$lname','$email'.'$comment','$ip')
 or die('error in query');

 $result = mysqli_query($dbc, $query)
 or die('Error in Result');

 mysqli_close($dbc);

 I have also tried formcom.fname, formcom.lname, formcomemail, 
 formcomcomment, formcom.ip

 I have double triple quad checked to make sure I did not have comment and 
 comments mix up.

 Anyone be able to help me?

 Thank you

 Gary


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


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



Re: [PHP] PHP and HBCI?

2010-10-08 Thread a...@ashleysheridan.co.uk
How do you mean? Did you want to process payments? Or wad it more of an actual 
banking thing you needed? I've not heard of hbci before, so can't offer much 
information back.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Stephan Ebelt s...@shared-files.de
Date: Fri, Oct 8, 2010 13:37
Subject: [PHP] PHP and HBCI?
To: PHP php-general@lists.php.net


Hello,

is there a way to do HBCI banking with PHP?

stephan


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



Re: [PHP] Re: Continuance of the struggle (trying to understand)

2010-10-07 Thread a...@ashleysheridan.co.uk
It will only work if your listing supports php, but you should just be able to 
put the whole sure up on your hosting, give the upload directory the correct 
permissions ( its most likely a more secure Linux hosting than insecure windows 
hosting) 

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Col Day colind...@aol.com
Date: Thu, Oct 7, 2010 08:33
Subject: [PHP] Re: Continuance of the struggle (trying to understand)
To: php-general@lists.php.net

Morning all,

Apologies for the delay, I've just become a Dad for the first time so a 
little distracted!

If I explain exactly what I am trying to do then it may become clear as to 
where I'm going wrong.

Needless to say, new baby so want to show him off (Callum, 7lb4oz) so 
decided to buy a webname and pay for hosting, however money is a bit tight, 
so being adventurous (or stupid, not sure which yet) I set up apache on my 
laptop and started writing a website in Serif's WebPlus10. However I wanted 
to have an upload area on the site for friends and family to send their 
pictures of Callum (and the family and anything else they wanted) so there 
was a central store. However I tried to find some html to handle the 
upload of these files but wasn't able to work it out, google and various 
other bitsx of research on the net showed that I probably needed to run a 
script to do this and PHP seemed the simplest, so I downloaded PHP 5.3.3 and 
installed it.

This is where it started getting tricky as I was using the PHP for dummies 
book from 2006. I typed that piece of code in (direct from the book) but 
added it as an html attachment into my site I was building. Uploaded the 
site to my localhost and had a look. I only got the HTML line from the 
script. This is where I started contacting you bunch of fine programmers!

I have now learned that if I save the script as a .php file and navigate 
direct to it on localhost it works fine, but I think what I am trying to do 
is get it to work in an existing webpage so that I can then get my upload 
working.

Any help you can offer from explanantions to whole bits of code will be 
greatly received!

Many thanks!

Steve Staples sstap...@mnsi.net wrote in message 
news:1286281586.4703.63.ca...@webdev01...
 Col:

 If i am reading this correctly, then i think you're looking at this all
 wrong.

 If you're working within some kind of page, stored outside of the
 http://localhost served by apache, like say the .php file is on the
 desktop... then yeah, you're not going to get the PHP information
 displayed.

 (tech people bare with me here...)
 PHP pages, are compiled when called... so you need apache to call php
 and translate the PHP code so that if there is any output, it will
 display that output.

 If you're trying to show a .php file from teh desktop, then apache isn't
 handeling this request, and therefor has no idea that there is php code
 that has to be compiled, and therefore it will just ignore it.

 I am sure that I am goign to get flamed for that, but i think that it
 kinda simplifies what apache does for php.

 NOW... you can run a php file from the command line, but you're not
 going to get the HTML results as you would had you ran if from the
 localhost where apache knows what to do with a .php file.

 So... long story short, if you want PHP to display the PHP stuff, then
 you will need to have it interpreted by apache (or IIS, or whatever your
 web server software is) to have it spit back to a web browser client.

 Hopefully this makes sense, it is early here, i am just getting into
 work :(, and it made sense while i was typing it... but my coffee intake
 has not had time to work it's wonderful magic with me yet, so my
 thoughts may be scattered.

 Steve



 On Tue, 2010-10-05 at 12:57 +0100, Col Day wrote:
 LOL!

 This is WITH xammp!!



 Gary php-gene...@garydjones.name wrote in message
 news:i8f26m$j4...@dough.gmane.org...
  Col Day wrote:
  Col Day colind...@aol.com wrote in message
  news:23.81.45586.2820b...@pb1.pair.com...
 html
 head
 titlePHP Test/title
 /head
 body
 pThis is an HTML line
   /p !-- close your tag, you evil man! :-) --
 ?php
echo pThis is a PHP line/p;
phpinfo();
 ?
 /body
 /html
 
  If I paste this into a webpage I only get the HTML line as before.
 
  What do you mean, webpage? foo.php, for example, or foo.html? If the
  latter then I am guessing your Apache will serve the page purely as
  html, and it will never be processed by php. If the former then check
  that Apache is configured to run php files through php before serving
  them (must admit, I'm not sure how to do that, it depends on your 
  Apache
  and PHP). Or, really, just install xampp, it's by far the easiest way
  and will avoid all the problems associated with configuring two rather
  complex pieces of software.
 



 


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



Re: [PHP] tedd's Friday Post ($ per line)

2010-10-07 Thread a...@ashleysheridan.co.uk
Surely it would have been a bit more sensible to work out the time the 
programmer had spent on the project and then calculate it as a percentage of 
the total time that programmer would spend on it to complete it (which might 
not be the whole duration of the project)

Also, counting code lines seems unfair. I know it used to be this way, but its 
a bit like paying firemen based on the number of fires they put out; don't be 
surprised if arson figures go up!

I would guess though that this fellow likely had to pay some of that initial 
outlay of cash back though, and would further assume the total price attributed 
to each line was no more than 3 or 4 cents (damb English androids don't have 
the cent character)

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: tedd tedd.sperl...@gmail.com
Date: Thu, Oct 7, 2010 18:20
Subject: [PHP] tedd's Friday Post ($ per line)
To: php-general@lists.php.net

Hi gang:

Several years ago I was involved in a court case where a programmers 
work was being evaluated to establish a dollar amount for the work 
done.

The case was a dispute where the client wanted money back from a 
programmer for a discontinued project. The programmer simply wanted 
to be paid for the work he had done. This wasn't a case where anyone 
had done anything wrong, but rather a circumstance where two parties 
were trying to figure out who was due what.

You see, the original client had been taken over by another company 
who put a halt to the project the programmer was working on. The new 
company claimed that because the project wasn't finished, then the 
programmer should pay back all the money he was paid up-front to 
start the project. However, while the project had not been finished, 
the programmer had indeed worked on the project for several months.

The programmer stated he wanted to paid his hourly rate. But the new 
client stated that the up-front money paid had been based upon a bid 
and not an hourly rate. So, they were at odds as to what to do.

The solution in this case was to place a dollar amount on the actual 
lines of code the programmer wrote. In other words, they took all 
of programmers code and actually counted the lines of code he wrote 
and then agreed to a specific dollar amount to each line. In this 
case, the programmer had written over 25,000 lines of code. What do 
you think he was paid?

And with all of that said, what dollar amount would you place on your 
line of code?

Cheers,

tedd

-- 
---
http://sperling.com/

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



Re: [PHP] Syntax Error

2010-10-04 Thread a...@ashleysheridan.co.uk
Switching to pdo won't necessarily remove sql errors any more than using a php 
framework will remove php errors.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: kranthi kranthi...@gmail.com
Date: Mon, Oct 4, 2010 09:04
Subject: [PHP] Syntax Error
To: a...@ashleysheridan.co.uk
Cc: chris h chris...@gmail.com, Gary gp...@paulgdesigns.com, 
php-general@lists.php.net


As pointed out echo $insertSQl should help you locate many trivial
problems. But using PDO will avoid these kind of problems

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



Re: [PHP] Connecting to MySql with PHP

2010-10-04 Thread a...@ashleysheridan.co.uk
Have you installed the php mysql module? Basically, it tells php how to connect 
to mysql.

This question has come up a few times this week, have you tried installing 
something like xampp or easyphp rather than the individual software components: 
Apache, php  mysql.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: sueandant hollandsath...@tiscali.co.uk
Date: Mon, Oct 4, 2010 22:08
Subject: [PHP] Connecting to MySql with PHP
To: php-general@lists.php.net

I am running PHP 5.3.3, with Apache 2.0 Handler and MySql Server 5.1.   My OS 
is Vista Home Premium 32 bit with SP2.

MySql works fine from the command prompt, Apache is running and PHP works.   
But I cannot access the mysqli classes.   This simple program:

?php

$mysqli = new mysqli(localhost, root, ##, testDB);#I've 
deliberately obliterated the password

if (mysqli_connect_errno()) {
 printf(Connect failed: %s\n, mysqli_connect_error());
 exit();
} else {
 printf(Host information: %s\n, mysqli_get_host_info($mysqli));
}
?

produces this error message:

Warning: mysqli::mysqli() [mysqli.mysqli]: [2002] A connection attempt failed 
because the connected party did not (trying to connect via 
tcp://localhost:3306) in C:\Apache\htdocs\mysqlconnect.php on line 3

Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2002): A connection attempt 
failed because the connected party did not properly respond after a period of 
time, or established connection failed because connected host has failed to 
respond. in C:\Apache\htdocs\mysqlconnect.php on line 3

Fatal error: Maximum execution time of 30 seconds exceeded in 
C:\Apache\htdocs\mysqlconnect.php on line 3

I guess PHP cannot find the mysqli classes.   I've checked the phpinfo() output 
and discovered :

  Configuration File (php.ini) Path  C:\Windows  
  Loaded Configuration File  C:\PHP\php.ini  


I don't know if this ok.   I've tried changing the location of the loaded file 
to C:\Windows\php.ini, but to no avail, and I don't know how to change the 
location of the config file.

I am obviously doing something wrong, but I don't know what.   Can anyone help?

Ironically, everything worked perfectly before I upgraded to PHP 5.3.3!

Re: [PHP] Which PHP 5.3 documentation generators have you found?

2010-09-29 Thread a...@ashleysheridan.co.uk
Does phpDocumenter not do the trick? I must admit, I've not tried anything 
specific to 5.3 (i can imagine the namespace thing would be a major part if the 
documentation) but its served me well with other php5 code.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Adam Richardson simples...@gmail.com
Date: Wed, Sep 29, 2010 19:36
Subject: [PHP] Which PHP 5.3 documentation generators have you found?
To: PHP-General php-general@lists.php.net

Hi all,

Anybody know of a documentation generator which plays nicely with PHP 5.3?

Thanks,

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Php Newsletter script

2010-09-28 Thread a...@ashleysheridan.co.uk
Still hit and miss though, outlook is just one if many email clients out there.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Richard Quadling rquadl...@gmail.com
Date: Tue, Sep 28, 2010 10:17
Subject: [PHP] Php Newsletter script
To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk
Cc: David Mehler dave.meh...@gmail.com, php-general 
php-general@lists.php.net


On 27 September 2010 23:40, a...@ashleysheridan.co.uk
a...@ashleysheridan.co.uk wrote:
 It's probably worth noting that very few email clients in use actually 
 observe xhtml. When creating html emails you have to step back a half dozen 
 years for outlook, which is the current dominant client because of offices.

 Essentially, its back to basics, with tables for layout, font tags, and 
 little, if any, css. Images for layout are also hit and miss because of spam 
 protection.

 If you can't create a template yourself, you're best off looking for one 
 online that can be used in an email marketing system.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

 - Reply message -
 From: David Mehler dave.meh...@gmail.com
 Date: Mon, Sep 27, 2010 20:25
 Subject: [PHP] Php Newsletter script
 To: php-general php-general@lists.php.net

 Hello,
 I'm wondering if anyone could recommend a newsletter script they use
 and like? Some requirements I have are:

 1. Free preferred
 2. Can be used via a web browser
 3. Can put the newsletter submission on a web page
 4. Can use rss to feed that web page
 5. Produce Xhtml compliant code and integrate well with a site's existing css
 6. can optionally send that newsletter out as plain text or html

 Googling has not helped in this matter.
 Thanks.
 Dave.

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



You can embed images in emails and these are correctly shown in Outlook.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Array question

2010-09-26 Thread a...@ashleysheridan.co.uk
I'd also like to add to that:

$array = array();
$array[] = 'text';
$array[2] = 123;
$array[] = 'hello';

Would output:

$array(
0 = 'text',
2 = 123,
3 = 'hello',
);

Note the missing index 1, as php makes a numerical index that is one greater 
than the highest already in use. As the index 2 was explicitly created, php 
made the next one at 3.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: chris h chris...@gmail.com
Date: Sat, Sep 25, 2010 22:05
Subject: [PHP] Array question
To: MikeB mpbr...@gmail.com
Cc: php-general@lists.php.net


Mike,

$results[] will automatically push a value unto the end of an array.

So doing this...
--
$magic = array();
$magic[] = 'a';
$magic[] = 'b';
$magic[] = 'c';
-

is exactly this same as doing this...
--
$normal = array();
$normal[0] = 'a';
$normal[1] = 'b';
$normal[2] = 'c';
-

And yes, in your example $results[] would be equivalent to $results[$j]


For more reference:
http://www.php.net/manual/en/language.types.array.php


Chris H.


On Sat, Sep 25, 2010 at 4:31 PM, MikeB mpbr...@gmail.com wrote:

 I have the following code:

 $query = SELECT * FROM classics;
 $result = mysql_query($query);

 if (!$result) die (Database access failed:  . mysql_error());
 $rows = mysql_num_rows($result);

 for ($j = 0 ; $j  $rows ; ++$j)
 {
$results[] = mysql_fetch_array($result);
 }

 mysql_close($db_server);

 My question, in the loop, why does tha author use:

 $results[] = mysql_fetch_array($result);

 instead of (as I would expect):

 $results[$j] = mysql_fetch_array($result);?

 What PHP magic is at work here?

 Thanks.


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




Re: [PHP] module add on Suse 10.3

2010-09-23 Thread a...@ashleysheridan.co.uk
Suse uses yast2 iirc, which you can use to list and install php modules. Search 
for 'php' in yast software manager module.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Patrick Serru patr...@serru.net
Date: Thu, Sep 23, 2010 14:06
Subject: [PHP] module add on Suse 10.3
To: PHP General php-general@lists.php.net

  Hi everybody,

  I am using Open 10.3 with KDE 3.5.10 on an x86_64 system. I want to 
use the function http_post_data() from module pecl_http (in a script 
called from shell, which could be an important detail...). And did not 
succed!

  Is Open Suse repertories organised such a way that standard 
installation as read on the web (in the http://www.php.net/manual/ pages) 
does not work ?

  I allready gaveup in the past with an other module, that I just wanted 
to evaluate (gtk2). But now, it hangs!

  
 cd /home/me/bin/PHP/php-5.3.3/ext
 pecl download pecl_http
this gives a /home/me/bin/PHP/php-5.3.3/ext/pecl_http-1.7.0.tar file 
(uncompresssed) extraction with xml file inside, then:
 cd /home/me/bin/PHP/php-5.3.3
 rm configure
 ./buildconf --force
 ./configure --with-pecl_http
 make
# make install

(I did not see problem...)Then I try to execute a file containing:

#!/usr/bin/php --interactive
? /** bla-bla */

  $resp=http_post_data(
... );
...

and the result is:
PHP Fatal error:  Call to undefined function http_post_data() 
in /home/me/Developpements/Mes_scripts_php/essais_post_2_site.php on line 
88

  The computer is personnal and for local developement, which means that 
the module could be installed as part of PHP (cli | cgi) or as dynamicaly 
loadable  module...

  Thank for the time spent reading my mail
Patrick

NB I dont know since which try I got this mesage, at startup:

« Unable to load dynamic 
library '/usr/lib64/php5/extensions/pecl_http.so' - 
/usr/lib64/php5/extensions/pecl_http.so: 
cannot open shared object file: No such file or directory in Unknown on 
line 0 »

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



Re: [PHP] module add on Suse 10.3

2010-09-23 Thread a...@ashleysheridan.co.uk
Iirc isn't the module to look for, it means if I remember correctly!

Search for php and you should see the various available modules.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Patrick Serru patr...@serru.net
Date: Thu, Sep 23, 2010 16:47
Subject: [PHP] module add on Suse 10.3
To: php-general@lists.php.net

Le jeudi 23 septembre 2010, a...@ashleysheridan.co.uk a écrit :
 Suse uses yast2 iirc, which you can use to list and install php modules.
 Search for 'php' in yast software manager module. 
--
  Thanks Ash,

  I id'nt find any iirc software / module... I relatively well know 
yast2 (since yast [SüSE 6.x]!). Are you sure about this iirc or is it 
a souvenir. I would like some sowtware to tell me the currently PHP 
installed modules!

  I really dont know where to look. The generated make file is so easy 
to read! I need to know how PHP installs it self. Usualy, the processes 
discripted in a software documentation for installation / modification work 
with open suse, but here... I am ready to reinstall all but this is risky: 
I would like apache to continue running correctly!

Patrick

-- 
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-11 Thread a...@ashleysheridan.co.uk
If you want to prevent certain extensions then just flirt then out from the 
$_FILES array before you copy them out of the temp directory, as that is where 
they should be uploaded ready for your script to process.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Richard Quadling rquadl...@gmail.com
Date: Sat, Sep 11, 2010 11:11
Subject: [PHP] Disabling an extension on a perdir basis.
To: PHP General list php-general@lists.php.net

Hi.

Can't seem to see a way to do this.

Is there a way to do this?

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Elegance is the goal... Sticky form submit help

2010-09-11 Thread a...@ashleysheridan.co.uk
For a month selector, using a loop to output the months is good, as you can 
then within the loop check for that value sent and set the selected html 
attribute for that select element.

I should warn you that your code will throw a warning when no data has been 
posted to it. Consider using isset() instead to check for posted values rather 
than comparing a value (which might not exist) with true.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Jason Pruim li...@pruimphotography.com
Date: Sat, Sep 11, 2010 14:49
Subject: [PHP] Elegance is the goal... Sticky form submit help
To: PHP-General list php-general@lists.php.net

Hey everyone!

Hope you are having a great weekend, and I'm hoping someone might be  
coherent enough to help me find a more elegant solution to a problem  
that I have...

I have a form for submitting an event to a website, and if the form is  
not submitted successfully (such as they didn't fill out a required  
field) I want it to redisplay the form with inline errors as to what  
happened and display the values they selected...

I have a working solution but was hoping for something a little more  
elegant. And something that would work better for a month selector as  
well... Here is the relevant code that I have that works:

?PHP
 if ($_POST['hidSubmit'] ==TRUE  $_POST['type'] == meeting):
echo HTML
 select name=type id=type
 option value=0-- select type --/option
 option value=meeting selectedMeeting/option
 option value=event Event/option
 /select
HTML;

elseif ($_POST['hidSubmit'] == TRUE  $_POST['type'] == event):
//if ($_POST['hidSubmit'] == TRUE  $_POST['type'] == event) {

echo HTML
 select name=type id=type
 option value=0-- select type --/option
 option value=meetingMeeting/option
 option value=event selectedEvent/option
 /select
HTML;

else:
//if ($_POST['hidSubmit'] != TRUE):


echo HTML
 select name=type id=type
 option value=0 selected-- select type --/option
 option value=meetingMeeting/option
 option value=eventEvent/option
 /select
HTML;
endif;

?

which works BUT I don't want to have to have that for a month selector  
or a day selector :)

Any ideas what I'm missing?



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



Re: [PHP] newbie question about code

2010-09-10 Thread a...@ashleysheridan.co.uk
It's object oriented code. $code is an instance of class, and do_command() is a 
method if that class. I'd advise reading up on oop php.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Adam Williams adam_willi...@bellsouth.net
Date: Fri, Sep 10, 2010 19:27
Subject: [PHP] newbie question about code
To: PHP General list php-general@lists.php.net

I'm looking at someone's code to learn and I'm relatively new to 
programming.  In the code I see commands like:

$code-do_command();

I'm not really sure what that means.  How would that look in procedural 
style programming?  do_command($code); or something else?


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



Re: [PHP] newbie question about code

2010-09-10 Thread a...@ashleysheridan.co.uk
Node.js, wouldn't that be javascript rather than java?  :P

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Joshua Kehn josh.k...@gmail.com
Date: Fri, Sep 10, 2010 19:32
Subject: [PHP] newbie question about code
To: Bob McConnell r...@cbord.com
Cc: Adam Williams adam_willi...@bellsouth.net, PHP General list 
php-general@lists.php.net


Bob-

Yes, yes I did.

And note that my Java code is incorrect, that should simply be public static 
void, no function.

This is what I get for taking a week to code everything in Node.js. 

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com

On Sep 10, 2010, at 2:32 PM, Bob McConnell wrote:

 Did you mean to say That is a method call.?
 
 Bob McConnell
 
 -
 From: Joshua Kehn
 
 That is a function call. In Java:
 
 class Code
 {
public static void function do_command(){ }
 }
 
 Code.do_command();
 
 Regards,
 
 -Josh
 
 Joshua Kehn | josh.k...@gmail.com
 http://joshuakehn.com
 
 On Sep 10, 2010, at 2:27 PM, Adam Williams wrote:
 
 I'm looking at someone's code to learn and I'm relatively new to
 programming.  In the code I see commands like:
 
 $code-do_command();
 
 I'm not really sure what that means.  How would that look in
 procedural style programming?  do_command($code); or something else?
 


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



Re: [PHP] Broken pipes, time outs, PHP, and mail

2010-09-08 Thread a...@ashleysheridan.co.uk
Could it be that there are connection limits on the remote server?

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Bob McConnell r...@cbord.com
Date: Wed, Sep 8, 2010 18:24
Subject: [PHP] Broken pipes, time outs, PHP, and mail
To: php-general@lists.php.net

From: Dave M G

 I have a set of scripts that sends out emails to a list of about 150 
 people. Sometimes it works fine.
 
 Other times, it dies part way through the list, and in my error logs I

 get this output:
 
 fputs() [a href='function.fputs'function.fputs/a]: send of 22
bytes 
 failed with errno=32 Broken pipe /public_html/class.smtp.php 489
 
 The code that sends the mail is derived from here:
 http://www.phpclasses.org/browse/file/920.html
 
 It's mostly rock solid code, so far as I know, so I suspect the
problem 
 to more with my server settings or something.
 
 That said, I don't know what differentiates a failed mailing and a 
 successful one.
 
 After a Google search, it seems broken pipes are a matter of time 
 outs. That's about as far as I understand it, though.
 
 Can anyone throw me a tip as to how I might diagnose this problem?

Broken pipe is a euphemism for Network error. There are any number
of causes including the remote server closing the socket, a switch or
hub between here and there is bogged down by backup traffic, or a
segment your connection passes through became too busy with higher
priority video traffic. The actual details are difficult to determine
and none of the administrators involved will ever admit they had a
problem. In most cases the TCP/IP error will simply tell you it timed
out waiting for a response. Your code should be able to re-open the
connection at this point and resend the message that triggered the
error. Then resume working on the rest of your list.

Bob McConnell

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



Re: [PHP] Broken pipes, time outs, PHP, and mail

2010-09-08 Thread a...@ashleysheridan.co.uk
In order to help we really need to have a look at the code in question. You say 
the code is derived from another class you downloaded. Are you able to post the 
important bits of it in an email, or put it all on a pastebin?

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Dave M G mar...@autotelic.com
Date: Wed, Sep 8, 2010 18:45
Subject: [PHP] Broken pipes, time outs, PHP, and mail
To: php-general@lists.php.net

Bob,

Thank you for replying.

 Your code should be able to re-open the
 connection at this point and resend the message that triggered the
 error. Then resume working on the rest of your list.

Unfortunately, it seems that this is not happening. The loop that sends 
out individual mail dies, and the remaining mails stop being sent.

Is there perhaps some way I can force the PHP code to ignore the one 
mailing that failed and continue with the rest?

-- 
Dave M G

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



Re: [PHP] Error in initialising XML parser

2010-09-06 Thread a...@ashleysheridan.co.uk
PHO won't automatically include a class file by default. You either need to 
manually include it with a require, include it or require_once line, or use an 
automagical include script. As it stands, you're getting the error because php 
doesn't know where your class is.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Sridhar Pandurangiah sridharpa...@gmail.com
Date: Mon, Sep 6, 2010 09:12
Subject: [PHP] Error in initialising XML parser
To: php-general@lists.php.net

Hi

I am writing a PHP snippet to display invoices that is generated by 
another computer application. The use case is as follows

1. The other computer application generates the invoices for the month 
in XML and puts it in a common dirctory. So at anytime there could be 
multiple files. Each file contains several invoices. These invoices are 
for different vendors.
2. My PHP snippet will list all the files in the directory. I have got 
this part right after a lot of research, phew! It displays only xml 
files and keeps out the others like files begining with . (dot) etc. 
This is listed as a series of checkboxes so that the user can view the 
list of invoices available. Once the user clicks on the checkboxes I 
POST the file name to the server with the following code

$BillLocation = /home/cmi/Integration/xml_files;
$StyleSheet = Bill.xsl;
$DirHandle = opendir($BillLocation);

if ($_POST['_submit_check'])
{
$MyBill = new Displaybill($_POST[BillChosen]);
$MyBill-parse($_POST[BillChosen]);
$MyBill-Show_Bill($MemberId, $StyleSheet);
}
{
$result = List_Directory($DirHandle);

}

I get a following error Fatal error: Class 'Displaybill' not found in 
/home/sridhar/Sastra/2010-ClubMan-Integration/ListAvailableBills.php on 
line 15

I have the Displaybill class in the same location as the other file 
still PHP is not able to locate it. What could be wrong? Any help would 
be appreciated.

Running the whole thing on localhost with the vhosts configured to teh 
above directory.

Best regards

Sridhar

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



Re: [PHP] Hi

2010-09-06 Thread a...@ashleysheridan.co.uk
I think you should not focus so much on the file extension, as that is mostly 
meaningless if someone wanted to attack your system.

Instead, you could wrap a call to the command line 'file' command, which gives 
mostly accurate information about a file. Basically it reads the first few 
bytes to see it is what it expected. There is a php wrapper for this, but I 
forget what its called just now.

If you do need to just grab a file extension though, you can do it with a call 
to pathinfo() with the 2nd argument of PATHINFO_EXTENSION.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Jordan Jovanov jovanovj...@gmail.com
Date: Mon, Sep 6, 2010 14:46
Subject: [PHP] Hi
To: php-general@lists.php.net
Cc: jovanovj...@gmail.com


Hi All

I need me a little help.
I create scripte for upload file is work very good but the problem is next:
I neet to upload only .zip file i need to disable some user to shoise to 
upload another file Extensions.

Can somebody help me.

Thanks a lot.

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



Re: [PHP] Hi

2010-09-06 Thread a...@ashleysheridan.co.uk
As far as I can remember It's supplied by the client user agent, hence the big 
issue with jpeg images uploaded by IE, as it uses a different type to all the 
other browsers.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Richard Quadling rquadl...@gmail.com
Date: Mon, Sep 6, 2010 16:13
Subject: [PHP] Hi
To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk
Cc: Jordan Jovanov jovanovj...@gmail.com, php-general@lists.php.net


On 6 September 2010 15:04, a...@ashleysheridan.co.uk
a...@ashleysheridan.co.uk wrote:
 I think you should not focus so much on the file extension, as that is mostly 
 meaningless if someone wanted to attack your system.

 Instead, you could wrap a call to the command line 'file' command, which 
 gives mostly accurate information about a file. Basically it reads the first 
 few bytes to see it is what it expected. There is a php wrapper for this, but 
 I forget what its called just now.

 If you do need to just grab a file extension though, you can do it with a 
 call to pathinfo() with the 2nd argument of PATHINFO_EXTENSION.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

 - Reply message -
 From: Jordan Jovanov jovanovj...@gmail.com
 Date: Mon, Sep 6, 2010 14:46
 Subject: [PHP] Hi
 To: php-general@lists.php.net
 Cc: jovanovj...@gmail.com


 Hi All

 I need me a little help.
 I create scripte for upload file is work very good but the problem is next:
 I neet to upload only .zip file i need to disable some user to shoise to
 upload another file Extensions.

 Can somebody help me.

 Thanks a lot.

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



How is the ['type'] arrived at within PHP. Is this supplied by the web
server? Or does PHP have to work it out before passing it to userland
code?

Either way, is it not accurate enough?

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY


Re: [PHP] a test (list is too quite)

2010-09-04 Thread a...@ashleysheridan.co.uk
http://www.bash.org/?quote=76416

Meant to post this on Friday, but it works well here too!

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: chris h chris...@gmail.com
Date: Sat, Sep 4, 2010 19:42
Subject: [PHP] a test (list is too quite)
To: php-general@lists.php.net

On Sat, Sep 4, 2010 at 2:24 PM, Marc Guay marc.g...@gmail.com wrote:

 Can I make a facebook site using PHP?  If yes, how?

 Please send me the infos privately.

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



I'm also trying to make a Facebook site using PHP; but I want mine
to incorporate all the elements from YouTube, Twitter, and Wikipedia... Also
I want it to be ecommerce so I can sell t-shirts with my picture on them...
Also I want it to be an auction site.  Hmm, maybe Wordpress can do this