php-general Digest 8 Jan 2008 14:10:41 -0000 Issue 5223

2008-01-08 Thread php-general-digest-help

php-general Digest 8 Jan 2008 14:10:41 - Issue 5223

Topics (messages 266863 through 266874):

Re: is_executable() ???
266863 by: Anup Shukla

Re: Byte Size of an array
266864 by: Chris

Re: how can i use zend framework view helper in smarty?
266865 by: Chris

Re: Float Value Parse Problem
266866 by: Chris

Re: ./configure APC problems with 3.0.16 and what happened to 
--enable-apc-pthreadmutex???
266867 by: Chris

Re: First stupid post of the year. [SOLVED]
266868 by: Zoltán Németh

Re: utf-8 in $_POST
266869 by: pobox.verysmall.org
266870 by: Arvids Godjuks
266871 by: Per Jessen

Re: Mail system
266872 by: Michelle Konzack
266873 by: Michelle Konzack

Re: global address collection
266874 by: Satyam

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---

Al wrote:

clearstatcache();
if(is_executable(PATH_TO_SOURCE_DIR . $filename)
{
code
}


is_executable() will only tell if the execute bit is set for the 
provided file.




Always returns true for:
foo.jpg
foo.php
foo.sh

And even if I feed it a non existing file.


Checking on a non-existing file basically is checking for the directory.
PATH_TO_SOURCE_DIR . $filename == PATH_TO_SOURCE_DIR if $filename == 

Directories generally have the permission 0755 which means they have the 
execute bit set, and hence the true result.




I found one ref that said is_executable() doesn't work in safemode, 
seems dumb if true.


If that's so, how can I test whether an uploaded file is executable?


Any file, under unix can be executable if the execute bit in the file 
permissions is set.


Make sure you umask settings are correct, so that files created do not 
have the execute bit set or use chmod on the file after uploading.


If you intend to find if the file is an executable in the Windows 
sense... is_executable() will not help you.


Try examining the mime type of the file.. (PECL::Fileinfo),
though it may of be of little help.

Additionally, using is_uploaded_file() and move_uploaded_file() 
functions is recommended while dealing with uploaded content.




I'm on a NIX with Apache, etc.




--
Regards,
Anup Shukla
---End Message---
---BeginMessage---

Sancar Saran wrote:

Hello,

I just wonder to how can I find a memory size of an array.


wild guess
echo strlen(serialize($array));
/wild guess

--
Postgresql  php tutorials
http://www.designmagick.com/
---End Message---
---BeginMessage---
Wan Chaowei wrote:
 hello all:
 my boss want use zend framework with smarty. if i don't use view helper
 in smarty, it's easy to do it, but how can i use zend framework view
 helper in smarty?

Probably best to ask the zend-framework list(s):

http://framework.zend.com/community

-- 
Postgresql  php tutorials
http://www.designmagick.com/
---End Message---
---BeginMessage---

Cyril Chacko wrote:

Hi,

I have created a class and passing a float value to a method in it. I
have checked the the argument values in the method. The passed
argument has the proper value. However, on any arithmetic operation
the float as a whole is rounded off.


http://php.net/float

There is a message there about precision problems.

--
Postgresql  php tutorials
http://www.designmagick.com/
---End Message---
---BeginMessage---

steve wrote:

When configuring APC 3.0.16 I see this, which I don't recall seeing before:

checking dlfcn.h presence... no
configure: WARNING: dlfcn.h: accepted by the compiler, rejected by the
preprocessor!
configure: WARNING: dlfcn.h: proceeding with the compiler's result
checking for dlfcn.h... yes

Also --enable-apc-pthreadmutex no longer seems to work (it is no
longer in ./configure --help and in phpinfo it says it is using file
locks).

Is the warning above causing a problem or was
--enable-apc-pthreadmutex pulled out???


You'll probably get better help from the pecl list:

http://pecl.php.net/support.php#lists

--
Postgresql  php tutorials
http://www.designmagick.com/
---End Message---
---BeginMessage---
2008. 01. 7, hétfő keltezéssel 12.14-kor tedd ezt írta:
 At 4:36 PM +0100 1/7/08, Zoltán Németh wrote:
 2008. 01. 7, hétf‘ keltezéssel 10.29-kor tedd ezt írta:
 however, on firefox with encoding auto-detection both page looks
 correctly and the same.
 
 greets
 Zoltán Németh
 
 Not that you are claiming otherwise, but FF will 
 render the pages incorrectly if the text encoding 
 isn't correctly set -- and that's the point.
 
 Look at this in FF with text encoding set to ISO-8859:
 
 http://luden.se/test/t-utf8.html
 

sure. if you force an encoding on FF, you will sooner or later meet
pages which will look as garbage because they use another encoding.
however if FF is set to auto-detect encoding AND the page sends the
correct header/meta 

Re: [PHP] First stupid post of the year. [SOLVED]

2008-01-08 Thread Zoltán Németh
2008. 01. 7, hétfő keltezéssel 12.14-kor tedd ezt írta:
 At 4:36 PM +0100 1/7/08, Zoltán Németh wrote:
 2008. 01. 7, hétf‘ keltezéssel 10.29-kor tedd ezt írta:
 however, on firefox with encoding auto-detection both page looks
 correctly and the same.
 
 greets
 Zoltán Németh
 
 Not that you are claiming otherwise, but FF will 
 render the pages incorrectly if the text encoding 
 isn't correctly set -- and that's the point.
 
 Look at this in FF with text encoding set to ISO-8859:
 
 http://luden.se/test/t-utf8.html
 

sure. if you force an encoding on FF, you will sooner or later meet
pages which will look as garbage because they use another encoding.
however if FF is set to auto-detect encoding AND the page sends the
correct header/meta tag info, the page is usually displayed correctly.

greets
Zoltán Németh

 Cheers,
 
 tedd
 
 -- 
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com
 

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



Re: [PHP] utf-8 in $_POST

2008-01-08 Thread [EMAIL PROTECTED]

Olav Mørkrid wrote:

i specify iso-8859-1 in both header and body:

meta http-equiv=Content-type content=text/html; charset=iso-8859-1/
form action=/ method=post accept-charset=iso-8859-1

if two different people post the norwegian phrase Godt nytt år
(happy new year), it may appear in the following variations:

[CONTENT_TYPE] = application/x-www-form-urlencoded;charset=iso-8859-1
$_POST[input] = Godt nytt år

[CONTENT_TYPE] = application/x-www-form-urlencoded;charset=utf-8
$_POST[input] = Godt nytt år


Hm... What User Agents? Are there User Agents that do not follow the 
instructions?



i was just wondering if php had some setting or function that would
make it auto-convert $_POST data into one specific encoding.


I have been banging my head over this some time ago. The main problem I 
had at that time is that I could not find a reliable way to detect the 
incoming encoding, which is the base of conversion.


If the User Agents are so unstable, you can't expect consistent error, 
but you should be prepared for all kind of deviations.



otherwise
i seem forced to do something like this in the beginning of my php
script:

if(ereg(utf-8, $_SERVER[CONTENT_TYPE])) {
  foreach($_POST as $key = $value)
 $_POST[key] = convert_utf8_to_iso8859($value);
}


As said above, you assume that the inconsistency will persist. And this 
assumption is not stable, as it seems the User Agents do not follow the 
instructions you sent to them.


I would agree with the others and advice you to switch to UTF-8 - this 
is the only encoding, where you can handle multiple alphabets _without_ 
knowing which alphabet it is.


Iv

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



Re: [PHP] utf-8 in $_POST

2008-01-08 Thread Per Jessen
Olav Mørkrid wrote:

 i specify iso-8859-1 in both header and body:
 
 meta http-equiv=Content-type content=text/html;
 charset=iso-8859-1/ form action=/ method=post
 accept-charset=iso-8859-1

Have you checked 1) what the webserver sends in the header and 2) what
the browser actually uses?  I'm pretty certain I've had issues where
the meta tags were fine, but the server overrode me settings in the
header.


/Per Jessen, Zürich

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



Re: [PHP] utf-8 in $_POST

2008-01-08 Thread Arvids Godjuks
To author:

You'r going the wrong way.
Make your page utf-8, all text on it. Set utf-8 encoding and treat all
incoming data as UTF-8. If some agent (definetly not some browser - they all
know UTF-8) doesn't understand that (that could be some hacker writing
it's own bot) - that's his problem. Then you will get all data incoming in
utf-8 and you can just add, modify and select it in and from database (don't
forget to set database and tables to UTF-8, that is default in MySQL 4.1 and
above).

If you have to deal with utf-8 data, you need the mb_string extension, see
manual.


Re: SV: [PHP] Mail system

2008-01-08 Thread Michelle Konzack
Am 2007-12-30 21:51:21, schrieb mattias:
 First of all
 If you have a bad day don't send to the list

I think not, since ONLY you know your system and I guess, you are using
some some webinterface (apache/php)...

It is DEFINITIVLY up to you, to implement the solution for YOUR system.
I have such signup-system too, but it would not fit your needs...

Thanks, Greetings and nice Day
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSN LinuxMichi
0033/6/6192519367100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: SV: SV: [PHP] Mail system

2008-01-08 Thread Michelle Konzack
Am 2007-12-30 22:10:50, schrieb mattias:
 Yes but i are newbie in php
 I think i should use php exec but i dont know no more

I use apache with php5 and su-php...

Thanks, Greetings and nice Day
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
# Debian GNU/Linux Consultant #
Michelle Konzack   Apt. 917  ICQ #328449886
   50, rue de Soultz MSN LinuxMichi
0033/6/6192519367100 Strasbourg/France   IRC #Debian (irc.icq.com)


signature.pgp
Description: Digital signature


Re: [PHP] Byte Size of an array

2008-01-08 Thread Eric Butera
On Jan 7, 2008 3:45 AM, Sancar Saran [EMAIL PROTECTED] wrote:
 Hello,

 I just wonder to how can I find a memory size of an array.

 Regards

 Sancar

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



If you're wondering how much memory your array is taking up engine
wise you can do a few little tests.  Of course you could do the echo
serialize form but that isn't going to tell you how much memory it
uses internally within the engine itself.  Granted this might not
either, but it is at least a little closer.

var_dump(memory_get_usage());

$array = array(
 1 = 'one',
 2 = 'two',
 3 = 'three'
);

var_dump(memory_get_usage());

Output:
int(53464)
int(53928)


Also Xdebug trace:
Version: 2.0.0
TRACE START [2008-01-08 14:13:17]
1   0   0   0.00435551968   {main}  1
 /Users/eric/Sites/blah.php  0
1   0   1   0.00483352328
0.0052  23184
TRACE END   [2008-01-08 14:13:17]

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



Re: [PHP] global address collection

2008-01-08 Thread Satyam

Actually, phone numbers should not be prefixed with 00.  The prefix for
international dialing depends on the local phone regulations and it is
different in different countries (for example, 011 in the USA).  The
recommendation from the telephone union (http://www.itu.int/) is to use  a
plus sign to indicate that the phone number starts with the country prefix.
Thus, it would be: +44 1623 123456 or +1 408 555 1212.  Americans also get
often confused because the first 1 is both the country code for the US,
Canada and a good chunk of the Caribbean and it is, at the same time, the
prefix they use to dial national long distance.  That's why the + is
important.

In most of the world, the leading zeros are like ../.  You can thing of 
local phone numbers as your current directory.  If you want to dial another 
area code, you first dial a zero, which is like using ../ in a file system, 
and then the area code, like the folder for that local number folder.  If 
you want to dial international, you dial 00, which is like doing ../../, 
which gets you to the world root (eventually there might be three zeros to 
dial interplanetary!) and then dial the 'folder name' of the other country. 
Which reminds me of an observation by Arthur C Clarke that once humankind 
becomes an intergalactic civilization each group will lose communication 
with the rest, can you just imagine what phone numbers might be!  (Brits 
always had a peculiar sense of humor)


There is no mandatory format to separate international dialing prefix,
country code, area code and actual number, it is better to have them
separated at least with a blank space, but there is no standard regarding
that and none should automatically impossed, the spacing provided by the
user should be respected.  Once again Americans are use to see their numbers
as 1-408-555-1212 because all their area codes are 3 digits long and all the
local numbers contain 7 digits grouped as 3 and 4, but most countries use a
variable number of digits for area codes so only the person who entered the
number can know how to split it.  Do not delete the whitespace and then
reformat the numbers assuming a fixed format because none actually exists.
Tables of international dialing codes are available just googling around
(for example, http://www.kropla.com/dialcode.htm), it is not a bad idea to
check country against the first part of the phone number but then, a warning
is all you could possibly issue since a person might have a postal address
in, say, Monaco (+377) and a French mobile (+33). I wouldn't imagine that
the Vatican has a separate mobile network from that of Rome so though they
have an international prefix different from that of Italy which they might
use for their land lines, their mobiles are probably Italian.

Also, it should be  Province/County/State, and it should be optional since
some cities are autonomous (usuall federal capital cities), just don't make
it mandatory.  And don't force anything on postal codes.  Some countries
have letters in them and the number of characters varies.  I just hate it
when they ask to enter the full 9 digit zip code.

Satyam


- Original Message - 
From: Richard Heyes [EMAIL PROTECTED]

To: tedd [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, January 07, 2008 11:56 PM
Subject: Re: [PHP] global address collection


In other words, in the USA we ask for name, address, city, state, zip, 
and phone number. What would be a global equivalent that could cover all 
(or most) address and phone numbers?


Full name (optionally forename/surname)
Address 1
Address 2 (optional)
Address 3 (optional)
Town/City
County/State
Postal/Zip code
Country

Full international phone number (eg. 0044 1623 123456)

--
Richard Heyes
http://www.websupportsolutions.co.uk

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

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

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



--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 
269.17.13/1212 - Release Date: 06/01/2008 22:55





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



Re: [PHP] global address collection

2008-01-08 Thread Eric Butera
On Jan 8, 2008 10:08 AM, tedd [EMAIL PROTECTED] wrote:
 I just finished a credit card portion for a site where the programmer
 before me required the customers to enter their credit card number
 without spaces -- why?  It's a simple matter to remove spaces for
 processing -- why throw that responsibility on the user?

I agree that removing spaces really isn't a huge deal, but aside from
that I don't think there should be any other modification.  I've seen
code that will regex out anything but numbers.  I think this is bad
practice because we as programmers should validate, not modify data.
Anything above and beyond that is sticking your neck out too far and
will lead to problems sooner or later.

What if the user mistyped what they intended?  If the script just
validates it will see the user accidently typed in a letter in the
field and re-display it asking for numbers only.  If it strips out the
letters, then you've just sent the potentially invalid number to the
gateway which in the end will be a charge against the client for a
failed attempt.

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



Re: [PHP] passing _GET values to _POST

2008-01-08 Thread Philip Thompson

On Jan 7, 2008, at 7:20 PM, Mary Anderson wrote:


Hi all,

  I have a screen get_collection.php which is supposed to be used to  
select something called 'data sets'.  My database (the postgres  
database is not the problem, PHP is) has an entity called 'data  
series' which has a child entity called 'data sets'.  The user is  
first shown a list of all the data series.  He selects a subset and  
pushes a submit button. The database supplies the names of the  
children of the selected data series, which are then displayed in  
the scrolling list called 'data sets'.


  My problem is getting the various screens in my application to  
talk to each other.   I have another screen called  
edit_reference.php which is used to edit a reference with an id  
re_reference_id.  Midway through this screen I want to link the  
reference of re_reference_id to data series and data sets chosen by  
the user by following a link from edit_reference.php to  
get_collection.php.


  I thought I could just give re_reference_id to get_collection as  
an url variable.  Unfortunately, this doesn't work.  Pushing the  
submit button to actually select the data series of interest causes  
the $_GET to be forgotten.  Printing the value of re_reference_id in  
a hidden inpput field -- which I thought for sure would end up in  
the $_POST array when I hit the get_data_series submit button  
doesn't work either.

Neither does just saying $_POST['re_reference_id'] = $re_reference_id.

  Probably I should be using session variables here.  But I think  
they will have their own problems since they will be written on  
edit_reference.php, remembered long after the call to  
get_collections, and may cause trouble later.



My page is

http://www.demog.berkeley.edu/~maryfran/memdev/get_collection.php?re_reference_id=74

I am going to attach the php code and hope it makes it through.

Mary Anderson




Richard had some good directions. I'll show you how to send a variable  
via GET AND POST in this basic example (which has not been tested, but  
should work)...


[Some HTML Page]
html
...
form action=get_collection.php?re_reference_id_get=74 method=post
input type=hidden name=re_reference_id_post value=74 /
input type=submit value=Go get it! /
input type=hidden name=submitted value=1 /
/form
...
/html

[get_collection.php]
?php
if (isset ($_POST['submitted'])) {
echo POST: re_reference_id = . 
$_POST['re_reference_id_post'].br/;

echo GET: re_reference_id = .$_GET['re_reference_id_get'];
echo pre;
print_r ($_POST);
print_r ($_GET);
echo /pre;
}
?

If you tried this previously and it didn't work, then you may have  
some bigger issues with the PHP installation. Otherwise, this *should*  
work. Hope this helps!


~Philip

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



Re: [PHP] global address collection

2008-01-08 Thread tedd

At 3:10 PM +0100 1/8/08, Satyam wrote:

Also, it should be  Province/County/State, and it should be optional since
some cities are autonomous (usuall federal capital cities), just don't make
it mandatory.  And don't force anything on postal codes.  Some countries
have letters in them and the number of characters varies.  I just hate it
when they ask to enter the full 9 digit zip code.

Satyam


Satyan:

Thanks very much for your most detailed global telephone number 
information -- very informative.


I also hate it when forms force you to do something that's not 
necessary. For example:


http://support.theflip.com/generalcustomerservice

requires you to enter your phone number in the format of 
xxx-xxx-, but list their phone number as (888) 222-6689. Using 
that format, they couldn't send themselves a message. Plus they 
advertise 4 hour response yet have failed to answer any of my emails 
sent over the last two weeks.


I had one form recently that said Click the box if the billing 
address and shipping address are the same and then if you clicked 
it, then the form made you fill out both sections -- I went elsewhere 
for my purchase.


I just finished a credit card portion for a site where the programmer 
before me required the customers to enter their credit card number 
without spaces -- why?  It's a simple matter to remove spaces for 
processing -- why throw that responsibility on the user?


The best design for a form comes from using it.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] global address collection

2008-01-08 Thread Richard Heyes

The best design for a form comes from using it.


To a certain extent, but I think the best design for a form stems from 
watching someone else use it.


--
Richard Heyes
http://www.websupportsolutions.co.uk

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

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

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



Re: [PHP] global address collection

2008-01-08 Thread Lester Caine

Satyam wrote:
Telephone stuff is comprehensive


Also, it should be  Province/County/State, and it should be optional since
some cities are autonomous (usuall federal capital cities), just don't make
it mandatory.  And don't force anything on postal codes.  Some countries
have letters in them and the number of characters varies.  I just hate it
when they ask to enter the full 9 digit zip code.

Another area of difficulty is the SIZE of the 'Address' fields.
While in the UK House number + Postcode should be all that you need, if you 
have named flats in a named building in a development in an area of say 
London, then the address 1/2/3 fields can be quite full. Add commercial 
premises on an industrial state and you get similar problems. Some parts will 
need to be combined on one line, and I'm now finding even 80 character entries 
can be a problem :(

Oh for XML and the ability to add 'extra' 'Address' lines :)


Full name (optionally forename/surname)
Address 1
Address 2 (optional)
Address 3 (optional)
Town/City
County/State
Postal/Zip code
Country

Full international phone number (eg. 0044 1623 123456)


--
Lester Caine - G8HFL
-
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP] global address collection

2008-01-08 Thread tedd

At 10:18 AM -0500 1/8/08, Eric Butera wrote:

On Jan 8, 2008 10:08 AM, tedd [EMAIL PROTECTED] wrote:

 I just finished a credit card portion for a site where the programmer
 before me required the customers to enter their credit card number
 without spaces -- why?  It's a simple matter to remove spaces for
 processing -- why throw that responsibility on the user?


I agree that removing spaces really isn't a huge deal, but aside from
that I don't think there should be any other modification.  I've seen
code that will regex out anything but numbers.  I think this is bad
practice because we as programmers should validate, not modify data.
Anything above and beyond that is sticking your neck out too far and
will lead to problems sooner or later.

What if the user mistyped what they intended?  If the script just
validates it will see the user accidently typed in a letter in the
field and re-display it asking for numbers only.  If it strips out the
letters, then you've just sent the potentially invalid number to the
gateway which in the end will be a charge against the client for a
failed attempt.


Understood, and agreed. Generally, don't modify the data provided, 
but rather validate the form of the data. However, white space is a 
different critter in some data and is basically used to help 
customers accurately enter/see their credit card numbers.


It's common for us to more easily identify strings in 3 and 4 
combinations than it is to try to see the entire string at one time. 
Research for this has been around for a long time, please review:


http://symboldomains.com/sperling.html

No relation to me.

If you look at what's required by the credit card company, then you 
can make some valid assumptions. For example, credit card numbers for 
the popular credit card companies do not use anything but numbers in 
the card -- and the number of numbers is constant. As such, you can 
check for a valid credit card number prior to sending it out. There's 
lots of stuff you can do, but you also dig yourself a deeper hole if 
you're wrong.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] php form help...

2008-01-08 Thread 2 Logic Studios

I am trying to create this kind of form 
http://www.12monthinternetmillionaire.com/affiliate.php

a user inserts their clickbank id and its generated in the field  
belowany pointers ?






Re: [PHP] php form help...

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 11:19 AM, 2 Logic Studios [EMAIL PROTECTED] wrote:
 I am trying to create this kind of form 
 http://www.12monthinternetmillionaire.com/affiliate.php

 a user inserts their clickbank id and its generated in the field
 belowany pointers ?

Yes.  Hire a programmer.  ;-P

In actuality, it could be done with JavaScript.  However, because
JS won't modify the server settings, if you want to store the
ClickBank ID in a database, have it emailed, or whatever else, here's
the snippet of PHP code to generate the URL as they have it:

?
if($_POST['clickbank_id']) {
$url = http://.$_POST['clickbank_id']..12monthmil.hop.clickbank.net;
// Perform whatever other actions you want here, but remember to
SANITIZE the $_POST data!
}
?
form method=post action=?=$_SERVER['PHP_SELF'];? /
ClickBank ID:
input type=text name=clickbank_id /br /
input type=submit value=Update ClickBank ID /
/form
br /
input type=text value=?=$url;? size=35 /

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



[PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jason Pruim

Hi Everyone,

Happy New Year a week late! :)

I am trying to get more serious with my programming, I feel fairly  
confident in my basic abilities except for one... Error checking.  
That's what I'm trying to get figured out :)


I have a script, that I am using to connect to my database, read,  
insert, delete or edit the records in there.


most of the time the script works perfectly, but on the occassion it  
doesn't like when jupiters third moon aligns with uranus, I want the  
user to be notified to take their head out of their ass... :)


What I have tried is this:

$querytest = INSERT INTO current VALUES  
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?);

if ($stmt = mysqli_prepare($link, $querytest)) {


	mysqli_stmt_bind_param($stmt, 'ss', $FName, $LName, $Add1,  
$Add2, $City, $State, $Zip, $XCode, $Record, $Reason);

//Add the record
mysqli_stmt_execute($stmt);
printf(Error: %d.\n, mysqli_stmt_errno($stmt));
printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));


}

//Close the statement
mysqli_stmt_close($stmt);


that was pulled off of the php.net site (For the most part) and  
adapted slightly to meet my needs, and obviously I edited too much of  
it :)


If anyone has any ideas I would appreciate it. Even RTFM as long as $M  
is defined :)




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] php form help...

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 11:56 AM, 2 Logic Studios [EMAIL PROTECTED] wrote:
 Daniel,

 Thanks...worked like a charm

My pleasure.  Just remember to sanitize the code as I said if
you're going to do anything other than display it in the text box.
Otherwise, a malicious user (or possibly even a typographical error)
could lead to problems.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 11:54 AM, Jason Pruim [EMAIL PROTECTED] wrote:
 Hi Everyone,

 Happy New Year a week late! :)

And to you, as well.

 most of the time the script works perfectly, but on the occassion it
 doesn't like when jupiters third moon aligns with uranus, I want the
 user to be notified to take their head out of their ass... :)

Do not discuss myanus in any public forum, Jason.  This will be
your final warning.  ;-P

 What I have tried is this:

 $querytest = INSERT INTO current VALUES
 (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);

I'm not sure of your exact problem, to be honest, but this part of
the statement should probably be:

$querytest  = INSERT INTO current(field1,field2,field3,field4);
$querytest .=  VALUES('value1','value2','value3','value4');

Keep in mind that I only broke up the query line to avoid
convolution due to linebreaks.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] php form help...

2008-01-08 Thread Eric Butera
On Jan 8, 2008 12:00 PM, Daniel Brown [EMAIL PROTECTED] wrote:
 On Jan 8, 2008 11:56 AM, 2 Logic Studios [EMAIL PROTECTED] wrote:
  Daniel,
 
  Thanks...worked like a charm

 My pleasure.  Just remember to sanitize the code as I said if
 you're going to do anything other than display it in the text box.
 Otherwise, a malicious user (or possibly even a typographical error)
 could lead to problems.


 --
 Daniel P. Brown
 [Phone Numbers Go Here!]
 [They're Hidden From View!]

 If at first you don't succeed, stick to what you know best so that you
 can make enough money to pay someone else to do it for you.

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



You think someone who didn't even know how to get post data in the
first place knows how to properly sanitize it? :)

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



Re: [PHP] php form help...

2008-01-08 Thread Jack Mays


 You think someone who didn't even know how to get post data in the
 first place knows how to properly sanitize it? :)


One would think that the OP would lookup sanitize or some form of that 
search in google to become more familiar with the term and what it 
means, but then again I probably give to much credit to most of the 
population :)


--
Jack Mays

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



Re: [PHP] php form help...

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 12:12 PM, Eric Butera [EMAIL PROTECTED] wrote:
 You think someone who didn't even know how to get post data in the
 first place knows how to properly sanitize it? :)

Maybe, maybe not, but the point is to mention that it should be
done to allow further exploration and study to learn how it's done.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jack Mays

Jason Pruim wrote:

Hi Everyone,

Happy New Year a week late! :)

I am trying to get more serious with my programming, I feel fairly 
confident in my basic abilities except for one... Error checking. That's 
what I'm trying to get figured out :)


I have a script, that I am using to connect to my database, read, 
insert, delete or edit the records in there.


most of the time the script works perfectly, but on the occassion it 
doesn't like when jupiters third moon aligns with uranus, I want the 
user to be notified to take their head out of their ass... :)


What I have tried is this:

$querytest = INSERT INTO current VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
if ($stmt = mysqli_prepare($link, $querytest)) {


mysqli_stmt_bind_param($stmt, 'ss', $FName, $LName, $Add1, 
$Add2, $City, $State, $Zip, $XCode, $Record, $Reason);

//Add the record
mysqli_stmt_execute($stmt);
printf(Error: %d.\n, mysqli_stmt_errno($stmt));
printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));



}

//Close the statement
mysqli_stmt_close($stmt);


that was pulled off of the php.net site (For the most part) and adapted 
slightly to meet my needs, and obviously I edited too much of it :)


If anyone has any ideas I would appreciate it. Even RTFM as long as $M 
is defined :)


What, if any, errors are given when the query doens't work?  Are any of 
the field in mysql set to be unique and are you trying to insert a new 
row with some of the same information?


I dont see anything wrong right off the bat with the way you are 
performing the task.


--
Jack Mays

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



Re: [PHP] php form help...

2008-01-08 Thread tedd

At 11:17 AM -0600 1/8/08, Jack Mays wrote:

 

 You think someone who didn't even know how to get post data in the
 first place knows how to properly sanitize it? :)



One would think that the OP would lookup sanitize or some form of 
that search in google to become more familiar with the term and what 
it means, but then again I probably give to much credit to most of 
the population :)


--
Jack Mays


As I tell my grand-kids, half the people you meet everyday are below 
average intelligence.


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] global address collection

2008-01-08 Thread Nathan Nobbe
On Jan 8, 2008 10:42 AM, tedd [EMAIL PROTECTED] wrote:

 At 10:18 AM -0500 1/8/08, Eric Butera wrote:
 On Jan 8, 2008 10:08 AM, tedd [EMAIL PROTECTED] wrote:
   I just finished a credit card portion for a site where the programmer
   before me required the customers to enter their credit card number
   without spaces -- why?  It's a simple matter to remove spaces for
   processing -- why throw that responsibility on the user?
 
 I agree that removing spaces really isn't a huge deal, but aside from
 that I don't think there should be any other modification.  I've seen
 code that will regex out anything but numbers.  I think this is bad
 practice because we as programmers should validate, not modify data.
 Anything above and beyond that is sticking your neck out too far and
 will lead to problems sooner or later.
 
 What if the user mistyped what they intended?  If the script just
 validates it will see the user accidently typed in a letter in the
 field and re-display it asking for numbers only.  If it strips out the
 letters, then you've just sent the potentially invalid number to the
 gateway which in the end will be a charge against the client for a
 failed attempt.

 Understood, and agreed. Generally, don't modify the data provided,
 but rather validate the form of the data. However, white space is a
 different critter in some data and is basically used to help
 customers accurately enter/see their credit card numbers.

 It's common for us to more easily identify strings in 3 and 4
 combinations than it is to try to see the entire string at one time.
 Research for this has been around for a long time, please review:


i agree, but rather than using spaces, or allowing them in the input string,
i prefer to have several focused form fields that comprise a larger element.
for example, a credit card number is 4 units of 4 digits.  my preference for
credit card number entry is to have 4 text inputs which take 4 characters
each.
this is not only convenient from a user perspective in the user interface,
but also
on the server side.  its safe to call trim() on each sequence of characters
and
concatenate them.  if any character is not a digit then immediately the data
is known
to  be invalid (obviously additional checks are important as well [and no
more difficult
to perform than if a single form element was used to collect the data]).
ive also seen sites that will use javascript to monitor the character count
in each
of these smaller form elements and move the cursor to the subsequent form
element
once the current one is full.  i have mixed feelings, that generally boil
down to particular
implementations on this design decision; sometimes it works, sometimes it
doesnt.  but
thats up to the designer on a case by case basis.  in general i urge clients
to have
several small form fields when reasonable.  it reduces confusion for the
user, and
headaches for the (server side;)) developer.

-nathan


Re: [PHP] PHTML files showing as blank pages

2008-01-08 Thread Eric Butera
On Jan 5, 2008 9:39 AM, A.smith [EMAIL PROTECTED] wrote:
 Hi,

   I'm having a problem getting .phtml files to display in a web browser. I
 can successfully display a test.php page as per PHP install instructions but
 the phtml files show up blank
 (in firefox or IE).

 I have added these entries to my apache httpd.conf:

 LoadModule php5_modulemodules/libphp5.so
 AddHandler php5-script  .php .phtml
 AddType text/html   .php .phtml
 #AddType application/x-httpd-php .php .php3 .php4 .phtml (I tried with this
 uncommented too and without the previous entry)
 AddType application/x-httpd-php-source .phps

 My system is: Apache/2.2.6 (Unix) PHP/5.2.5


 The phtml files I am having the problem with are from an opensource project
 called CDRTool
 I believe other people can run this app fine so I believe my issue is a prob
 with apache/php
 (also because I've never configured apache/php before so its a fair shout
 Ive done something
 wrong! :P)

 The one thing that looks odd to me as someone who hasnt done this before is
 that all
 the phtml files start with a line:

 ?

 Anyway, hopefully its an easy one to fix if ur an expert! Any help
 appreciated!

 thanks in advance, Andy.

 
 Message sent using UK Grid Webmail 2.7.9

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



Try

short_open_tag = On

in php.ini as a guess.

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



Re: [PHP] PHTML files showing as blank pages

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 12:58 PM, tedd [EMAIL PROTECTED] wrote:
 At 3:37 PM -0800 1/5/08, Brady Mitchell wrote:
 On Jan 5, 2008, at 639AM, A.smith wrote:
   I'm having a problem getting .phtml files to display in a web browser. I
 can successfully display a test.php page as per PHP install instructions but
 the phtml files show up blank
 (in firefox or IE).
 
 A blank page often means that there's an error of some kind, but
 error reporting is turned off.
 
 Put the following code in the file that's giving you problems to
 turn on errors, then reload the file in your browser to see what you
 get:
 
 ini_set('display_errors',1);
 
 Brady


 Yes, but even then you can get a blank page -- it depends upon the
 type of error.

 I would start with commenting everything out, and then un-commenting
 statements in steps until the error(s) cause a blank page. Fix the
 errors and try again.

Or make sure your die(); and exit; lines actually display an error
prior to executing (or, in the case of die(), at the point of
execution).  And be sure to set ? error_reporting(E_ALL); ? to see
notices, et cetera, to be sure there aren't undefined variables, et
cetera.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jason Pruim


On Jan 8, 2008, at 12:06 PM, Daniel Brown wrote:


On Jan 8, 2008 11:54 AM, Jason Pruim [EMAIL PROTECTED] wrote:

Hi Everyone,

Happy New Year a week late! :)


   And to you, as well.


most of the time the script works perfectly, but on the occassion it
doesn't like when jupiters third moon aligns with uranus, I want the
user to be notified to take their head out of their ass... :)


   Do not discuss myanus in any public forum, Jason.  This will be
your final warning.  ;-P


anusanusanusanusanusanusanusanusanusanusanusanusanus :P




What I have tried is this:

$querytest = INSERT INTO current VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?);


   I'm not sure of your exact problem, to be honest, but this part of
the statement should probably be:

   $querytest  = INSERT INTO current(field1,field2,field3,field4);
   $querytest .=  VALUES('value1','value2','value3','value4');

   Keep in mind that I only broke up the query line to avoid
convolution due to linebreaks.


As I said in the other e-mail, the query works just fine. But if for  
some reason the insert doesn't succeed I want it to tell the user that  
it didn't succeed and that they should call their friendly underpaid  
under-appreciated network admin (AKA: ME :))




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jochem Maas
Jason Pruim schreef:
 Hi Everyone,
 
 Happy New Year a week late! :)
 
 I am trying to get more serious with my programming, I feel fairly
 confident in my basic abilities except for one... Error checking. That's
 what I'm trying to get figured out :)
 
 I have a script, that I am using to connect to my database, read,
 insert, delete or edit the records in there.
 
 most of the time the script works perfectly, but on the occassion it
 doesn't like when jupiters third moon aligns with uranus, I want the
 user to be notified to take their head out of their ass... :)
 
 What I have tried is this:
 
 $querytest = INSERT INTO current VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
 if ($stmt = mysqli_prepare($link, $querytest)) {
 
 
 mysqli_stmt_bind_param($stmt, 'ss', $FName, $LName, $Add1,
 $Add2, $City, $State, $Zip, $XCode, $Record, $Reason);

it's possible that the binding fails. check the return value of
mysqli_stmt_bind_param() and if an error status is returned log the error
and don't try to execute.

 //Add the record
 mysqli_stmt_execute($stmt);

again check the return value of the function you called (you beginning
to see a pattern here with regard to error checking? ;-)

you only need to print out (or log) an error if one actually occurred.
additionally if mysqli_stmt_execute() returns an error code you can output
a nice userfriendly message log the cryptic mysql error message, etc somewhere.

e.g.

if (!mysqli_stmt_execute($stmt)) {
echo SOMETHING BAD HAPPENED!;
error_log(mysqli_stmt_errno($stmt));
}

hope you get the idea.


 printf(Error: %d.\n, mysqli_stmt_errno($stmt));
 printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));

you might want to output the actual error message (often more useful than a
number) and also output the values you we're trying to submit to the DB.

lastly consider logging to a file (e.g. error_log()) and log enough so that
you build up a store of error data that you can use to help you track problems
that are apparently cropping up occasionally

 
 
 }
 
 //Close the statement
 mysqli_stmt_close($stmt);

you should only close the statement if it was actually prepared okay in the 
first place

at it's most simple:

if ($stmt)
mysqli_stmt_close($stmt);

 
 
 that was pulled off of the php.net site (For the most part) and adapted
 slightly to meet my needs, and obviously I edited too much of it :)
 
 If anyone has any ideas I would appreciate it. Even RTFM as long as $M
 is defined :)
 
 
 
 -- 
 
 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 Holland, MI, 49424
 www.raoset.com
 [EMAIL PROTECTED]
 

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



Re: [PHP] global address collection

2008-01-08 Thread tedd

At 12:56 PM -0500 1/8/08, Nathan Nobbe wrote:

i agree, but rather than using spaces, or allowing them in the input string,
i prefer to have several focused form fields that comprise a larger element.
for example, a credit card number is 4 units of 4 digits.  my preference for
credit card number entry is to have 4 text inputs which take 4 
characters each.
this is not only convenient from a user perspective in the user 
interface, but also
on the server side.  its safe to call trim() on each sequence of 
characters and
concatenate them.  if any character is not a digit then immediately 
the data is known
to  be invalid (obviously additional checks are important as well 
[and no more difficult

to perform than if a single form element was used to collect the data]).
ive also seen sites that will use javascript to monitor the 
character count in each
of these smaller form elements and move the cursor to the subsequent 
form element
once the current one is full.  i have mixed feelings, that generally 
boil down to particular
implementations on this design decision; sometimes it works, 
sometimes it doesnt.  but
thats up to the designer on a case by case basis.  in general i urge 
clients to have
several small form fields when reasonable.  it reduces confusion for 
the user, and

headaches for the (server side;)) developer.

-nathan


Ahh yes, an excellent idea.

Thanks,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] PHTML files showing as blank pages

2008-01-08 Thread tedd

At 3:37 PM -0800 1/5/08, Brady Mitchell wrote:

On Jan 5, 2008, at 639AM, A.smith wrote:

 I'm having a problem getting .phtml files to display in a web browser. I
can successfully display a test.php page as per PHP install instructions but
the phtml files show up blank
(in firefox or IE).


A blank page often means that there's an error of some kind, but 
error reporting is turned off.


Put the following code in the file that's giving you problems to 
turn on errors, then reload the file in your browser to see what you 
get:


ini_set('display_errors',1);

Brady



Yes, but even then you can get a blank page -- it depends upon the 
type of error.


I would start with commenting everything out, and then un-commenting 
statements in steps until the error(s) cause a blank page. Fix the 
errors and try again.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 1:18 PM, Jason Pruim [EMAIL PROTECTED] wrote:
 On Jan 8, 2008, at 12:06 PM, Daniel Brown wrote:
  On Jan 8, 2008 11:54 AM, Jason Pruim [EMAIL PROTECTED] wrote:
 
  most of the time the script works perfectly, but on the occassion it
  doesn't like when jupiters third moon aligns with uranus, I want the
  user to be notified to take their head out of their ass... :)
 
 Do not discuss myanus in any public forum, Jason.  This will be
  your final warning.  ;-P

 anusanusanusanusanusanusanusanusanusanusanusanusanus :P

And you French-kiss your mother with that mouth?

 As I said in the other e-mail, the query works just fine. But if for
 some reason the insert doesn't succeed I want it to tell the user that
 it didn't succeed and that they should call their friendly underpaid
 under-appreciated network admin (AKA: ME :))

Ah, I see.  What you probably want is something like this:
?
// blah, blah, blah
mysqli_stmt_execute($stmt) or die(mysqli_error());
?

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jason Pruim


On Jan 8, 2008, at 12:22 PM, Jack Mays wrote:


Jason Pruim wrote:

Hi Everyone,
Happy New Year a week late! :)
I am trying to get more serious with my programming, I feel fairly  
confident in my basic abilities except for one... Error checking.  
That's what I'm trying to get figured out :)
I have a script, that I am using to connect to my database, read,  
insert, delete or edit the records in there.
most of the time the script works perfectly, but on the occassion  
it doesn't like when jupiters third moon aligns with uranus, I want  
the user to be notified to take their head out of their ass... :)

What I have tried is this:
$querytest = INSERT INTO current VALUES  
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?);

if ($stmt = mysqli_prepare($link, $querytest)) {
   mysqli_stmt_bind_param($stmt, 'ss', $FName, $LName,  
$Add1, $Add2, $City, $State, $Zip, $XCode, $Record, $Reason);

   //Add the record
   mysqli_stmt_execute($stmt);
   printf(Error: %d.\n, mysqli_stmt_errno($stmt));
   printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));
   }
//Close the statement
mysqli_stmt_close($stmt);
that was pulled off of the php.net site (For the most part) and  
adapted slightly to meet my needs, and obviously I edited too much  
of it :)
If anyone has any ideas I would appreciate it. Even RTFM as long as  
$M is defined :)


What, if any, errors are given when the query doens't work?  Are any  
of the field in mysql set to be unique and are you trying to insert  
a new row with some of the same information?


I dont see anything wrong right off the bat with the way you are  
performing the task.


Actually, the problem isn't the query... the query works fine. What I  
want is for if it doesn't work, I want it to tell the user that it  
didn't work.


Right now I'm just blindly accepting that the insert succeeded, and I  
want to get away from that! :)


Does that explain it a little better?

--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] utf-8 in $_POST

2008-01-08 Thread tedd

At 11:57 AM +0200 1/8/08, Arvids Godjuks wrote:

To author:

You'r going the wrong way.
Make your page utf-8, all text on it. Set utf-8 encoding and treat all
incoming data as UTF-8. If some agent (definetly not some browser - they all
know UTF-8) doesn't understand that (that could be some hacker writing
it's own bot) - that's his problem. Then you will get all data incoming in
utf-8 and you can just add, modify and select it in and from database (don't
forget to set database and tables to UTF-8, that is default in MySQL 4.1 and
above).

If you have to deal with utf-8 data, you need the mb_string extension, see
manual.


Good advice.

Last night I read a chapter in the book Core Web Application 
Development with PHP and MYSQL by Wandschneider who said basically 
that -- a good read, btw.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Stephen Johnson


 From: Jason Pruim [EMAIL PROTECTED]
 Date: Tue, 8 Jan 2008 13:18:40 -0500
 To: Jack Mays [EMAIL PROTECTED]
 Cc: php-general General List php-general@lists.php.net
 Subject: Re: [PHP] New years resolution: To get serious with my programming!
 Anyone wanna help? :)
 
 
 
 Actually, the problem isn't the query... the query works fine. What I
 want is for if it doesn't work, I want it to tell the user that it
 didn't work.
 
 Right now I'm just blindly accepting that the insert succeeded, and I
 want to get away from that! :)
 
 Does that explain it a little better?

If you are simply wanting to do a check on whether the insert was successful
or not, then grab the id form the insert and check to see if it is there...

$success = mysql_insert_id();

If(!$success){ 
   echo no joy.. Insert failed.;
} 

Because mysql_insert_id() acts on the last performed query, be sure to call
mysql_insert_id() immediately after the query that generates the value.


--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--

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



Re: [PHP] utf-8 in $_POST

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 1:31 PM, tedd [EMAIL PROTECTED] wrote:
 Last night I read a chapter in the book Core Web Application
 Development with PHP and MYSQL by Wandschneider who said basically
 that -- a good read, btw.

I'm guess it was his name which comprised the first chapter.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] global address collection

2008-01-08 Thread Richard Heyes

Nathan Nobbe wrote:

On Jan 8, 2008 2:04 PM, Richard Heyes [EMAIL PROTECTED] wrote:


this is not only convenient from a user perspective in the user
interface, but also
on the server side.

It's not so convenient when you consider Google (and presumably others)
toolbars auto fill.



fortunately i dont have those installed ;)


Why is that fortunate? I find the Google toolbar very useful. Besides, 
your users might be using it. Anything you can do to increase the 
usability of your site should be done IMO.


--
Richard Heyes
http://www.websupportsolutions.co.uk

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

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

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



Re: [PHP] global address collection

2008-01-08 Thread Per Jessen
Richard Heyes wrote:

 Nathan Nobbe wrote:
 On Jan 8, 2008 2:04 PM, Richard Heyes [EMAIL PROTECTED] wrote:
 
 this is not only convenient from a user perspective in the user
 interface, but also
 on the server side.
 It's not so convenient when you consider Google (and presumably
 others) toolbars auto fill.
 
 
 fortunately i dont have those installed ;)
 
 Why is that fortunate? I find the Google toolbar very useful. Besides,
 your users might be using it. Anything you can do to increase the
 usability of your site should be done IMO.

Trying to think of (and maybe even accommodate) what non-standard and
third-party tools your potential user may or may not have installed,
goes a bit too far, IMO.  


/Per Jessen, Zürich

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



Re: [PHP] global address collection

2008-01-08 Thread Richard Heyes
this is not only convenient from a user perspective in the user 
interface, but also

on the server side.


It's not so convenient when you consider Google (and presumably others) 
toolbars auto fill.


--
Richard Heyes
http://www.websupportsolutions.co.uk

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

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

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



Re: [PHP] global address collection

2008-01-08 Thread Nathan Nobbe
On Jan 8, 2008 2:04 PM, Richard Heyes [EMAIL PROTECTED] wrote:

  this is not only convenient from a user perspective in the user
  interface, but also
  on the server side.

 It's not so convenient when you consider Google (and presumably others)
 toolbars auto fill.


fortunately i dont have those installed ;)

-nathan


Re: [PHP] Re: website tree

2008-01-08 Thread Richard Heyes

John Gunther wrote:

Get the various parts from the $_SERVER superglobal variable:
1) scheme (e.g. http://) from $_SERVER['HTTPS'] (https if on)
2) host:port (e.g. bucksvsbytes.com) from $_SERVER['HTTP_HOST']
3) /path/page?query part (e.g. /catalog/index.php?pid=444) from 
$_SERVER['REQUEST_URI']


There's also $_SERVER['PHP_SELF']. Probably others too. Simply:

?php
print_r($_SERVER);
?

This will show you what's available to you.

--
Richard Heyes
http://www.websupportsolutions.co.uk

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

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

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



Re: [PHP] website tree

2008-01-08 Thread tedd

At 6:06 PM +0100 1/5/08, Alain Roger wrote:

Hi,

let's imaging we have the following thing :

www.mywebsite.com/company/index.php
www.mywebsite.com/company/profile.php
www.mywebsite.com/services/index.php

how can i detect in which address am i ?

for example how to retrieve www.mywebsite.com/services or
www.mywebsite.com/company

--
Alain



Allan:

I think I see where you are going with this -- try this:

http://sperling.com/examples/smart-menu/


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] global address collection

2008-01-08 Thread tedd

At 8:23 PM +0100 1/8/08, Per Jessen wrote:

Richard Heyes wrote:


 Nathan Nobbe wrote:

 On Jan 8, 2008 2:04 PM, Richard Heyes [EMAIL PROTECTED] wrote:


 this is not only convenient from a user perspective in the user
 interface, but also
 on the server side.

 It's not so convenient when you consider Google (and presumably

  others) toolbars auto fill.
 


 fortunately i dont have those installed ;)


 Why is that fortunate? I find the Google toolbar very useful. Besides,
 your users might be using it. Anything you can do to increase the
 usability of your site should be done IMO.


Trying to think of (and maybe even accommodate) what non-standard and
third-party tools your potential user may or may not have installed,
goes a bit too far, IMO.



In addition, I don't think that having an auto-fill for a credit card 
number is ideal.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] global address collection

2008-01-08 Thread Richard Heyes

tedd wrote:

At 8:23 PM +0100 1/8/08, Per Jessen wrote:

Richard Heyes wrote:


 Nathan Nobbe wrote:

 On Jan 8, 2008 2:04 PM, Richard Heyes [EMAIL PROTECTED] wrote:


 this is not only convenient from a user perspective in the user
 interface, but also
 on the server side.

 It's not so convenient when you consider Google (and presumably

  others) toolbars auto fill.
 


 fortunately i dont have those installed ;)


 Why is that fortunate? I find the Google toolbar very useful. Besides,
 your users might be using it. Anything you can do to increase the
 usability of your site should be done IMO.


Trying to think of (and maybe even accommodate) what non-standard and
third-party tools your potential user may or may not have installed,
goes a bit too far, IMO.


Without usage stats, and given that it's third party and non-standard, I 
would guess that it's mighty popular (with it bearing the Google brand), 
and therefore worth accommodating.


In addition, I don't think that having an auto-fill for a credit card 
number is ideal.


So? People use it.

--
Richard Heyes
http://www.websupportsolutions.co.uk

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

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

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



Re: [PHP] global address collection

2008-01-08 Thread Nathan Nobbe
On Jan 8, 2008 2:23 PM, Per Jessen [EMAIL PROTECTED] wrote:

 Richard Heyes wrote:

  Nathan Nobbe wrote:
  On Jan 8, 2008 2:04 PM, Richard Heyes [EMAIL PROTECTED] wrote:
 
  this is not only convenient from a user perspective in the user
  interface, but also
  on the server side.
  It's not so convenient when you consider Google (and presumably
  others) toolbars auto fill.
 
 
  fortunately i dont have those installed ;)
 
  Why is that fortunate? I find the Google toolbar very useful. Besides,
  your users might be using it. Anything you can do to increase the
  usability of your site should be done IMO.

 Trying to think of (and maybe even accommodate) what non-standard and
 third-party tools your potential user may or may not have installed,
 goes a bit too far, IMO.


i agree w/ Per in this case, however, i will say that Richard did make me
curious
enough to do a quick google on the topic.
it seems mostly, form designers have problems w/ the yellow background
colors
google toolbars' autofill feature coats form fields w/.
heres a couple of links in case anybodys interested:
http://code.jenseng.com/google/
http://www.technologyevangelist.com/2006/03/designing_google_too.html
http://www.mediacollege.com/internet/utilities/google/toolbar-autofill.html

i would say, w/ the credit card field in particular, anybody who doesnt
double check
that info before hitting submit deserves any backlash from a mistake.  a
compromise
might be sufficient if a site has a track record of issues w/ users and an
autofill feature.
just posting some paragraph about proper usage or making something clever to
detect
the possible existence of a toolbar.  there may be better ways, but for the
google toolbar
you could set the background color of your forms to a known value, say
#00, then
when the page loads, with javascript you could check the background color of
the form
fields again.  if the color was different, you might then display a general
warning / best
practice notification to the user (and it would have the added bonus of
making your users
think youre smart, like the firebug warning that pops up in gmail now).
at any rate im sure there are scads of these toolbars out there, and even
though there are
a couple of blog articles and maybe even some simple api spec at googles
site, i would
consider it relatively futile to accommodate them into my overall design.
rather, i would
handle them on a case-by-case basis and only then when problems crop up on a
given site.

-nathan


[PHP] Can't find .php3 files

2008-01-08 Thread Jim
I'm sure this is a FAQ but I can't seem to come up with the right search 
keys to dig it out. 

I'm trying to help a friend migrate his application to php 5 from 
another system.  The problem seems to be that he references files 
(require, include, etc) that have a .php3 extension, however there are 
no files in those locations with the .php3.  There are files with .php 
extensions.  It's running on a system that has php 4 on it.


So I'm sure either php or Apache is rewriting the files somehow, but I 
don't know how.


Can someone please point me to the appropriate documentation or give me 
a hint as to what is going on here?


Thanks,
Jim.

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



[PHP] Error sending email using php into one linux with postfix. S.O.S.

2008-01-08 Thread Miren Urkixo
hello i have one great problem using php for sinding email across one email 
server (in the same machine) that is one Linux suse with postfix. it doesn't 
is sent, alwats appears one error into the mail log (bellow).


Can you help me please? I am trying to solve this problem during several 
weeks


i am trying to send email s using this:

//script
?php
$para  = '[EMAIL PROTECTED]';
$asunto= 'el asunto';
$mensaje   = 'hola carabola';
$cabeceras = 'From: miname [EMAIL PROTECTED]' . \n .
   'Reply-To: [EMAIL PROTECTED]' . \n .
   'X-Mailer: PHP/' . phpversion().\n;

mail($para, $asunto, $mensaje, $cabeceras, '[EMAIL PROTECTED]');
?

or using this:


/* recipients */
$to  = [EMAIL PROTECTED]; //$nombre .   . $email. ;
/* subject */
$subject = Email desde la pagina web;
/* message */
$message = 
html
head
/head
body
pHas recibido este correo desde el formulario de la pagina web./p
p
Nombre: $nombre br
Email: $email br
Asunto del mensaje: $asunto
/p
 /body
/html
;

/* To send HTML mail, you can set the Content-type header. */
$headers  = MIME-Version: 1.0\r\n;
$headers .= Content-type: text/html; charset=iso-8859-1\r\n;

/* additional headers */
$headers .= From:  . $nombre .   . $email. ;


/* and now mail it */
mail($to, $subject, $message, $headers);
?

but it doesn't sent.
Always appears this error:

//log
Jan  5 13:52:02 server postfix/pickup[16768]: 20EB589B68: uid=30
from=[EMAIL PROTECTED]
Jan  5 13:52:02 server postfix/cleanup[17322]: 20EB589B68:
message-id=[EMAIL PROTECTED]
Jan  5 13:52:02 server postfix/qmgr[7450]: 20EB589B68:
from=[EMAIL PROTECTED], size=394, nrcpt=1 (queue active)
Jan  5 13:52:02 server postfix/qmgr[7450]: 20EB589B68:
to=[EMAIL PROTECTED], orig_to=[EMAIL PROTECTED], relay=none,
delay=0, status=deferred (delivery temporarily suspended: transport is
unavailable)

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jason Pruim


On Jan 8, 2008, at 1:29 PM, Stephen Johnson wrote:





From: Jason Pruim [EMAIL PROTECTED]
Date: Tue, 8 Jan 2008 13:18:40 -0500
To: Jack Mays [EMAIL PROTECTED]
Cc: php-general General List php-general@lists.php.net
Subject: Re: [PHP] New years resolution: To get serious with my  
programming!

Anyone wanna help? :)



Actually, the problem isn't the query... the query works fine. What I
want is for if it doesn't work, I want it to tell the user that it
didn't work.

Right now I'm just blindly accepting that the insert succeeded, and I
want to get away from that! :)

Does that explain it a little better?


If you are simply wanting to do a check on whether the insert was  
successful
or not, then grab the id form the insert and check to see if it is  
there...


$success = mysql_insert_id();

If(!$success){
  echo no joy.. Insert failed.;
}

Because mysql_insert_id() acts on the last performed query, be sure  
to call
mysql_insert_id() immediately after the query that generates the  
value.



I wasn't able to make it work with mysqli_insert_id() but you did give  
me the idea of using mysqli_stmt_error() instead. Which doesn't return  
anything if it was successful... So a simple:


$check = mysqli_stmt_error();
if($check = )
redirect;
}
else
{
exit();
}

works great! Thanks for your help!


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jason Pruim


On Jan 8, 2008, at 1:23 PM, Jochem Maas wrote:


Jason Pruim schreef:

Hi Everyone,

Happy New Year a week late! :)

I am trying to get more serious with my programming, I feel fairly
confident in my basic abilities except for one... Error checking.  
That's

what I'm trying to get figured out :)

I have a script, that I am using to connect to my database, read,
insert, delete or edit the records in there.

most of the time the script works perfectly, but on the occassion it
doesn't like when jupiters third moon aligns with uranus, I want the
user to be notified to take their head out of their ass... :)

What I have tried is this:

$querytest = INSERT INTO current VALUES  
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?);

if ($stmt = mysqli_prepare($link, $querytest)) {


   mysqli_stmt_bind_param($stmt, 'ss', $FName, $LName, $Add1,
$Add2, $City, $State, $Zip, $XCode, $Record, $Reason);


it's possible that the binding fails. check the return value of
mysqli_stmt_bind_param() and if an error status is returned log the  
error

and don't try to execute.


   //Add the record
   mysqli_stmt_execute($stmt);


again check the return value of the function you called (you beginning
to see a pattern here with regard to error checking? ;-)

you only need to print out (or log) an error if one actually occurred.
additionally if mysqli_stmt_execute() returns an error code you can  
output
a nice userfriendly message log the cryptic mysql error message, etc  
somewhere.


e.g.

if (!mysqli_stmt_execute($stmt)) {
echo SOMETHING BAD HAPPENED!;
error_log(mysqli_stmt_errno($stmt));
}

hope you get the idea.


Yeah I think I get the idea... Now I just need to figure out to do it  
for sure :) this is what I have come up with so far:


$check = mysqli_stmt_error($stmt);
echo BR$checkdateBR;
if($check ==){
echo Success! Redirect to first page;
printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));
header(Location: index.php);
}
else
{
echo 
		Sorry for the inconvience, but something appears to be not working  
correctly. BR
		Please take a quick moment to send an e-mail to: a href=\mailto:[EMAIL PROTECTED] 
\[EMAIL PROTECTED]/A to report the error.BR;

echo 
Please include:BR
What browser you are using.br
any text displayed on this page.br;
printf(Error: %d.\n, mysqli_stmt_error($stmt));
echo $checkdate;

}

//Close the statement
if(!$stmt){

mysqli_stmt_close($stmt);
}

I'm sure I could do it better, and I'll be studying to figure out how  
very shortly!


Now I just need to make the query fail, but still connect to the  
database to test it :)







   printf(Error: %d.\n, mysqli_stmt_errno($stmt));
   printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));


you might want to output the actual error message (often more useful  
than a
number) and also output the values you we're trying to submit to the  
DB.


lastly consider logging to a file (e.g. error_log()) and log enough  
so that
you build up a store of error data that you can use to help you  
track problems

that are apparently cropping up occasionally




}

//Close the statement
mysqli_stmt_close($stmt);


you should only close the statement if it was actually prepared okay  
in the first place


at it's most simple:

if ($stmt)
mysqli_stmt_close($stmt);




that was pulled off of the php.net site (For the most part) and  
adapted

slightly to meet my needs, and obviously I edited too much of it :)

If anyone has any ideas I would appreciate it. Even RTFM as long as  
$M

is defined :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]






--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jason Pruim


On Jan 8, 2008, at 1:31 PM, Daniel Brown wrote:


On Jan 8, 2008 1:18 PM, Jason Pruim [EMAIL PROTECTED] wrote:

On Jan 8, 2008, at 12:06 PM, Daniel Brown wrote:

On Jan 8, 2008 11:54 AM, Jason Pruim [EMAIL PROTECTED] wrote:


most of the time the script works perfectly, but on the occassion  
it
doesn't like when jupiters third moon aligns with uranus, I want  
the

user to be notified to take their head out of their ass... :)


  Do not discuss myanus in any public forum, Jason.  This will be
your final warning.  ;-P


anusanusanusanusanusanusanusanusanusanusanusanusanus :P


   And you French-kiss your mother with that mouth?


Only on special occasions... Besides, isn't that illegal in every  
state but PA? ;)






As I said in the other e-mail, the query works just fine. But if for
some reason the insert doesn't succeed I want it to tell the user  
that

it didn't succeed and that they should call their friendly underpaid
under-appreciated network admin (AKA: ME :))


   Ah, I see.  What you probably want is something like this:
?
// blah, blah, blah
mysqli_stmt_execute($stmt) or die(mysqli_error());
?



Tried to do that, and couldn't get it to work, but as I noted in  
another e-mail, I found away that I think will work! :)



--
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] Error sending email using php into one linux with postfix. S.O.S.

2008-01-08 Thread Chris



Jan  5 13:52:02 server postfix/qmgr[7450]: 20EB589B68:
to=[EMAIL PROTECTED], orig_to=[EMAIL PROTECTED], relay=none,
delay=0, status=deferred (delivery temporarily suspended: transport is
unavailable)


Which means it's a postfix problem and has nothing to do with php at all.

Ask on the postfix mailing list(s).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Can't find .php3 files

2008-01-08 Thread Chris


I'm trying to help a friend migrate his application to php 5 from 
another system.  The problem seems to be that he references files 
(require, include, etc) that have a .php3 extension, however there are 
no files in those locations with the .php3.  There are files with .php 
extensions.  It's running on a system that has php 4 on it.


If you can ssh in to the server, go to the base folder of the app and:

grep -nri 'php3' *

and make sure there are no references in the code to php3 files.

Else try the same in windows search or using your editor, see if it has 
a 'find in files' type option.


So I'm sure either php or Apache is rewriting the files somehow, but I 
don't know how.


Check for a .htaccess file.

See if apache is set up to handle php3 files, look for something like 
this in the config:


AddType application/x-httpd-php .php3


If this is causing a fatal error, your logs should also tell you where 
to start looking. The apache2 error logs are pretty good, eg:


[date] [error] [client ipaddr] PHP Warning: 
include(../includes/db.php): failed to open stream: No such file or 
directory in /path/to/file.php


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 3:43 PM, Jason Pruim [EMAIL PROTECTED] wrote:
 I wasn't able to make it work with mysqli_insert_id() but you did give
 me the idea of using mysqli_stmt_error() instead. Which doesn't return
 anything if it was successful... So a simple:

 $check = mysqli_stmt_error();
 if($check = )
 redirect;
 }
 else
 {
 exit();
 }

Hey, Dippy exit isn't a function!

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jochem Maas
Daniel Brown schreef:
 On Jan 8, 2008 3:43 PM, Jason Pruim [EMAIL PROTECTED] wrote:
 I wasn't able to make it work with mysqli_insert_id() but you did give
 me the idea of using mysqli_stmt_error() instead. Which doesn't return
 anything if it was successful... So a simple:

 $check = mysqli_stmt_error();
 if($check = )
 redirect;
 }
 else
 {
 exit();
 }
 
 Hey, Dippy exit isn't a function!

no but it does take an 'argument expression' (is that the correct terminology)
which is handy when you want offer an exit code ... or a 'die' message.

die(PostTrack Alter Ego);

and die is a synonym for exit IIRC.

funnily enough exit is even listed as a function.

 

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jack Mays




funnily enough exit is even listed as a function.




LOL, Ignore me, I read that message to fast and read isn't instead of 
is.  It's time to go home and sleep :)


--
Jack Mays

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jochem Maas
Jack Mays schreef:
 

 funnily enough exit is even listed as a function.


 
 Sure it is: http://us2.php.net/manual/en/function.exit.php
 
 Unless I'm missing a point here or something. :)

could you re-read that last sentence of my previous post :-)
I believe your brain is injecting non-existent negative :-P

 
 -- 
 Jack Mays
 

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



Re: [PHP] Can't find .php3 files

2008-01-08 Thread Jim

Chris wrote:


I'm trying to help a friend migrate his application to php 5 from 
another system.  The problem seems to be that he references files 
(require, include, etc) that have a .php3 extension, however there 
are no files in those locations with the .php3.  There are files with 
.php extensions.  It's running on a system that has php 4 on it.


If you can ssh in to the server, go to the base folder of the app and:

grep -nri 'php3' *

and make sure there are no references in the code to php3 files.

Else try the same in windows search or using your editor, see if it 
has a 'find in files' type option.


So I'm sure either php or Apache is rewriting the files somehow, but 
I don't know how.


Check for a .htaccess file.

See if apache is set up to handle php3 files, look for something like 
this in the config:


AddType application/x-httpd-php .php3


If this is causing a fatal error, your logs should also tell you where 
to start looking. The apache2 error logs are pretty good, eg:


[date] [error] [client ipaddr] PHP Warning: 
include(../includes/db.php): failed to open stream: No such file or 
directory in /path/to/file.php



I think you misunderstood.  I have lots of file with things like

require admin.php3

But there is no admin.php3 anywhere.  There is however a file admin.php.
Since this works on the old server then something on that system is 
translating a request for a .php3 file to .php I'm guessing. Apache or 
php but I don't know which.


The old server is a Linux system, while the new one is a bsd system (OS X).

Both systems have the
AddType application/x-httpd-php .php3
Line in their configuration. 


Thanks,
Jim.

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



[PHP] [FCK 2.5.1] - forbidden error 403 - XML request error

2008-01-08 Thread TS
Hello,

Any help would be immensely appreciated.

Clicking on the Image upload button  browse server button

I get 

Forbidden error 403 - XML request error -  

You don't have permission to access
/fckeditor/editor/filemanager/browser/default/browser.html on this server.

Apache/1.3.39 Ben-SSL/1.57
Php 4.3

Googled it but can't find anything that works. Permissions are set properly.
We've even tried opening everything up to the world and it still throws an
error.

File image upload works just fine. 

Thanks ahead.

T

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jack Mays




funnily enough exit is even listed as a function.




Sure it is: http://us2.php.net/manual/en/function.exit.php

Unless I'm missing a point here or something. :)

--
Jack Mays

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 4:40 PM, Jack Mays [EMAIL PROTECTED] wrote:

 
  funnily enough exit is even listed as a function.
 
 

 Sure it is: http://us2.php.net/manual/en/function.exit.php

 Unless I'm missing a point here or something. :)

Actually, exit is never a function.  It's a language construct.  I
know it can accept a parameter, but that still doesn't make it a
function, so I don't know why it's listed as a function in the PHP
manual.  Just because it's tastes like a duck doesn't mean it came
from an egg.  ;-P

To my knowledge, die() is a function but I could be wrong.  It
could just be considered an aliased language construct.

Further research is required

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jochem Maas
Jack Mays schreef:
 

 funnily enough exit is even listed as a function.


 
 LOL, Ignore me, I read that message to fast and read isn't instead of
 is.  It's time to go home and sleep :)

er, too late - just pretend I ignored it ;-)

 
 -- 
 Jack Mays
 

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Jochem Maas
Jason Pruim schreef:
 
 On Jan 8, 2008, at 1:23 PM, Jochem Maas wrote:
 
 Jason Pruim schreef:
 Hi Everyone,

 Happy New Year a week late! :)

 I am trying to get more serious with my programming, I feel fairly
 confident in my basic abilities except for one... Error checking. That's
 what I'm trying to get figured out :)

 I have a script, that I am using to connect to my database, read,
 insert, delete or edit the records in there.

 most of the time the script works perfectly, but on the occassion it
 doesn't like when jupiters third moon aligns with uranus, I want the
 user to be notified to take their head out of their ass... :)

 What I have tried is this:

 $querytest = INSERT INTO current VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,
 ?);
 if ($stmt = mysqli_prepare($link, $querytest)) {


mysqli_stmt_bind_param($stmt, 'ss', $FName, $LName, $Add1,
 $Add2, $City, $State, $Zip, $XCode, $Record, $Reason);

 it's possible that the binding fails. check the return value of
 mysqli_stmt_bind_param() and if an error status is returned log the error
 and don't try to execute.

//Add the record
mysqli_stmt_execute($stmt);

 again check the return value of the function you called (you beginning
 to see a pattern here with regard to error checking? ;-)

 you only need to print out (or log) an error if one actually occurred.
 additionally if mysqli_stmt_execute() returns an error code you can
 output
 a nice userfriendly message log the cryptic mysql error message, etc
 somewhere.

 e.g.

 if (!mysqli_stmt_execute($stmt)) {
 echo SOMETHING BAD HAPPENED!;
 error_log(mysqli_stmt_errno($stmt));
 }

 hope you get the idea.
 
 Yeah I think I get the idea... Now I just need to figure out to do it
 for sure :) this is what I have come up with so far:

many ways to skin the cat - the basic idea is to check return values (and/OR
relevant error related functions) at every turn to make sure things worked
as expected (and do/log/output something suitable)

 
 $check = mysqli_stmt_error($stmt);
 echo BR$checkdateBR;
 if($check ==){
 echo Success! Redirect to first page;
 printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));
 header(Location: index.php);
 }
 else
 {
 echo 
 Sorry for the inconvience, but something appears to be not
 working correctly. BR
 Please take a quick moment to send an e-mail to: a
 href=\mailto:[EMAIL PROTECTED][EMAIL PROTECTED]/A to report
 the error.BR;
 echo 
 Please include:BR
 What browser you are using.br
 any text displayed on this page.br;
 printf(Error: %d.\n, mysqli_stmt_error($stmt));
 echo $checkdate;
 
 }
 
 //Close the statement
 if(!$stmt){

I think that should be

if ($stmt) {

no point in closing is if it was never 'opened' properly in the first place
(unless the docs say otherwise, in which case it should be unconditionally 
closed - possibly)

 
 mysqli_stmt_close($stmt);
 }
 
 I'm sure I could do it better, and I'll be studying to figure out how
 very shortly!
 
 Now I just need to make the query fail, but still connect to the
 database to test it :)
 



printf(Error: %d.\n, mysqli_stmt_errno($stmt));
printf(%d Row Inserted.\n, mysqli_stmt_affected_rows($stmt));

 you might want to output the actual error message (often more useful
 than a
 number) and also output the values you we're trying to submit to the DB.

 lastly consider logging to a file (e.g. error_log()) and log enough so
 that
 you build up a store of error data that you can use to help you track
 problems
 that are apparently cropping up occasionally



 }

 //Close the statement
 mysqli_stmt_close($stmt);

 you should only close the statement if it was actually prepared okay
 in the first place

 at it's most simple:

 if ($stmt)
 mysqli_stmt_close($stmt);



 that was pulled off of the php.net site (For the most part) and adapted
 slightly to meet my needs, and obviously I edited too much of it :)

 If anyone has any ideas I would appreciate it. Even RTFM as long as $M
 is defined :)



 -- 

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 Holland, MI, 49424
 www.raoset.com
 [EMAIL PROTECTED]



 
 -- 
 
 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 Holland, MI, 49424
 www.raoset.com
 [EMAIL PROTECTED]
 

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



Re: [PHP] Can't find .php3 files

2008-01-08 Thread Chris



I think you misunderstood.  I have lots of file with things like

require admin.php3

But there is no admin.php3 anywhere.  There is however a file admin.php.
Since this works on the old server then something on that system is 
translating a request for a .php3 file to .php I'm guessing. Apache or 
php but I don't know which.


It will be apache.

It will have the handler I mentioned before:

AddType application/x-httpd-php .php3

Add that in (with an appropriate comment) to your new config and restart 
apache.


Voila!

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] php form help...

2008-01-08 Thread Philip Thompson

On Jan 8, 2008, at 11:52 AM, tedd wrote:


At 11:17 AM -0600 1/8/08, Jack Mays wrote:



You think someone who didn't even know how to get post data in the
first place knows how to properly sanitize it? :)



One would think that the OP would lookup sanitize or some form of  
that search in google to become more familiar with the term and  
what it means, but then again I probably give to much credit to  
most of the population :)


--
Jack Mays


As I tell my grand-kids, half the people you meet everyday are below  
average intelligence.


Cheers,

tedd



I guess this ruins my impression of you being this 28 y/o  
programmer... grandpa! ;)


Hehehe

~Phil

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



[PHP] MSSQL

2008-01-08 Thread Alexis

Hi,

I am pulling my hair out trying to set up PHP to connect to SQL Server.

The office server, running Server 2003, has SQL Server on it.

One of my computers is running XP with Apache 2.2 and  PHP 5.2.3.
Another one has Ubuntu Gusty Gibbon, Apache 2.2 and PHP 5.2.3

Ideally I would like to get the Linux box to connect to the main server, 
but I can't even get it to recognise the server, let alone create a 
MSSQL link, so I'll start off with the windows box.


I have read all the various comments in http://ca3.php.net/mssql and 
have tried all the relevant ones but still no joy.

It just will not connect.


I have tried the ADO approach but get the following error:

Fatal error: Uncaught exception 'com_exception' with message 
'bSource:/b Microsoft OLE DB Provider for SQL 
Serverbr/bDescription:/b [DBNETLIB][ConnectionOpen 
(Connect()).]SQL Server does not exist or access denied.' in 
D:\Apache2.2\htdocs\includes\mssqlinfo.inc:9 Stack trace: #0 
D:\Apache2.2\htdocs\includes\mssqlinfo.inc(9): 
com-Open('Provider=SQLOLE...') #1 D:\Apache2.2\htdocs\mssql.php(3): 
include('D:\Apache2.2\ht...') #2 {main} thrown in 
D:\Apache2.2\htdocs\includes\mssqlinfo.inc on line 9



Does anyone have a definite and easy to understand set of instructions 
as to how to get PHP to talk to SQL Server please?


Cheers
Alexis

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Philip Thompson

On Jan 8, 2008, at 3:57 PM, Daniel Brown wrote:


On Jan 8, 2008 4:40 PM, Jack Mays [EMAIL PROTECTED] wrote:



funnily enough exit is even listed as a function.



Sure it is: http://us2.php.net/manual/en/function.exit.php

Unless I'm missing a point here or something. :)


   Actually, exit is never a function.  It's a language construct.  I
know it can accept a parameter, but that still doesn't make it a
function, so I don't know why it's listed as a function in the PHP
manual.  Just because it's tastes like a duck doesn't mean it came
from an egg.  ;-P

   To my knowledge, die() is a function but I could be wrong.  It
could just be considered an aliased language construct.

   Further research is required



Silly Rabbit! 'die' is NOT function - it's a construct. In fact, it's  
an alias to 'exit'.


http://php.net/die

No further research required ;)

~Philip

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



Re: [PHP] php form help...

2008-01-08 Thread tedd

At 4:04 PM -0600 1/8/08, Philip Thompson wrote:

On Jan 8, 2008, at 11:52 AM, tedd wrote:
As I tell my grand-kids, half the people you meet everyday are 
below average intelligence.


Cheers,

tedd


I guess this ruins my impression of you being this 28 y/o 
programmer... grandpa! ;)


Yeah, I'm a little old -- but I'm still very good-looking, extremely 
smart and humble.


I'm old enough to remember gas stations where the attendant would 
hand-pump gas up into a glass container and then would gravity feed 
it into your tank. I actually knew people who were alive during the 
civil war. And as everyone knows on this list, I used to program with 
rocks.


But, I now play xbox (Call of Duty 4 rules) and my gamer tag is special tedd.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] [FCK 2.5.1] - forbidden error 403 - XML request error

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 4:53 PM, TS [EMAIL PROTECTED] wrote:
 Hello,

 Any help would be immensely appreciated.

 Clicking on the Image upload button  browse server button

 I get

 Forbidden error 403 - XML request error -

 You don't have permission to access
 /fckeditor/editor/filemanager/browser/default/browser.html on this server.

 Apache/1.3.39 Ben-SSL/1.57
 Php 4.3

 Googled it but can't find anything that works. Permissions are set properly.
 We've even tried opening everything up to the world and it still throws an
 error.

 File image upload works just fine.

If that error message is correct, you installed fckeditor in the
root directory.  I can't think of a single Good Reason[tm] for doing
this, but I can think of several reasons (security being paramount)
why it's a Bad Idea[tm].

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 5:18 PM, Philip Thompson [EMAIL PROTECTED] wrote:
  Silly Rabbit! 'die' is NOT function - it's a construct. In fact,
  it's an alias to 'exit'.

 Crap! I didn't mean it's an alias! It's equivalent. Whatever that
 means... Whew. Is it only Tuesday?

Bite my shiny metal ass, Philip.  Just because you're right
doesn't mean you have to tell me and ruin my God-like perception of
myself.  Now I have to get off of this pedestal and return it to
Wal-Mart.  Thanks a lot.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] New years resolution: To get serious with my programming! Anyone wanna help? :)

2008-01-08 Thread Philip Thompson


On Jan 8, 2008, at 4:16 PM, Philip Thompson wrote:


On Jan 8, 2008, at 3:57 PM, Daniel Brown wrote:


On Jan 8, 2008 4:40 PM, Jack Mays [EMAIL PROTECTED] wrote:



funnily enough exit is even listed as a function.



Sure it is: http://us2.php.net/manual/en/function.exit.php

Unless I'm missing a point here or something. :)


  Actually, exit is never a function.  It's a language construct.  I
know it can accept a parameter, but that still doesn't make it a
function, so I don't know why it's listed as a function in the PHP
manual.  Just because it's tastes like a duck doesn't mean it came
from an egg.  ;-P

  To my knowledge, die() is a function but I could be wrong.  It
could just be considered an aliased language construct.

  Further research is required



Silly Rabbit! 'die' is NOT function - it's a construct. In fact,  
it's an alias to 'exit'.


Crap! I didn't mean it's an alias! It's equivalent. Whatever that  
means... Whew. Is it only Tuesday?




http://php.net/die

No further research required ;)

~Philip


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



Re: [PHP] php form help...

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 5:04 PM, Philip Thompson [EMAIL PROTECTED] wrote:
 I guess this ruins my impression of you being this 28 y/o
 programmer... grandpa! ;)

 Hehehe

No, they just start raising families at a very young age.  Tedd is
only about seven years older than his children.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



[PHP] Can a php script authorize itself to a digest auth protected server?

2008-01-08 Thread Steven Stromer

Hi,

I'm trying to edit a php application that generates postscript files  
from html pages pages, html2ps/pdf (http://www.tufat.com/ 
script19.htm), to automatically authenticate with an apache server  
using digest authentication. Conceptually, while any visiting client  
can interact with the application, the page requests that the  
application itself makes appear to the web server to be originating  
from the application, and not from the client's browser. Thus, as far  
as I can tell, it becomes necessary for the application to be able to  
complete the authentication process entirely autonomously, creating a  
'digest authentication session' (as I'll call it) that the end user  
does not necessarily even need to have access to.


I've reviewed the digest authentication example provided on the PHP  
Manual page titled, 'HTTP authentication with PHP' (http://us.php.net/ 
features.http-auth), and can certainly see how to build the necessary  
reply headers once the web server has accepted a username and  
password. However, the following things confuse me:


1. I'm not sure how to automatically provide the response to the  
server's initial 'HTTP/1.0 401 Unauthorized' response. With basic  
authentication this can easily be skipped by forming a request in the  
format: user:[EMAIL PROTECTED], but this obviously doesn't  
work with digest authentication.


2. I'm not sure how the php application itself creates or maintains  
its own session.


3. Logically, the $_SERVER['PHP_AUTH_DIGEST'] variable then could not  
even contain the correct username, nonce, etc., because this would  
only be able to reflect the 'session' data of the end client, and not  
the data of the 'session' created by the application itself.


If anyone can even provide some theory, I could likely produce the  
necessary code, though any sample code, or pointers to such samples,  
would be greatly appreciated! So far, my searches have met with  
little success.


Thanks,
Steven Stromer

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



Re: [PHP] Can't find .php3 files

2008-01-08 Thread Jim

Chris wrote:



I think you misunderstood.  I have lots of file with things like

require admin.php3

But there is no admin.php3 anywhere.  There is however a file admin.php.
Since this works on the old server then something on that system is 
translating a request for a .php3 file to .php I'm guessing. Apache 
or php but I don't know which.


It will be apache.

It will have the handler I mentioned before:

AddType application/x-httpd-php .php3

Add that in (with an appropriate comment) to your new config and 
restart apache.


Voila!


Look at my last email.  I said

Both systems have the
AddType application/x-httpd-php .php3
Line in their configuration.
And the new one has been restarted more than once.  In fact that line 
was in there from the start, I didn't add it.

I'll have to look to see what config file it's in to be sure it's included.

Thanks,
Jim.

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



Re: [PHP] Can't find .php3 files

2008-01-08 Thread Jim Lucas

Jim wrote:

Chris wrote:


I'm trying to help a friend migrate his application to php 5 from 
another system.  The problem seems to be that he references files 
(require, include, etc) that have a .php3 extension, however there 
are no files in those locations with the .php3.  There are files with 
.php extensions.  It's running on a system that has php 4 on it.


If you can ssh in to the server, go to the base folder of the app and:

grep -nri 'php3' *

and make sure there are no references in the code to php3 files.

Else try the same in windows search or using your editor, see if it 
has a 'find in files' type option.


So I'm sure either php or Apache is rewriting the files somehow, but 
I don't know how.


Check for a .htaccess file.

See if apache is set up to handle php3 files, look for something like 
this in the config:


AddType application/x-httpd-php .php3


If this is causing a fatal error, your logs should also tell you where 
to start looking. The apache2 error logs are pretty good, eg:


[date] [error] [client ipaddr] PHP Warning: 
include(../includes/db.php): failed to open stream: No such file or 
directory in /path/to/file.php



I think you misunderstood.  I have lots of file with things like

require admin.php3

But there is no admin.php3 anywhere.  There is however a file admin.php.
Since this works on the old server then something on that system is 
translating a request for a .php3 file to .php I'm guessing. Apache or 
php but I don't know which.


The old server is a Linux system, while the new one is a bsd system (OS X).

Both systems have the
AddType application/x-httpd-php .php3
Line in their configuration.
Thanks,
Jim.



if you can ssh to the linux box, I would do a locate admin.php3 from the 
prompt.

If there is an admin.php3 file on your system, it should be shown here.

Another thing to look at is the PHP include path.  Get all the directories that are listed and check 
all those locations.  It will have to be in one of those locations, if not, it isn't being used.


Another thing to make sure of is that you are not hiding any errors that might otherwise tell you 
that they files that are being called to by the require/include statements are missing or otherwise 
unreadable.


Put this at the top of your script:

?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

# rest of your code follows

?

This will show you all errors, if any, on that page.  Maybe the error is being 
quietly tossed out.

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] [FCK 2.5.1] - forbidden error 403 - XML request error

2008-01-08 Thread Jim Lucas

Daniel Brown wrote:

On Jan 8, 2008 4:53 PM, TS [EMAIL PROTECTED] wrote:

Hello,

Any help would be immensely appreciated.

Clicking on the Image upload button  browse server button

I get

Forbidden error 403 - XML request error -

You don't have permission to access
/fckeditor/editor/filemanager/browser/default/browser.html on this server.

Apache/1.3.39 Ben-SSL/1.57
Php 4.3

Googled it but can't find anything that works. Permissions are set properly.
We've even tried opening everything up to the world and it still throws an
error.

File image upload works just fine.


If that error message is correct, you installed fckeditor in the
root directory.  I can't think of a single Good Reason[tm] for doing
this, but I can think of several reasons (security being paramount)
why it's a Bad Idea[tm].



Could be a jailed apache install :)

--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



RE: [PHP] [FCK 2.5.1] - forbidden error 403 - XML request error

2008-01-08 Thread TS
Thanks Jim,

Turned out to be mod security. Geezus

Thanks again

-Original Message-
From: Jim Lucas [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 08, 2008 6:23 PM
To: Daniel Brown
Cc: TS; php-general@lists.php.net
Subject: Re: [PHP] [FCK 2.5.1] - forbidden error 403 - XML request error

Daniel Brown wrote:
 On Jan 8, 2008 4:53 PM, TS [EMAIL PROTECTED] wrote:
 Hello,

 Any help would be immensely appreciated.

 Clicking on the Image upload button  browse server button

 I get

 Forbidden error 403 - XML request error -

 You don't have permission to access
 /fckeditor/editor/filemanager/browser/default/browser.html on this
server.

 Apache/1.3.39 Ben-SSL/1.57
 Php 4.3

 Googled it but can't find anything that works. Permissions are set
properly.
 We've even tried opening everything up to the world and it still throws
an
 error.

 File image upload works just fine.
 
 If that error message is correct, you installed fckeditor in the
 root directory.  I can't think of a single Good Reason[tm] for doing
 this, but I can think of several reasons (security being paramount)
 why it's a Bad Idea[tm].
 

Could be a jailed apache install :)

-- 
Jim Lucas

Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
 by William Shakespeare

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



Re: [PHP] [FCK 2.5.1] - forbidden error 403 - XML request error

2008-01-08 Thread Daniel Brown
On Jan 8, 2008 6:22 PM, Jim Lucas [EMAIL PROTECTED] wrote:
 Could be a jailed apache install :)

Touche, salesman.

I was thinking too one-dimensionally.  Good call.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since 1979.

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



RE: [PHP] MSSQL

2008-01-08 Thread Shelley Shyan
Did you check that you have enabled MSSQL extension?
That is,
On XP system, you should have this line 'extension=php_msql.dll' in php.ini 
file and the leading ';' be removed.
On Ubuntu, you should also install mssql extension, which is a little more 
complex.

There should be no problem once you have managed mssql.
It talks to sql server 2005/2000 quite well.


Regards,
Shelley

-Original Message-
From: Alexis [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 09, 2008 6:07 AM
To: php-general@lists.php.net
Subject: [PHP] MSSQL

Hi,

I am pulling my hair out trying to set up PHP to connect to SQL Server.

The office server, running Server 2003, has SQL Server on it.

One of my computers is running XP with Apache 2.2 and  PHP 5.2.3.
Another one has Ubuntu Gusty Gibbon, Apache 2.2 and PHP 5.2.3

Ideally I would like to get the Linux box to connect to the main server, but I 
can't even get it to recognise the server, let alone create a MSSQL link, so 
I'll start off with the windows box.

I have read all the various comments in http://ca3.php.net/mssql and have tried 
all the relevant ones but still no joy.
It just will not connect.


I have tried the ADO approach but get the following error:

Fatal error: Uncaught exception 'com_exception' with message 'bSource:/b 
Microsoft OLE DB Provider for SQL Serverbr/bDescription:/b 
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access 
denied.' in
D:\Apache2.2\htdocs\includes\mssqlinfo.inc:9 Stack trace: #0
D:\Apache2.2\htdocs\includes\mssqlinfo.inc(9):
com-Open('Provider=SQLOLE...') #1 D:\Apache2.2\htdocs\mssql.php(3):
include('D:\Apache2.2\ht...') #2 {main} thrown in 
D:\Apache2.2\htdocs\includes\mssqlinfo.inc on line 9


Does anyone have a definite and easy to understand set of instructions as to 
how to get PHP to talk to SQL Server please?

Cheers
Alexis

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

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



[PHP] ereg help!

2008-01-08 Thread steve
I have a dir of html files that link to websites, i would like to read the dir 
and print a list of those files as a link. Which the script i have does. I 
would like to take this one step further and replace the .html extension 
with .com so it winds up being:
website.com instead of website.html

I am apparently having problems getting my head around eregi enough to 
acomplish this.

any help is greatly appreciated.

?
$source_dir = ./mydir;

$dir=opendir($source_dir);
$files=array();
while (($file=readdir($dir)) !== false)
{


if ($file != .  $file != ..  strpos(strtolower($file),.php) === 
false)
{
array_push($files, $file);
}
}
closedir($dir);
sort($files);
foreach ($files as $file)
{

echo A href='$file'$filebr;


}
?

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



Re: [PHP] ereg help!

2008-01-08 Thread Chris

steve wrote:
I have a dir of html files that link to websites, i would like to read the dir 
and print a list of those files as a link. Which the script i have does. I 
would like to take this one step further and replace the .html extension 
with .com so it winds up being:

website.com instead of website.html

I am apparently having problems getting my head around eregi enough to 
acomplish this.


any help is greatly appreciated.

?
$source_dir = ./mydir;

$dir=opendir($source_dir);
$files=array();
while (($file=readdir($dir)) !== false)
{


if ($file != .  $file != ..  strpos(strtolower($file),.php) === 
false)

{
array_push($files, $file);
}
}
closedir($dir);
sort($files);
foreach ($files as $file)
{

echo A href='$file'$filebr;


}
?



I usually use preg_* functions so here's my go:

echo preg_replace('/\.php$/', '.com', $file);

The '$' at the end makes sure it's a .php file and won't cause problems 
with files like xyz.php.txt .


(otherwise I'd just use a straight str_replace).

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] ereg help!

2008-01-08 Thread steve
On Tuesday 08 January 2008 20:30:29 Chris wrote:
I usually use preg_* functions so here's my go:

echo preg_replace('/\.php$/', '.com', $file);

The '$' at the end makes sure it's a .php file and won't cause problems 
with files like xyz.php.txt .

(otherwise I'd just use a straight str_replace).

Thanks

Guess i was just trying to over think it. Have not done much with files.


Steve

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



Re: [PHP] ereg help!

2008-01-08 Thread Casey

On Jan 8, 2008, at 5:45 PM, steve [EMAIL PROTECTED] wrote:

I have a dir of html files that link to websites, i would like to  
read the dir
and print a list of those files as a link. Which the script i have  
does. I
would like to take this one step further and replace the .html  
extension

with .com so it winds up being:
website.com instead of website.html

I am apparently having problems getting my head around eregi enough to
acomplish this.

any help is greatly appreciated.

?
$source_dir = ./mydir;

$dir=opendir($source_dir);
$files=array();
while (($file=readdir($dir)) !== false)
{


if ($file != .  $file != ..  strpos(strtolower 
($file),.php) ===

false)
   {
   array_push($files, $file);
   }
}
closedir($dir);
sort($files);
foreach ($files as $file)
{

echo A href='$file'$filebr;


}
?

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



I think glob('*.html'); would be easier. 


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



Re: [PHP] MSSQL

2008-01-08 Thread Andrew Ballard
On Jan 8, 2008 8:58 PM, Shelley Shyan [EMAIL PROTECTED] wrote:
 Did you check that you have enabled MSSQL extension?
 That is,
 On XP system, you should have this line 'extension=php_msql.dll' in php.ini 
 file and the leading ';' be removed.
 On Ubuntu, you should also install mssql extension, which is a little more 
 complex.

 There should be no problem once you have managed mssql.
 It talks to sql server 2005/2000 quite well.


 Regards,
 Shelley

Just to be clear, the post above has a typo and should read
'extension=php_mssql.dll'.

I have found that for PHP hosted on a Windows box to talk to SQL
Server 2005 you have to have the latest version of the library
ntwdblib.dll or it won't connect. (The details were in the comments in
the manual page for mssql if you haven't checked this already.) SQL
Server 2000 doesn't usually have a problem. I haven't tried to connect
to SQL Server from a Linux box, though.

Other than that, the only tricks I have found involve making sure you
are using the correct server address syntax if SQL Server is using
something other than the default port (pretty simple, but I've seen it
trip a few folks up) and using SQL Authentication rather than Windows
(trusted) authentication. If you are ultimately looking to connect
from a Linux box I am guessing this is already the case.

Andrew

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



RE: [PHP] client time zone?

2008-01-08 Thread Wolf
Sure, have a look on google for php: time zone class and you should be good to 
go!

What code have you written so far to try using the  data from the server?

Wolf

-Original Message-
From: jekillen [EMAIL PROTECTED]
Sent: Saturday, January 05, 2008 10:51 PM
To: PHP General list php-general@lists.php.net
Subject: [PHP] client time zone?

Hello;
I am running a server that is using UTC
and I want to be able to convert to
clients local time in some display presentations.
Is this indicated by $_SERVER[REQUEST_TIME]?
If not, is there a way to get the requesting host's
time zone so I can offset the servers clock value correctly?
Thank you for info:
Jeff K

-- 
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] Posting Summary for Week Ending 4 January, 2008: php-general@lists.php.net

2008-01-08 Thread Wolf
Looks like your cron job is set for every minute Don!  Please disable it until 
you get the kinks worked out of it!

-Original Message-
From: Daniel Brown [EMAIL PROTECTED]
Sent: Friday, January 04, 2008 7:24 PM
To: PostTrack [Dan Brown] [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] Posting Summary for Week Ending 4 January, 2008: 
php-general@lists.php.net

It must be something on the mailing list side of things, because
I'm getting them, too, but there's nothing at all in my outgoing
queue.

On Jan 4, 2008 5:48 PM, PostTrack [Dan Brown]
[EMAIL PROTECTED] wrote:


 Posting Summary for PHP-General List
 Week Ending: Friday, 4 January, 2008

 Messages| Bytes   | Sender
 +-+--
 4 (100%) 4305 (100%)  EVERYONE
 2(0.5%)  1100(0.26%)  Daniel Brown [EMAIL 
 PROTECTED]
 1(0.25%)  1532(0.36%)  TG [EMAIL PROTECTED]
 1(0.25%)  1673(0.39%)  Miren Urkixo [EMAIL 
 PROTECTED]

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





-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

-- 
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