[PHP] Re: Get free broadband internet from google!

2007-04-03 Thread Tijnema !

On 4/1/07, TheOldFellow [EMAIL PROTECTED] wrote:

On Sun, 1 Apr 2007 15:54:33 +0200
Tijnema ! [EMAIL PROTECTED] wrote:

 I'm testing if it works now, I already put the cable down into my
 toilet and waiting for google to connect me :) I hope they work on
 sunday too :)


I'll bet the service is crap.

R.


Yes the service is very crap. But that was because I didn't read that
it was only in the USA. Not in the Netherlands...

Well, I took the cable out of my toilet, and contacted my regular ISP
again and told them NOT to disconnect me.. :)

Tijnema


--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page



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



[PHP] mixture of GET and POST

2007-04-03 Thread Ross
I have 3 'action' buttons and I am trying to send the $id from the radio 
button and the action to the same page so I can either, Add Edit or Remove 
the property from the database.

Any ideas how I can get this to work? I can either POST the id's or GET the 
action but I can't seem to return both to the browser.

Ta,


R.

--

form id=form1 name=form1 method=post action=

div id=button_holder

a href=?action=addid=?=$id;?Add Property/a

a href=?action=removeRemove Property/a

a href=?action=editEdit Property/a

/div

div id=table_header

/div



table id=properties_table

?php

$query = SELECT * FROM properties;

$result= mysql_query($query);

while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){


?

trtd class=col_one input type=radio name=id value=? echo 
$row['property_id'];?/td

td class=col_two?php echo $row['property_id'];?/td

td class=col_one?php echo $row['address'];?/td

td class=col_two?php echo $row['postcode'];?/td

td class=col_one£500/td

td class=col_twoLive/td

/tr


?


} ?

/table

/form

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



Re: [PHP] mixture of GET and POST

2007-04-03 Thread clive
This has nothing to do with php, I suggest you read up on how html forms 
work and you may need to learn some javascript.


clive.



I have 3 'action' buttons and I am trying to send the $id from the radio 
button and the action to the same page so I can either, Add Edit or Remove 
the property from the database.


Any ideas how I can get this to work? I can either POST the id's or GET the 
action but I can't seem to return both to the browser.


Ta,


R.

--

form id=form1 name=form1 method=post action=

div id=button_holder

a href=?action=addid=?=$id;?Add Property/a

a href=?action=removeRemove Property/a

a href=?action=editEdit Property/a

/div

div id=table_header

/div



table id=properties_table

?php

$query = SELECT * FROM properties;

$result= mysql_query($query);

while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){


?

trtd class=col_one input type=radio name=id value=? echo 
$row['property_id'];?/td


td class=col_two?php echo $row['property_id'];?/td

td class=col_one?php echo $row['address'];?/td

td class=col_two?php echo $row['postcode'];?/td

td class=col_one£500/td

td class=col_twoLive/td

/tr


?


} ?

/table

/form




--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



Re: [PHP] Forking doesn't work on php 5.2.1?

2007-04-03 Thread Jochem Maas
Sebe wrote:
 Jochem Maas wrote:
 Frederic Belleudy wrote:
  
 Well Ill let you know guys if it works after I've recompiled apache
 

 try recompiling php - recompiling apache won't have an effect as far
 as that compile
 option goes.
  
   
 it will if php is complied statically into apache, then you have to
 recompile apache each time you compile php.. i use static because u get
 better performance, but that's another topic of it's own..

I see - I hadn't considered that. do you have any resources to point
to with regard to learning to compile php into apache statically?

 

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



Re: [PHP] secure database info in different environments

2007-04-03 Thread Jochem Maas
Bruce Cowin wrote:
 Hi,
 
 I have a generic database class that I built to connect to our different 
 databases.  From other posts that I've read, I think the safe thing is for me 
 to put this file outside the web root, ensure it has a .php extension, set 
 the include path to include this folder and include it in any pages that 
 require it.  Is this correct?
 
 Also, how do you handle the different environments: dev, test, and prod?  I 
 don't want to have to change the code every time I copy the file over.  Do I 
 have an independent file that determines if that folder should point to 
 dev/test/prod?

I generally use CVS to store my work and also to 'publish' stuff onto different 
setups/machines for testing/production,
rather than moving/copying files manually - I find it alot easier to type 'cvs 
up -r SOME_TAG' and just have all the
files updated with out having to think about which exactly files I must copy.

I usually end up with a small config file that is not included in the [cvs] 
project (so it must be created manually
for/in each installation) and have the project 'init' code check for the config 
file, require it and then test for the
existance of some required constants/variables/etc - if the file is missing, 
not readable or expected constants/vars/etc
are missing then the app dies with a suitable error message.

 
 Thanks for your help.
 
 
 
 Regards,
 
 Bruce
 

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



Re: [PHP] php 5 upgrade and background script on unix

2007-04-03 Thread Jochem Maas
Frederic Belleudy wrote:
 Jochem:
 won't it? what does it do? does it go into and endless loop and bring
 your machine to a halt
 by any chance? .. because by looking at it, as long as $in['bg'] is not
 set and not equal to
 true it's going to keep spawning sub-shells with cmdlines that call itself.
 
 Me:
 You haven't read my message? 

yes I did.

 It works fine when Im running it from the
 shell

the question was referring to what happens when running the exec() line
via the apache php module, I had thought that that was obvious.

 
 When I do:
 
 `/usr/local/bin/php /www/admin.gammacash.com/test/test_fork.php bg=1
 21 /var/log/test.log `
 you can see bg=1
 
 its the passing arguments!
 any other suggestions?

fix/debug it yourself.

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



Re: [PHP] Ide help needed

2007-04-03 Thread clive



Does anyone knows any IDE for PHP like VisualStudio.net?


look at delphi for php, its not delphi the language but a IDE written by 
borland to develop web apps using forms/drag 'n drop and php. Windows 
only im afraid and the only php IDE of its kind that Ive come across.


I use linux so I wont be using but you might like it.

http://codegear.com/Products/Delphi/DelphiforPHP/tabid/237/Default.aspx

--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


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



[PHP] php-mysql problem

2007-04-03 Thread Me2resh Lists

hi
i need help regarding a sql query in my php app.

the query is :
   $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
LIMIT $startingID,$items_numbers_list;

i want to sort this query by the number of the repeated EMail counts.
can anyone help me with that please ?


Re: [PHP] Ide help needed

2007-04-03 Thread Johan Martin

On 4/3/07, clive [EMAIL PROTECTED] wrote:



 Does anyone knows any IDE for PHP like VisualStudio.net?



Second the use of eclipse. Look at easyeclipse.org - they have all the
necessary plug-ins and add-ons in easy an easy to install package. Packages
available for Linux, Mac and Windows. Includes tools for Smarty, database
editing and html editing.


Re: [PHP] php-mysql problem

2007-04-03 Thread Jochem Maas
Me2resh Lists wrote:
 hi
 i need help regarding a sql query in my php app.
 
 the query is :
$SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;
 
 i want to sort this query by the number of the repeated EMail counts.
 can anyone help me with that please ?

somebody on a mysql mailing list per chance?
you are trying to solve a problem that is purely related to SQL query building,
this has nothing to do with php.

I would suggest you check out the mysql manual and read up on 'GROUP BY', 
'COUNT()'
and 'ORDER BY' - from your question I am guessing that these three hold the 
answer
to your problem between them

 

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



[PHP] Re: Get free broadband internet from google!

2007-04-03 Thread Joris Piepers

HAHAHA nice prank!

On 4/3/07, Tijnema ! [EMAIL PROTECTED] wrote:

On 4/1/07, TheOldFellow [EMAIL PROTECTED] wrote:
 On Sun, 1 Apr 2007 15:54:33 +0200
 Tijnema ! [EMAIL PROTECTED] wrote:

  I'm testing if it works now, I already put the cable down into my
  toilet and waiting for google to connect me :) I hope they work on
  sunday too :)


 I'll bet the service is crap.

 R.

Yes the service is very crap. But that was because I didn't read that
it was only in the USA. Not in the Netherlands...

Well, I took the cable out of my toilet, and contacted my regular ISP
again and told them NOT to disconnect me.. :)

Tijnema

 --
 http://linuxfromscratch.org/mailman/listinfo/blfs-support
 FAQ: http://www.linuxfromscratch.org/blfs/faq.html
 Unsubscribe: See the above information page

--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page



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



Re: [PHP] Cannot remove PHP Version 5.2.1-0.dotdeb.1

2007-04-03 Thread Miles Thompson

Mario,

That did it - when I tried to reload the phpinof.php script Apache did not
know what to do with the file.

Now I'll drag the compiler from it's dusty corner and start from scratch.

Thanks a million - Miles


On 4/2/07, Mario Guenterberg [EMAIL PROTECTED] wrote:


On Mon, Apr 02, 2007 at 04:52:02PM -0300, Miles Thompson wrote:
 This probably belongs under php-install, but thought I would try here
first,
 and it comes under the general header of Be careful what you wish for.

 On a new Ubuntu (Debian) server I installed this version of PHP because
I
 wanted some 5.2 features. It's the hardened version, and not the one we
 want.

 I have done the conventional aptitude remove php5, and then went to
all of
 the directories returned by whereis php5 and manually removed them.

 I've rebooted both the server and my own computer, and still a
 http://localhost/phpinfo.php returns the phpinfo() data AND shows
 configuration file paths: etc/php5/apache2 and /etc/php5/apache2/conf.d
 which have been deleted.

Try dpkg --purge php-5.2.1 or so.
You may have only the php binaries (CLI) removed.
This removes the config-scripts at all.
Apt-get remove libapache2-mod-php5 removes your apache2 modules and
the dpkt --purge libapache2-mod-php5 removes all the config scripts
of them.

I have build php 5.2.1 from source on Ubuntu 6.10 and it works
fine. Installad in /usr/local for some system reasons and of course
a easy way to upgrade.

Greetings
Mario
--
-
| havelsoft.com - Ihr Service Partner für Open Source |
| Tel:  033876-21 966 |
| Notruf: 0173-277 33 60  |
| http://www.havelsoft.com|
| |
| Inhaber: Mario Günterberg   |
| Mützlitzer Strasse 19   |
| 14715 Märkisch Luch |
-






Re: [PHP] mixture of GET and POST

2007-04-03 Thread itoctopus
Mainly you have to add  a javascript to submit on click (plenty of them by
searching on google). You don't need the href links (I think they're wrong
anyway), you can just have # instead, and you should pass the params to the
submit function.

Simple search on google for your case:
http://www.quirksmode.org/js/forms.html

--
itoctopus - http://www.itoctopus.com
clive [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 This has nothing to do with php, I suggest you read up on how html forms
 work and you may need to learn some javascript.

 clive.



  I have 3 'action' buttons and I am trying to send the $id from the radio
  button and the action to the same page so I can either, Add Edit or
Remove
  the property from the database.
 
  Any ideas how I can get this to work? I can either POST the id's or GET
the
  action but I can't seem to return both to the browser.
 
  Ta,
 
 
  R.
 
  --
 
  form id=form1 name=form1 method=post action=
 
  div id=button_holder
 
  a href=?action=addid=?=$id;?Add Property/a
 
  a href=?action=removeRemove Property/a
 
  a href=?action=editEdit Property/a
 
  /div
 
  div id=table_header
 
  /div
 
 
 
  table id=properties_table
 
  ?php
 
  $query = SELECT * FROM properties;
 
  $result= mysql_query($query);
 
  while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)){
 
 
  ?
 
  trtd class=col_one input type=radio name=id value=? echo
  $row['property_id'];?/td
 
  td class=col_two?php echo $row['property_id'];?/td
 
  td class=col_one?php echo $row['address'];?/td
 
  td class=col_two?php echo $row['postcode'];?/td
 
  td class=col_one£500/td
 
  td class=col_twoLive/td
 
  /tr
 
 
  ?
 
 
  } ?
 
  /table
 
  /form
 


 --
 Regards,

 Clive.

 Real Time Travel Connections


 {No electrons were harmed in the creation, transmission or reading of
 this email. However, many were excited and some may well have enjoyed
 the experience.}

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



[PHP] Re: php-mysql problem

2007-04-03 Thread itoctopus
$sql = SELECT count(Email) as numEmails, Email FROM mena_guests WHERE
Voted='yes' GROUP BY Email ORDER BY numEmails DESC LIMIT $startingID,
$items_numbers_list;

--
itoctopus - http://www.itoctopus.com
Me2resh Lists [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hi
 i need help regarding a sql query in my php app.

 the query is :
 $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;

 i want to sort this query by the number of the repeated EMail counts.
 can anyone help me with that please ?


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



RE: [PHP] Saving css state in javascript and passing to php via form submit

2007-04-03 Thread Tim
The weather in here gets stormy easily i see :D

Anyways thanks Richard, that's the kind of idea i was orginally looking for,
before opting for the ajax way, which is only going to optimize my
application more and give me more flexibility in doing what i need.
Have looked up javascript and DOM and now understand how to dynamically
create content from javascript that can later be interpreted by a php form.
In any case everyones input was great, got a lot of ideas out of it.

Thanks all ;)

P.S. Sorry for the delicately on/off topic, was inbetween languages here,
and since i'm more familiar with your input i oppted for this list ;) 

Tim

 -Message d'origine-
 De : Richard Lynch [mailto:[EMAIL PROTECTED] 
 Envoyé : dimanche 1 avril 2007 07:39
 À : Tim
 Cc : php-general@lists.php.net
 Objet : Re: [PHP] Saving css state in javascript and passing 
 to php via form submit
 
 On Fri, March 30, 2007 9:45 am, Tim wrote:
  My issue is on page reload, i have a form on the same page, when a 
  category is clicked, the categorie info displays and you can update 
  the info through this form (table and form on same page). My issue 
  comes when i post the data, the page comes back and my 
 category tree 
  folds up which is normal because all divs are set to 
 display:none;.
 
 Just fought through something like this today...
 
 form id=styles_saver ...
   input type=submit onclick=save_styles(); / /form 
 script type=text/javascript function save_styles(){
   var div;
   var styles_saver=document.getElementById('styles_saver');
   foreach(divs as d){
 div = divs[d];
 styles_saver.innerHTML += 'input type=hidden name=style[' + d
 + '] value=' + div.style ' /';
   }
   styles_saver.submit();
 /script
 
 This is all JS, obviously...
 
  What are the technologies IF there are any and what should 
 i look up 
  to find docs that cover this type of datatransfer ie: 
 javascript-php.
 
 So now in the PHP part, to force this at least nominally 
 on-topic, you have a nice array in $_POST['styles'] with an 
 index by div in order, that you'd process like any $_POST 
 value which is an array:
 
 if (isset($_POST['styles'])  is_array($_POST['styles'])){
   foreach($_POST['styles'] as $d = $style){
 //do something with div's $style, indexed by $d
   }
 }
 
 You could presumably get each div's id with div.id or 
 somesuch, and use that instead of 'd' above.
 
 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?
 

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



Re: [PHP] Cannot remove PHP Version 5.2.1-0.dotdeb.1

2007-04-03 Thread Mario Guenterberg
On Tue, Apr 03, 2007 at 08:50:31AM -0300, Miles Thompson wrote:
 Mario,
 
 That did it - when I tried to reload the phpinof.php script Apache did not
 know what to do with the file.
 
 Now I'll drag the compiler from it's dusty corner and start from scratch.

Not the debian/ubuntu way but sometimes the best solution ;-)

 Thanks a million - Miles
:-)

Greetings
Mario

-- 
 -
| havelsoft.com - Ihr Service Partner für Open Source |
| Tel:  033876-21 966 |
| Notruf: 0173-277 33 60  |
| http://www.havelsoft.com|
| |
| Inhaber: Mario Günterberg   |
| Mützlitzer Strasse 19   |
| 14715 Märkisch Luch |
 -


signature.asc
Description: Digital signature


Re: [PHP] php-mysql problem

2007-04-03 Thread clive

Me2resh Lists wrote:

the query is :
   $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
LIMIT $startingID,$items_numbers_list;


the only php I see it $SQL,$startingID,$items_numbers_list. This is a 
mysql question.


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



RE: [PHP] php-mysql problem

2007-04-03 Thread Jim Moseby
 i need help regarding a sql query in my php app.
 
 the query is :
 $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE 
 Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;
 
 i want to sort this query by the number of the repeated EMail counts.
 can anyone help me with that please ?


A)  Is this a PHP question?  If so, please post the PHP code you are having
trouble with.

B)  While you could dump the results of your query into an array, and use
sort() or the other array sorting methods to sort it any way you wanted to
(thus making this a PHP question), it would certainly be more efficient to
have MySQL return a properly sorted result set to begin with.

C)  It appears that by your use of DISTINCT(), you will not have repeating
EMail values in your result set, thus you could not sort it by repeating
emails. 

D)  You will find many more relevant answers and many more willing
participants if you were to post your question to a MySQL oriented list.

JM

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



Re: [PHP] php-mysql problem

2007-04-03 Thread cajbecu
clive wrote:
 Me2resh Lists wrote:
 the query is :
$SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;
 
 the only php I see it $SQL,$startingID,$items_numbers_list. This is a
 mysql question.
 

so, you don`t know the answer, right?

cajb.

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



Re: [PHP] php-mysql problem

2007-04-03 Thread Jochem Maas
cajbecu wrote:
 clive wrote:
 Me2resh Lists wrote:
 the query is :
$SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;
 the only php I see it $SQL,$startingID,$items_numbers_list. This is a
 mysql question.

 
 so, you don`t know the answer, right?

maybe he does maybe he doesn't - the point is trying to educate people
as to the best/correct place to ask questions. questions related purely
to SQL should be dealt with else where in cyberspace.

if I asked you whether your wife/girlfriend enjoyed having sex with
your best friend while you are at work then you may or may not know the
answer but it is hopefully clear that this is not the list to ask such a
question (but no doubt that there is a list somewhere that caters to that
kind of shit) ... conceptually what goes for your other half also goes for SQL.

 
 cajb.
 

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



Re: [PHP] Show filenames using Wildcards -- The glob() Solution!

2007-04-03 Thread Rahul Sitaram Johari

Ave,

I understand what you're saying, and logically I guess I need to validate $F
and verify if it contains a concoction of what I want to be publicly
accessible, and nothing else.

Is there any other suggestions you can provide in helping secure this flaw?


~~~
Rahul Sitaram Johari
CEO, Twenty Four Seventy Nine Inc.

W: http://www.rahulsjohari.com
E: [EMAIL PROTECTED]

³I morti non sono piu soli ... The dead are no longer lonely²



On 4/1/07 1:59 AM, Richard Lynch [EMAIL PROTECTED] wrote:
 
 The problem is that with readfile($F) you've just made ALL the files
 that PHP can read *also* publicly accessible.
 
 This includes all your PHP source code, /etc/passwd, and all around
 *WAY* too much stuff all over your server.

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



Re: [PHP] php-mysql problem

2007-04-03 Thread clive

cajbecu wrote:

clive wrote:

Me2resh Lists wrote:

the query is :
   $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
LIMIT $startingID,$items_numbers_list;

the only php I see it $SQL,$startingID,$items_numbers_list. This is a
mysql question.



so, you don`t know the answer, right?

cajb.

Well if I understand the question correctly, then yes I could have an 
answer.


I have solved something similar a while back, unfortunately I don't 
remember the correct sql and would have too populate a db table and try 
a few sql commands which is something me2resh should do until he gets 
the correct results.


clive

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



Re: [PHP] php-mysql problem

2007-04-03 Thread clive



if I asked you whether your wife/girlfriend enjoyed having sex with
your best friend while you are at work then you may or may not know the
answer but it is hopefully clear that this is not the list to ask such a
question (but no doubt that there is a list somewhere that caters to that
kind of shit) ... conceptually what goes for your other half also goes for SQL.


ha ha thats funny, but true and well explained :)
-

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



[PHP] sapi_add_header_ex() violating CODING_STANDARDS

2007-04-03 Thread js

Hi list.

I don't think this is the right place to talk about this,
but writing PHP extensions I found that sapi_add_header_ex() in SAPI.c
is violating a law of PHP CODING_STANDARDS, which says

[1] Functions that are given pointers to resources should not free them
*snip*
Exceptions:
 - The function's designated behavior is freeing that resource.  E.g. efree()
 - The function is given a boolean argument, that controls whether or not
   the function may free its arguments (if true - the function must free its
   arguments, if false - it must not)
*snip*


Take a look at the source and you'll see the following code

   if (!duplicate)
   efree(header_line);

not so intuitive.

Is this a bug?

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



Re: [PHP] sapi_add_header_ex() violating CODING_STANDARDS

2007-04-03 Thread Jochem Maas
js wrote:
 Hi list.
 
 I don't think this is the right place to talk about this,
 but writing PHP extensions I found that sapi_add_header_ex() in SAPI.c
 is violating a law of PHP CODING_STANDARDS, which says
 
 [1] Functions that are given pointers to resources should not free them
 *snip*
 Exceptions:
  - The function's designated behavior is freeing that resource.  E.g.
 efree()
  - The function is given a boolean argument, that controls whether or not
the function may free its arguments (if true - the function must free
 its
arguments, if false - it must not)
 *snip*
 
 
 Take a look at the source and you'll see the following code
 
if (!duplicate)
efree(header_line);
 
 not so intuitive.
 
 Is this a bug?

from your explaination above one could infer that it was a transgression with
regard to CS. whether you could consider it a bug would depend on whether the 
code
in question actually caused problems or not ... the efree() at the point may 
have been
placed there conscientiously by someone who knew the CS rules and had good 
reason to
break them in this instance.

for a real answer I would recommend post a friendly question at 
internals@lists.php.net
(you might consider replacing the 'a bug' with something less inclined to 
illicit a
negative response, e.g. 'intentional'?)

 

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



Re: [PHP] mixture of GET and POST

2007-04-03 Thread tg-php
As mentioned, this isn't a PHP issue really, except a little bit on the 
receiving end.

Why not use multiple 'submit' buttons instead of using HREF links?

input type=submit name=action value=Add
input type=submit name=action value=Edit
input type=submit name=action value=Remove

In PHP, you'd just check the value of $_POST['action']

You can also do it with image submit buttons, just have to change the name of 
each one:

input type=image name=action_add src=images/add.jpg
input type=image name=action_edit src=images/edit.jpg
input type=image name=action_remove src=images/remove.jpg

In PHP, you'd check for the existance of $_POST['action_add.x'] or 
$_POST['action_add.y'] or the corresponding X and Y for edit and remove.   It 
sends the coordinates of where on the image the user clicked but works just 
like a submit button, so you'll get your radio data too.


If you're dead set on using HREF links, then you're going to have to use some 
Javascript to probably set some values (possibly in a hidden form element) and 
submit the form.

-TG

= = = Original message = = =

I have 3 'action' buttons and I am trying to send the $id from the radio 
button and the action to the same page so I can either, Add Edit or Remove 
the property from the database.

Any ideas how I can get this to work? I can either POST the id's or GET the 
action but I can't seem to return both to the browser.

Ta,


R.

--

form id=form1 name=form1 method=post action=

div id=button_holder

a href=?action=addid=?=$id;?Add Property/a

a href=?action=removeRemove Property/a

a href=?action=editEdit Property/a

/div

div id=table_header

/div



table id=properties_table

?php

$query = SELECT * FROM properties;

$result= mysql_query($query);

while ($row = @mysql_fetch_array($result, MYSQL_ASSOC))


?

trtd class=col_one input type=radio name=id value=? echo 
$row['property_id'];?/td

td class=col_two?php echo $row['property_id'];?/td

td class=col_one?php echo $row['address'];?/td

td class=col_two?php echo $row['postcode'];?/td

td class=col_one~500/td

td class=col_twoLive/td

/tr


?


 ?

/table

/form

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



___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



RE: [PHP] Downloads for subsrcibers only

2007-04-03 Thread Jake McHenry
A while ago I did this, but can't find the file now... I dunno if it would
work for you or not, but it did for me I took the first 10 characters of
the session id and created a symlink to the doc file, or pdf in your case,
then the person got the file. When they logged out, the symlink was deleted.
As long as the original file is not web accessable, no one can ever get it
unless they're logged in. :)

Jake

 -Original Message-
 From: Daevid Vincent [mailto:[EMAIL PROTECTED] 
 Sent: Monday, April 02, 2007 4:10 PM
 To: php-general@lists.php.net
 Cc: 'Mário Gamito'
 Subject: RE: [PHP] Downloads for subsrcibers only
 
 Look at mod_auth_mysql. Then authenticate your pdf directory 
 against that
 database of users. 
 
 Otherwise anyone who knows the direct link to your PDF can 
 download it,
 bypassing all your 'subscription' security. 
 
  -Original Message-
  From: Mário Gamito [mailto:[EMAIL PROTECTED] 
  Sent: Sunday, April 01, 2007 1:54 AM
  To: php-general@lists.php.net
  Subject: [PHP] Downloads for subsrcibers only
  
  Hi,
  
  I made this site in PHP that has a page with some PDFs to download.
  My costumer wants that only subscribed people are allowed 
 to download
  the PDFs.
  
  I've already made the subscrbe and login mechanism.
  
  Now, my question for you is about letting only subscribers 
  download the
  PDFs.
  What is the best approach ?
  Register a session when they login and then in the PDFs page apply a
  
  if email is registered
you can download the PDFs
  else
you can't
  
  Something like this ?
  Or is it there a better way ?
  
  Any help would be appreciated.
  
  Warm Regards
  -- 
  :wq! Mário Gamito
  
  -- 
  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
 
 
 -- 
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.5.446 / Virus Database: 268.18.24/742 - Release 
 Date: 4/1/2007 8:49 PM
  
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.25/744 - Release Date: 4/3/2007
5:32 AM
 

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



Re: [PHP] sapi_add_header_ex() violating CODING_STANDARDS

2007-04-03 Thread js

Hi Jochem.

On 4/3/07, Jochem Maas [EMAIL PROTECTED] wrote:

from your explaination above one could infer that it was a transgression with
regard to CS. whether you could consider it a bug would depend on whether the 
code
in question actually caused problems or not ... the efree() at the point may 
have been
placed there conscientiously by someone who knew the CS rules and had good 
reason to
break them in this instance.

for a real answer I would recommend post a friendly question at 
internals@lists.php.net
(you might consider replacing the 'a bug' with something less inclined to 
illicit a
negative response, e.g. 'intentional'?)


agreed. 'a bug' is not a word for this kind of problem because I just
wanted to know,
as you said, whether this is intentional or not.

Thanks you for your useful advice.

Regards.

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



[PHP] Checking password

2007-04-03 Thread Panquekas

Hello,

I just want to ask if when I have the magic_quotes_gpc ON and use the
preg_quote is there an problem? One doesn't eliminate the other or does?

Anyway, I'm trying to insert values to the DataBase in a secure way.. by
checking the special chars (with preg_quote), htmlentities is this a good
policie?

Thanks in advance.

PS: Sorry my english, I'm a little rusted :)


Re: [PHP] Checking password

2007-04-03 Thread Jochem Maas
Panquekas wrote:
 Hello,
 
 I just want to ask if when I have the magic_quotes_gpc ON and use the
 preg_quote is there an problem? One doesn't eliminate the other or does?

magic_quotes_gpc sucks - I recommend turning it off, for portability (when your
running on a machine with magic_quotes_gpc on, you could consider a bit of
code that conditionally undoes the add_slashes.

 
 Anyway, I'm trying to insert values to the DataBase in a secure way.. by
 checking the special chars (with preg_quote), htmlentities is this a good
 policie?

bad bad bad.
preg_quote is specifically for escaping strings you intend to use inside a 
regular
expression that you feed to one of the preg_*() functions, it's purpose to make 
it
easy for you to use strings that may contain characters that have special 
meaning to
preg_*() in situations where you want the literal character to be used as part 
of the
assertion.

let's assume your database is mysql, then you should be using 
mysql_real_escape_string()
to escape data that will become part of your SQL queries ... the fact that 
magic_quotes_gpc
is on will make this more problematic because you really want to get rid of the 
automatically
added slashes because other wise you'll end up with slashes in text that has 
been entered into
your database that were actually meant to be escape characters.

I hope that is a little clear, probably not heh! anyway go have a read and a 
play with mysql_real_escape_string()
and do a bit of research about magic_quotes_gpc and see how far you get ... you 
can always
come back here if your head starts to spin.

 
 Thanks in advance.
 
 PS: Sorry my english, I'm a little rusted :)

we recommend Rusteze(r) medicated bumper ointment, you too could look like me, 
kachow!

(that comment couldn't be helped, I've watched 'Cars', the movie, about 300 
times)

 

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



[PHP] Question about form submitting

2007-04-03 Thread Mário Gamito
Hi,

Sorry for the lame question, but i didn't find a satisfactory answer in
the web.

I have this subscribe form (subscribe.php) and on submit i have to check
for errors:

a) password and password confirmation mismatch;
b) missing filled fields
c) check e-mail validity
d) etc.

My question is how do i make all these possibilities show a different
error message without leaving subscribe.php ?

I know that the for action must be subscribe.php, from there i'm blind
as a bat.

Any help would be appreciated.

Warm Regards
-- 
:wq! Mário Gamito

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



Re: [PHP] Question about form submitting

2007-04-03 Thread Tijnema !

On 4/3/07, Mário Gamito [EMAIL PROTECTED] wrote:

Hi,

Sorry for the lame question, but i didn't find a satisfactory answer in
the web.

I have this subscribe form (subscribe.php) and on submit i have to check
for errors:

a) password and password confirmation mismatch;
b) missing filled fields
c) check e-mail validity
d) etc.

My question is how do i make all these possibilities show a different
error message without leaving subscribe.php ?

I know that the for action must be subscribe.php, from there i'm blind
as a bat.

Any help would be appreciated.

Warm Regards
--
:wq! Mário Gamito


This can only be done with Javascript if you don't want to leave the page.
And so, you're on the wrong list, search for a javascript list :)

Tijnema


--
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] Question about form submitting

2007-04-03 Thread Dave Goodchild

Not true. You can submit the form back to itself as many times as required
by making the form action $_SERVER['PHP_SELF'] and checking for various
sequences and outputting different html in each case.


Re: [PHP] Question about form submitting

2007-04-03 Thread Tijnema !

On 4/3/07, Dave Goodchild [EMAIL PROTECTED] wrote:

Not true. You can submit the form back to itself as many times as required
by making the form action $_SERVER['PHP_SELF'] and checking for various
sequences and outputting different html in each case.


You're then leaving the page and reloading it

Tijnema

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



Re: [PHP] Question about form submitting

2007-04-03 Thread Myron Turner

Mário Gamito wrote:

Hi,

Sorry for the lame question, but i didn't find a satisfactory answer in
the web.

I have this subscribe form (subscribe.php) and on submit i have to check
for errors:

a) password and password confirmation mismatch;
b) missing filled fields
c) check e-mail validity
d) etc.

My question is how do i make all these possibilities show a different
error message without leaving subscribe.php ?

I know that the for action must be subscribe.php, from there i'm blind
as a bat.

Any help would be appreciated.

Warm Regards
  



--

_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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



Re: [PHP] Google-Yahoo venture and PHP

2007-04-03 Thread Tijnema !

On 4/3/07, Chris [EMAIL PROTECTED] wrote:

Matt Kay wrote:
 I really dont see what all the fuss is about. If MS is going to have us all
 running
 on thin clients, and Google/Yahoo want to beat them to the punch, is this
 really
 going to matter who we pay? The article on digg.com
 http://digg.com/tech_news/Google_Yahoo_Merger_Redefines_Access
 simply means we will be getting our desktop as a service, and MS have the
 same
 goal. PHP will only be a small part of this if Zend decide to throw thier
 lot in also.

Did you look at the date? ;)


Digg shows us that it is posted on 3/31/07, is there something wrong with?

Tijnema


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

--
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] Question about form submitting

2007-04-03 Thread Lori Lay

Tijnema ! wrote:

On 4/3/07, Mário Gamito [EMAIL PROTECTED] wrote:

Hi,

Sorry for the lame question, but i didn't find a satisfactory answer in
the web.

I have this subscribe form (subscribe.php) and on submit i have to check
for errors:

a) password and password confirmation mismatch;
b) missing filled fields
c) check e-mail validity
d) etc.

My question is how do i make all these possibilities show a different
error message without leaving subscribe.php ?

I know that the for action must be subscribe.php, from there i'm blind
as a bat.

Any help would be appreciated.

Warm Regards
--
:wq! Mário Gamito


This can only be done with Javascript if you don't want to leave the 
page.

And so, you're on the wrong list, search for a javascript list :)

Tijnema

Actually, that's not quite true.  It's usually easier in Javascript, but 
if you want to do a pure PHP method, read on.  This does require that 
you use the POST method for your form, but that's usually preferred anyway.


?php if ($_SERVER['REQUEST_METHOD'] == 'GET') { ?
form action=?php echo $_SERVER['SCRIPT_NAME'] ? method=post
  // Regular form contents go here
/form
?php } else {
  // Insert form processing code here - including field validation
}
?

This uses the PHP SCRIPT_NAME server variable for the form name so that 
you don't have to worry about the script location and you can move it if 
necessary without having to change the script.  I copied this from PHP 
Cookbook by O'Reilly.  It's not a bad book, if you can get it where you 
are...


Lori

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



[PHP] Why do some pages repeat a previous page's action(s) after redirect?

2007-04-03 Thread Chris W. Parker
Hello,
 
I have a form page and a processing page. After submitting the form the
processing page does whatever it needs to do (insert a record, send back
validation errors, etc.) After determing what to do it always redirects
somewhere with header('Location: URL');

But sometimes when I'm back at the form page (after the redirect) and I
refresh the page it does the previous page's actions again. And again
and again.

Why would it do that? Shouldn't a refresh just resubmit whatever is in
the address bar and not go through a certain path?

The only way I've found to make it stop redoing the previous page's
actions is to put my cursor in the address bar and press enter.

I don't remember seeing this behavior in the past so I wonder if it has
something to do with Apache's or PHP's configuration.
 
 
Thanks,
Chris.

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



Re: [PHP] Why do some pages repeat a previous page's action(s) after redirect?

2007-04-03 Thread Tijnema !

On 4/3/07, Chris W. Parker [EMAIL PROTECTED] wrote:

Hello,

I have a form page and a processing page. After submitting the form the
processing page does whatever it needs to do (insert a record, send back
validation errors, etc.) After determing what to do it always redirects
somewhere with header('Location: URL');

But sometimes when I'm back at the form page (after the redirect) and I
refresh the page it does the previous page's actions again. And again
and again.

Why would it do that? Shouldn't a refresh just resubmit whatever is in
the address bar and not go through a certain path?

The only way I've found to make it stop redoing the previous page's
actions is to put my cursor in the address bar and press enter.

I don't remember seeing this behavior in the past so I wonder if it has
something to do with Apache's or PHP's configuration.


Thanks,
Chris.


This is the only behavior i know of, a refresh action does the same
action he did for loading the current page again. If you submit data
to that page, it will resubmit the data. If you're using the
Location:URL header entry, the browser doesn't saves this action as
an action did by the browser itself, and so it will submit the data to
the page where you redirect. If you want to bypass this, you should
use the javascript window.location method instead.

Tijnema


--
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] Why do some pages repeat a previous page's action(s) after redirect?

2007-04-03 Thread Jake McHenry
I've seen this a lot with IE, it even warns you about it, the warning from
IE is:

The page cannot be refreshed without resending the information. Click Retry
to send the information again, or click Cancel to return to the page that
you were trying to view.

And through all my days, when you click cancel, the work offline page
appears instead of the page you were on..  Just another reason not to
use IE But this was the only place I remembered that warning from

Jake
 

 -Original Message-
 From: Chris W. Parker [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, April 03, 2007 2:39 PM
 To: PHP
 Subject: [PHP] Why do some pages repeat a previous page's 
 action(s) after redirect?
 
 Hello,
  
 I have a form page and a processing page. After submitting 
 the form the
 processing page does whatever it needs to do (insert a 
 record, send back
 validation errors, etc.) After determing what to do it always 
 redirects
 somewhere with header('Location: URL');
 
 But sometimes when I'm back at the form page (after the 
 redirect) and I
 refresh the page it does the previous page's actions again. And again
 and again.
 
 Why would it do that? Shouldn't a refresh just resubmit whatever is in
 the address bar and not go through a certain path?
 
 The only way I've found to make it stop redoing the previous page's
 actions is to put my cursor in the address bar and press enter.
 
 I don't remember seeing this behavior in the past so I wonder 
 if it has
 something to do with Apache's or PHP's configuration.
  
  
 Thanks,
 Chris.
 
 -- 
 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.446 / Virus Database: 268.18.25/744 - Release 
 Date: 4/3/2007 5:32 AM
  
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.25/744 - Release Date: 4/3/2007
5:32 AM
 

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



RE: [PHP] Why do some pages repeat a previous page's action(s) after redirect?

2007-04-03 Thread Chris W. Parker
On Tuesday, April 03, 2007 11:44 AM Tijnema ! mailto:[EMAIL PROTECTED]
said:

 This is the only behavior i know of, a refresh action does the same
 action he did for loading the current page again. If you submit data
 to that page, it will resubmit the data. If you're using the
 Location:URL header entry, the browser doesn't saves this action as
 an action did by the browser itself, and so it will submit the data to
 the page where you redirect. If you want to bypass this, you should
 use the javascript window.location method instead.

formpage.php:

html

form method=get action=process.php
/form

/html

process.php:

?php

// do stuff
// ...

header(Location: http://www.domain.com/formpage.php;);
exit;

?

With those two pages in mind you're saying that after I submit the form
on formpage.php, do stuff on process.php, then get redirected back to
formpage.php that it will replay my form submission when I hit refresh?


Thanks,
Chris.

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



Re: [PHP] Question about form submitting / clarification

2007-04-03 Thread Mário Gamito
Hi,
 Of the three items you specify a and b should be handled with Javascript
 in an onsubmit handler.  The error messages would be generated by this
 handler.  Email validity would have to be handled by the web server and
 your php script, usually by trying the address.
I think i was misunderstood.
I know how to do the error handling.
What i don't know is how to display the error messages in the same page
as the submit form.

Warm Regards
-- 
:wq! Mário Gamito

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



Re: [PHP] Downloads for subsrcibers only

2007-04-03 Thread Eric Butera

On 4/1/07, Mário Gamito [EMAIL PROTECTED] wrote:

Hi,

I made this site in PHP that has a page with some PDFs to download.
My costumer wants that only subscribed people are allowed to download
the PDFs.

I've already made the subscrbe and login mechanism.

Now, my question for you is about letting only subscribers download the
PDFs.
What is the best approach ?
Register a session when they login and then in the PDFs page apply a

if email is registered
  you can download the PDFs
else
  you can't

Something like this ?
Or is it there a better way ?

Any help would be appreciated.

Warm Regards
--
:wq! Mário Gamito

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




One popular method is to place your files outside of the webroot.
This makes it so people cannot access the files directly.  Then create
a PHP script to read the file to the user with the correct mime type
using a header() call.  This way you force the user to have an
authenticated session before a file download is started.


Re: [PHP] Why do some pages repeat a previous page's action(s) after redirect?

2007-04-03 Thread Chris Shiflett
Hi Chris,

 But sometimes when I'm back at the form page (after the redirect)
 and I refresh the page it does the previous page's actions again.

Can you provide a raw HTTP dump of the complete scenario?

Chris

-- 
Chris Shiflett
http://shiflett.org/

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



Re: [PHP] Why do some pages repeat a previous page's action(s) after redirect?

2007-04-03 Thread Chris Shiflett
Tijnema wrote:
 If you're using the Location:URL header entry, the browser doesn't
 saves this action as an action did by the browser itself, and so
 it will submit the data to the page where you redirect.

Either you misunderstood his question, or you misunderstand what
header('Location: ...') does. Or both.

Chris

-- 
Chris Shiflett
http://shiflett.org/

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



Re: [PHP] Question about form submitting / clarification

2007-04-03 Thread Lori Lay

Mário Gamito wrote:

Hi,
  

Of the three items you specify a and b should be handled with Javascript
in an onsubmit handler.  The error messages would be generated by this
handler.  Email validity would have to be handled by the web server and
your php script, usually by trying the address.


I think i was misunderstood.
I know how to do the error handling.
What i don't know is how to display the error messages in the same page
as the submit form.

Warm Regards
  


To expand on my previous response:  create a function that displays the 
form and takes an errors array as an argument.  The function would 
display the form with print commands that would display the error 
messages.  If there are no errors, then just the form is displayed, but 
if there are errors they are printed right next to the form element.


For example:

in display form function:

$defaults['name'] = isset($_POST['name']) ? htmlentities($_POST['name']) 
: ' ';


tdYour Name:/td
td?php print_error('name', $errors) ?
input type='text' name='name' value='?php echo $defaults['name'] ?' 
//td



You will also need a print error function that takes the input element 
name and errors array as arguments.  The $defaults variable is set to 
blank if the form is being displayed for the first time or the value 
input by the user if the form is being redisplayed after validation by 
using the POST variables.


Lastly you will need a form validation function that would populate the 
errors array.  This would be an associative array with the form field 
names as keys and the error messages as values.


The entire code is available in the book I mentioned previously.  I 
can't replicate it here due to the obvious copyright issues, although 
the example code is available on O'Reilly's site 
(http://www.oreilly.com/)  Search for PHP Cookbook and select the second 
edition.


This is all very difficult to explain in an email, but hopefully I've 
given you enough to chew on, as it were...


Lori

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



Re: [PHP] Downloads for subsrcibers only

2007-04-03 Thread Mário Gamito
Hi,

 One popular method is to place your files outside of the webroot.
I thought about that.

 This makes it so people cannot access the files directly.  Then create
 a PHP script to read the file to the user with the correct mime type
 using a header() call.
Humm... and how do i do this, if i may ask ?

I'm much a system's administrator than a PHP programmer.

Warm Regards
-- 
:wq! Mário Gamito

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



[PHP] Re: Why do some pages repeat a previous page's action(s) after redirect?

2007-04-03 Thread Mark
Do yo
Chris W. Parker wrote:

Quick question: Do you use frames and does the behavior of your code depend
on data stored from page to page? If so, what kind of session system do you
use?

 Hello,
  
 I have a form page and a processing page. After submitting the form the
 processing page does whatever it needs to do (insert a record, send back
 validation errors, etc.) After determing what to do it always redirects
 somewhere with header('Location: URL');
 
 But sometimes when I'm back at the form page (after the redirect) and I
 refresh the page it does the previous page's actions again. And again
 and again.
 
 Why would it do that? Shouldn't a refresh just resubmit whatever is in
 the address bar and not go through a certain path?
 
 The only way I've found to make it stop redoing the previous page's
 actions is to put my cursor in the address bar and press enter.
 
 I don't remember seeing this behavior in the past so I wonder if it has
 something to do with Apache's or PHP's configuration.
  
  
 Thanks,
 Chris.

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



RE: [PHP] Why do some pages repeat a previous page's action(s) after redirect?

2007-04-03 Thread Chris W. Parker
On Tuesday, April 03, 2007 12:35 PM Chris Shiflett
mailto:[EMAIL PROTECTED] said:

 But sometimes when I'm back at the form page (after the redirect)
 and I refresh the page it does the previous page's actions again.
 
 Can you provide a raw HTTP dump of the complete scenario?

Two things:

1. How do I do that?

2. The issue has gone away. I don't know what I've done differently. I
haven't changed the way I handle sessions, redirects, or form
submission. All that stuff is still the same.



Chris.

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



Re: [PHP] Why do some pages repeat a previous page's action(s) after redirect?

2007-04-03 Thread Chris Shiflett
  Can you provide a raw HTTP dump of the complete scenario?
 
 Two things:
 
 1. How do I do that?

Probably the easiest thing to do these days is use a Firefox extension
like Firebug or LiveHTTPHeaders.

Chris

-- 
Chris Shiflett
http://shiflett.org/

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



Re: [PHP] Audio CAPTCHA review request

2007-04-03 Thread jochem

Since you are asking for review: this audio captcha is almost certainly
easily breakable.

Tijnema is right with most of his comments, open source voice recognition
software (the code he pointed to like spynx) will break this.

I disagree with his point 3) below, obfuscating the speech with different
bitrates etc. will in my opinion not work.

How do I know? Unfortunately i do not have the time to properly test it, but
I wrote a devoicecaptcha script to break the voice captchas of microsoft,
google and paypal. You can download the code and test it with your code, see
http://vorm.net/captchas. 

So unfortunately for you it will not work against spammers, but you are in
good company of people trying ;-). 

Regards,

Jochem.


Tijnema ! wrote:
 
 snip
 
 I would like to give a few comments on your script:
 
 1) it looks like that
 http://www.sperling.com/examples/captcha/tmp/access.mp3, without a
 code, always returns the same value :) 284
 
 2) About the timeout, you should set it at least less then 24 hrs, i
 should do about 6 hrs, that's enough for somebody to enter the code,
 but a hacker doesn't want to update his code every 6 hrs.
 
 3) Then about the cracking of audio, if you keep the audio files the
 same, it shouldn't be too hard to crack once you can read the audio
 frames. Store each few audio frames for each number, and compare them
 once you want to crack it.
 A very simple way to avoid this is that you generate audio on
 different bit rates. and use VBR/CBR randomly. Speech recognition
 isn't working very well, and i don't think it would be able to get
 these numbers from the audio, but I have too less experience with
 speech recognition.
 
 4) You couldn't only depend on this audio thing inside a script. I
 know this has been said before, but when you are using images here, it
 probably makes your script more insecure.
 
 But it's surely nice done :)
 
 Tijnema
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Audio-CAPTCHA-review-request-tf3487541.html#a9826752
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] Downloads for subsrcibers only

2007-04-03 Thread Eric Butera

On 4/3/07, Mário Gamito [EMAIL PROTECTED] wrote:

Hi,

 One popular method is to place your files outside of the webroot.
I thought about that.

 This makes it so people cannot access the files directly.  Then create
 a PHP script to read the file to the user with the correct mime type
 using a header() call.
Humm... and how do i do this, if i may ask ?

I'm much a system's administrator than a PHP programmer.

Warm Regards
--
:wq! Mário Gamito



?php
session_start();
if (! isset($_SESSION['authenticated']) ) {
   die(Error);
}

$file = $_GET['file'];

// try to sanitize the filename
if (preg_match('/[^A-Za-z0-9._]/', $file)) {
   die(Invalid filename.);
}

$path = dirname(__FILE__) .'/../';
$full = $path . $file;

if (! is_readable($full) ) {
   die(File isn't readable.);
}

header('Content-type: application/pdf');
header(Content-Length:  . filesize($full));
header('Content-disposition: attachment; filename='. basename($file) .'');
readfile($full);
?

If you were to place this in the webroot of the site say
/home/user/webdocs/readfile.php

...and then put your files in...
/home/user/

...this would get the job done.

You can access it by readfile.php?file=file.pdf.  It would only work
for pdfs because of the content type header.  You could add a little
more flexibility with the Fileinfo extension to read the mime type or
do it based on the file extension if you wanted.  Hope this helps get
you started!


[PHP] Re: php-mysql problem

2007-04-03 Thread itoctopus
$sql = SELECT count(Email) as numEmails, Email FROM mena_guests WHERE
Voted='yes' GROUP BY Email ORDER BY numEmails DESC LIMIT $startingID,
$items_numbers_list;

I answered this morning, I don't know why it got deleted

--
itoctopus - http://www.itoctopus.com
Me2resh Lists [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hi
 i need help regarding a sql query in my php app.

 the query is :
 $SQL = SELECT DISTINCT(EMail) FROM mena_guests WHERE Voted = 'yes'
 LIMIT $startingID,$items_numbers_list;

 i want to sort this query by the number of the repeated EMail counts.
 can anyone help me with that please ?


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



Re: [PHP] Question about form submitting

2007-04-03 Thread Philip Thompson

On Apr 3, 2007, at 1:13 PM, Mário Gamito wrote:


Hi,

Sorry for the lame question, but i didn't find a satisfactory  
answer in

the web.

I have this subscribe form (subscribe.php) and on submit i have to  
check

for errors:

a) password and password confirmation mismatch;
b) missing filled fields
c) check e-mail validity
d) etc.

My question is how do i make all these possibilities show a different
error message without leaving subscribe.php ?

I know that the for action must be subscribe.php, from there i'm blind
as a bat.

Any help would be appreciated.

Warm Regards
--
:wq! Mário Gamito


-
?php
// subscribe.php

session_start();

if (isset ($_POST)) {
  if (error condition 1) $_SESSION['error']['field1'] = $error = true;
  if (error condition 2) $_SESSION['error']['field2'] = $error = true;
  if (error condition 3) $_SESSION['error']['field3'] = $error = true;

  if ($error)
// Using SESSION variables
$_SESSION['field1'] = $_POST['field1'];
$_SESSION['field2'] = $_POST['field3'];
$_SESSION['field3'] = $_POST['field3'];

header (location: subscribe.php?error=someError);
exit;
  }

  // OR using GET variables
  if (error in form) {
$list = field1=.urlencode($_POST['field1']).field2=.
   urlencode($_POST['field2']).field3=.urlencode($_POST 
['field3']);


header (location: subscribe.php?error=someError$list);
exit;
  }

} else if ($_GET['error']) {
  // SESSION
  $field1 = $_SESSION['field1'];
  $field2 = $_SESSION['field2'];
  $field3 = $_SESSION['field3'];

  // GET
  $field1 = urldecode($_GET['field1']);
  $field2 = urldecode($_GET['field2']);
  $field3 = urldecode($_GET['field3']);
}
?
html
...
  form action=subscribe.php method=post
  Field 1: input type=text name=field1 value=? echo $field1; ? 
 /

? if ($_SESSION['error']['field1']) echo Error 1!; ?
  Field 2: input type=text name=field2 value=? echo $field2; ? 
 /

? if ($_SESSION['error']['field2']) echo Error 2!; ?
  Field 3: input type=text name=field3 value=? echo $field3; ? 
 /

? if ($_SESSION['error']['field3']) echo Error 3!; ?
  ...
  /form
...
/html
?
// Be sure to destroy the error fields so that they don't show up  
next submit

unset ($_SESSION['error']);
?
-

That's one way to specify an error for each field. It's tedious, but  
forms are. Hope that helps.


~Philip

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



Re: [PHP] Google-Yahoo venture and PHP

2007-04-03 Thread Chris

Tijnema ! wrote:

On 4/3/07, Chris [EMAIL PROTECTED] wrote:

Matt Kay wrote:
 I really dont see what all the fuss is about. If MS is going to have 
us all

 running
 on thin clients, and Google/Yahoo want to beat them to the punch, is 
this

 really
 going to matter who we pay? The article on digg.com
 http://digg.com/tech_news/Google_Yahoo_Merger_Redefines_Access
 simply means we will be getting our desktop as a service, and MS 
have the

 same
 goal. PHP will only be a small part of this if Zend decide to throw 
thier

 lot in also.

Did you look at the date? ;)


Digg shows us that it is posted on 3/31/07, is there something wrong with?


Depending on where you are you would see this on the first of April - 
April fools day... someone just got in a little early.


And if it was real, it would be on google, yahoo and a bunch of other 
websites too.


--
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] Cannot remove PHP Version 5.2.1-0.dotdeb.1

2007-04-03 Thread Miles Thompson

Mario,

Boy it's been a long day - it seems that every item I had in by configure
batch had to be installed; then at the very end of the day it finally got to
the --with-mysql. Had quite a scramble tryingto find the correct dev
environment, then finally I was down to to two warning errors, one of  which
was for sqlite.

Tried a make, but it wouldn't go, so I ran configure again, explicitly
stating with no sqlite.

Tried make again and it completed.

Ran checkinstall and it packaged the puppy, installed it and signed off with
a pleasant note on how to uninstall if necessary.

Tomorrow we'll see how it  works, and I hope I did not clobber mysql as part
of this.

There's an incompatibility between bzip2 and prefork-apache2-dev (or
something like that). Running one clobbers the other, so since I needed
apxs2 more than bzip2, that was dropped from the configuration.

If you're interested I'll post another update tomorrow.

Regards - Miles Thompson

On 4/3/07, Mario Guenterberg [EMAIL PROTECTED] wrote:


On Tue, Apr 03, 2007 at 08:50:31AM -0300, Miles Thompson wrote:
 Mario,

 That did it - when I tried to reload the phpinof.php script Apache did
not
 know what to do with the file.

 Now I'll drag the compiler from it's dusty corner and start from
scratch.

Not the debian/ubuntu way but sometimes the best solution ;-)

 Thanks a million - Miles
:-)

Greetings
Mario

--
-
| havelsoft.com - Ihr Service Partner für Open Source |
| Tel:  033876-21 966 |
| Notruf: 0173-277 33 60  |
| http://www.havelsoft.com|
| |
| Inhaber: Mario Günterberg   |
| Mützlitzer Strasse 19   |
| 14715 Märkisch Luch |
-




RE: [PHP] Audio CAPTCHA review request

2007-04-03 Thread Daevid Vincent
 -Original Message-
 From: Daevid Vincent [mailto:[EMAIL PROTECTED] 

 I will point you at http://www.cepstral.com/ for a possible 
 solution to your
 .mp3 usage. You could use Cepstral's swift tool to say the text
 dynamically.

Actually Ted, what I was referring to was that you could say actual words
like rainbow6, or even made up strings such as A35SFX. Much like a text
captcha does. As it stands, I think most audio captchas use simply digits,
which means you only need to understand [0-9] in your voice-breaker-code
(http://vorm.net/captchas). Mixing in letters means another 26 variants, and
if you went with words (which 'swift' will 'speak'), then you're in another
stratosphere all together...

D.Vin

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



[PHP] dynamic web interface and size

2007-04-03 Thread Alain Roger

Hi,

My question is not so much about PHP language but more about concept and PHP
result.

Basically i'm currently working on web application to administrate the web
content of a website. My customer would like to have a nice web application
interface, so it means a lot of images, and so on.
However, he would like also to have as PHP/postgreSQL results some tables
with quite enough information, so it means several fields data to collect
and to show so, a huge width for each table.

Here is my dilema... basically and based on web standard all website should
have an interface of 1024px (less scrollbar = 1000 px) width.
How can i display enough data on such width ?

I was thinking to display data into a div and to make this div scrollable in
order to respect those 1000px width.

I would like to have your experiences point of view in such situation.

thanks a lot,

--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5