php-general Digest 31 Aug 2007 16:34:36 -0000 Issue 4992

2007-08-31 Thread php-general-digest-help

php-general Digest 31 Aug 2007 16:34:36 - Issue 4992

Topics (messages 261558 through 261563):

PHP/MySQL not playing nicely.  Server drops connection. . .
261558 by: Michael Williams
261562 by: brian

Re: How to show proper time to users from around the world
261559 by: Per Jessen

Chisimba Framework Release
261560 by: Paul Scott

PHP Developer Required
261561 by: Greg Gay

Re: Reload page after form submit
261563 by: brian

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

Hi All,

I recently installed PHP, APACHE, MYSQL per the method at the  
following site:


http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/



. . .I then attempted to connect to a database (but without executing  
any commands on it), and I keep receiving the following error:




Safari can’t open the page “http://localhost/~michwill/folder/ 
validate_event.php” because the server unexpectedly dropped the  
connection, which sometimes occurs when the server is busy. You might  
be able to open the page later.



I'm really not sure what the problem is or what to do about it.  Can  
anyone help?  I've ensured that all passwords and ports are correct.   
I've also tried using MAMP, but it keeps telling me that I can't  
access the database with the connect commands I'm using (although  
I've adjusted them.  Anyway, any help would be much appreciated.



Regards,
Michael---End Message---
---BeginMessage---

Michael Williams wrote:

Hi All,

I recently installed PHP, APACHE, MYSQL per the method at the  following 
site:


http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/

. . .I then attempted to connect to a database (but without executing  
any commands on it), and I keep receiving the following error:


Safari can’t open the page “http://localhost/~michwill/folder/ 
validate_event.php” because the server unexpectedly dropped the  
connection, which sometimes occurs when the server is busy. You might  
be able to open the page later.


I'm really not sure what the problem is or what to do about it.  Can  
anyone help?  I've ensured that all passwords and ports are correct.   
I've also tried using MAMP, but it keeps telling me that I can't  access 
the database with the connect commands I'm using (although  I've 
adjusted them.  Anyway, any help would be much appreciated.




Are you sure that Apache is running and accepting connections to 
/~michwill? Does a regular HTML page show up ok?


Have you checked the server error log?

What does your script look like where it connects? Does it simply die() 
without a message? Try creating a test script with header('Content-type: 
text/plain') at the top. Then print out messages after each step. 
(beginning of script, opening a DB connection, etc.)


How are you accessing the database? Whichever method, test for errors 
after each step and echo out any info there. eg. with MDB2:


$mdb2 = MDB2::connect($dsn, $options);

if (PEAR::isError($mdb2))
{
  die ('Failed to connect: ' . $mdb2-getMessage());
}

If the MDB2 object is kosher but you have an SQL error:

$result = $stmnt-execute($data);

if (PEAR::isError($result))
{
  die('bad query: ' . $result-getUserInfo());
}

Of course, you shouldn't blindly echo out this sort of thing on a 
production server.


brian
---End Message---
---BeginMessage---
Hemanth wrote:

 Hi friends,
 
 Is there a solution to showing the proper time and date at user
 browsers and also recording proper USER times in the database
 operations in mysql

I think it's better to record UTC times only, but display them according
to the users timezone.  You can do that by telling mysql which timezone
you want per session.

http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html


/Per Jessen, Zürich
---End Message---
---BeginMessage---

The next release of the Chisimba PHP5 framework is now available.

Major enhancements included in this release are:

 - Memcache support
 - Better caching of language items
 - Improved database performance
 - Bug fixes
 - Better code documentation
 - API docs
 - First draft of the Chisimba Book for Developers
 - XML-RPC API for the Blog module
 - Context improvements
 - Code cleanup
 
and, of course, new modules to add onto your installation!

Please take a look, download it and give it a test drive! 
 
Chisimba, for those that don't know it already, is a PHP5 framework made
in Africa, for Africa. It is a collaboration between around 16 African
Universities, as well as around 35 active developers from around the
continent.
 
It can be downloaded from AVOIR at:
 

http://cvs2.uwc.ac.za/chisimba_releases/chisimba_framework_1-0-4.tgz

php-general Digest 1 Sep 2007 05:05:25 -0000 Issue 4993

2007-08-31 Thread php-general-digest-help

php-general Digest 1 Sep 2007 05:05:25 - Issue 4993

Topics (messages 261564 through 261581):

Re: Reload page after form submit
261564 by: Afan Pasalic
261577 by: brian

regular expression question
261565 by: Matthew Lasar
261566 by: Per Jessen
261567 by: Matthew Lasar
261569 by: Per Jessen

PHP + PDO + MySQL + Stored Procedure + PREPARE = Problem
261568 by: Uzed

Is a small memory footprint better for a php script?
261570 by: Mark
261571 by: Robert Cummings

Re: About Session And Cookies
261572 by: Dan

Re: text to HTML
261573 by: Dan
261578 by: M. Sokolewicz

Re: help with session
261574 by: Dan

Re: Which CAPTCHA is the besta?
261575 by: Dan

Re: for loop inside a switch
261576 by: Dan
261579 by: Robert Cummings
261581 by: jekillen

How to implement Open-ID on my web server?
261580 by: Ronald Wiplinger

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



brian wrote:

Instruct ICC wrote:
 From your rough code, I'd say the OP always needs the select block 
(just remove the else keyword and keep the block) for the current 
info at the present page refresh/load.  But I'd like clarification on 
how the OP thinks about it.




That's close, i think. But the select isn't necessary if the user has 
submitted a post because, either way, $first  $last will be set to 
the latest values.


The problem that i see is here:

if (isset($_POST))

This will always return TRUE. It should rather be:

if (isset($_POST['name_of_your_submit_btn']))

or some other form element, at least.

I don't know if this was simply because it was a rough draft of the 
code or even if it's the cause of the problem (which i still don't 
quite understand) but, anyway ...


brian

nope. ONLY when form with method POST is submitted. if you open the page 
first time else block will be executed.
though, I agree it's much better to have if(isset($_POST['SubmitForm']) 
and $_POST['SubmitForm'] == 'Submit')

where input type=Submit name=SubmitForm value=Submit
but, as I said earlier, it's not the code, just an idea.

-afan
---End Message---
---BeginMessage---

Afan Pasalic wrote:


brian wrote:


The problem that i see is here:

if (isset($_POST))

This will always return TRUE. It should rather be:

if (isset($_POST['name_of_your_submit_btn']))

or some other form element, at least.

I don't know if this was simply because it was a rough draft of the 
code or even if it's the cause of the problem (which i still don't 
quite understand) but, anyway ...


brian

nope. ONLY when form with method POST is submitted. if you open the page 
first time else block will be executed.
though, I agree it's much better to have if(isset($_POST['SubmitForm']) 
and $_POST['SubmitForm'] == 'Submit')

where input type=Submit name=SubmitForm value=Submit
but, as I said earlier, it's not the code, just an idea.



?php
if (isset($_POST))
{
print('What did i tell you?');
}
?
---End Message---
---BeginMessage---

Hello:

I've adapted this regular expression script from a book, but I'm not 
clear why it works.


$email = [EMAIL PROTECTED];
$pattern = /[EMAIL PROTECTED]@([-a-z0-9]+\.)+[a-z]{2,}/;
___

if ( preg_match($pattern,$email) )
{
print yes!  . $email .  matches!;
}
else { print no match; }
___

When I run this script, I get the yes! [EMAIL PROTECTED] 
matches! statement.


But I don't understand why the second half of the regular expression 
works. I'm talking about this part:


@([-a-z0-9]+\.)+[a-z]{2,}/;

why is it able to detect repeated sections of the email address after 
@ that are separated by periods? like @email.alaska.com . It 
looks to me like it's only looking for one example of that pattern. 
Does the () allow an unlimited number of patterns to pass?


thanks for any and all guidance

Matthew

Matthew Lasar  ||  llfcc.net  
---End Message---
---BeginMessage---
Matthew Lasar wrote:

 But I don't understand why the second half of the regular expression
 works. I'm talking about this part:
 
 @([-a-z0-9]+\.)+[a-z]{2,}/;
 
 why is it able to detect repeated sections of the email address after
 @ that are separated by periods? like @email.alaska.com . It
 looks to me like it's only looking for one example of that pattern.
 Does the () allow an unlimited number of patterns to pass?

No, but the following '+' does. 


/Per Jessen, Zürich
---End Message---
---BeginMessage---

At 11:32 AM 8/31/2007, Per Jessen wrote:

Matthew Lasar wrote:

 But I don't understand why the second half of the regular expression
 works. I'm talking about this part:

 @([-a-z0-9]+\.)+[a-z]{2,}/;

 why is it able to detect repeated sections of the email address after
 @ that are 

Re: [PHP] How to show proper time to users from around the world

2007-08-31 Thread Per Jessen
Hemanth wrote:

 Hi friends,
 
 Is there a solution to showing the proper time and date at user
 browsers and also recording proper USER times in the database
 operations in mysql

I think it's better to record UTC times only, but display them according
to the users timezone.  You can do that by telling mysql which timezone
you want per session.

http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html


/Per Jessen, Zürich

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



[PHP] Chisimba Framework Release

2007-08-31 Thread Paul Scott

The next release of the Chisimba PHP5 framework is now available.

Major enhancements included in this release are:

 - Memcache support
 - Better caching of language items
 - Improved database performance
 - Bug fixes
 - Better code documentation
 - API docs
 - First draft of the Chisimba Book for Developers
 - XML-RPC API for the Blog module
 - Context improvements
 - Code cleanup
 
and, of course, new modules to add onto your installation!

Please take a look, download it and give it a test drive! 
 
Chisimba, for those that don't know it already, is a PHP5 framework made
in Africa, for Africa. It is a collaboration between around 16 African
Universities, as well as around 35 active developers from around the
continent.
 
It can be downloaded from AVOIR at:
 

http://cvs2.uwc.ac.za/chisimba_releases/chisimba_framework_1-0-4.tgz
http://cvs2.uwc.ac.za/chisimba_releases/chisimba_modules_1-0-4.tgz

(or .zip if you prefer that format)

and the doc wiki can be found at:
 
http://avoir.uwc.ac.za/avoir/index.php?module=wiki

There are server setup instructions, as well as installation
walkthroughs available linking from the main AVOIR site:
 
http://avoir.uwc.ac.za/avoir/index.php?module=cmsaction=pageid=gen12Srv48Nme23_207
 
For those interested in developing a module, or just getting some
additional info please take a look at:
 
http://avoir.uwc.ac.za/avoir/index.php?module=cmsaction=pageid=gen12Srv48Nme23_208

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] PHP Developer Required

2007-08-31 Thread Greg Gay
Title: Web Applications Developer

Open August 30, 2007,

Closing September 14, 2007

Formal Education: University Degree in computer science/engineering or
related discipline

Employer: University of Toronto, Faculty of Information Studies,
Adaptive Technology Resource Centre,

Description: Under the direction of the Project Manager, the successful
applicant will take a leading role in the development of PHP web
applications, and participate through these projects in a number of open
source communities, assisting with community support, assisting clients
developing functional specifications, and assisting with development and
maintenance of a number of open source community Web sites.
Opportunities will also be available to participate in a broad range of
development projects under taken at the centre, working with
international and local groups, government, corporate, health care, and
not for profit sectors, among others.

Experience: At least five years experience working in team programming
environment. Advanced knowledge of PHP web application development.
Working knowledge of SQL, Javascript, AJAX, JAVA, XML, SOAP, HTML, CSS
and working in a distributed programming environment using Subversion.
Comfortable working in both Windows and Linux environments. Working
knowledge of Apache and Tomcat. Understanding of Web accessibility and
working in open source development projects would be an asset

Other: Flexibility, initiative and the ability to work and learn
independently. Excellent communication skills and an ability to
communicate technical details courteously and clearly to non-technical
users.

Starting Rate: $25/hr/CAD + 4% vacation pay

Appointment Type: One year renewable contract

Percentage of FTE: 100

Location: Toronto, Ontario, Canada

Forward Resume to [EMAIL PROTECTED]

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



Re: [PHP] PHP/MySQL not playing nicely. Server drops connection. . .

2007-08-31 Thread brian

Michael Williams wrote:

Hi All,

I recently installed PHP, APACHE, MYSQL per the method at the  following 
site:


http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/

. . .I then attempted to connect to a database (but without executing  
any commands on it), and I keep receiving the following error:


Safari can’t open the page “http://localhost/~michwill/folder/ 
validate_event.php” because the server unexpectedly dropped the  
connection, which sometimes occurs when the server is busy. You might  
be able to open the page later.


I'm really not sure what the problem is or what to do about it.  Can  
anyone help?  I've ensured that all passwords and ports are correct.   
I've also tried using MAMP, but it keeps telling me that I can't  access 
the database with the connect commands I'm using (although  I've 
adjusted them.  Anyway, any help would be much appreciated.




Are you sure that Apache is running and accepting connections to 
/~michwill? Does a regular HTML page show up ok?


Have you checked the server error log?

What does your script look like where it connects? Does it simply die() 
without a message? Try creating a test script with header('Content-type: 
text/plain') at the top. Then print out messages after each step. 
(beginning of script, opening a DB connection, etc.)


How are you accessing the database? Whichever method, test for errors 
after each step and echo out any info there. eg. with MDB2:


$mdb2 = MDB2::connect($dsn, $options);

if (PEAR::isError($mdb2))
{
  die ('Failed to connect: ' . $mdb2-getMessage());
}

If the MDB2 object is kosher but you have an SQL error:

$result = $stmnt-execute($data);

if (PEAR::isError($result))
{
  die('bad query: ' . $result-getUserInfo());
}

Of course, you shouldn't blindly echo out this sort of thing on a 
production server.


brian

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



Re: [PHP] Reload page after form submit

2007-08-31 Thread Afan Pasalic



brian wrote:

Instruct ICC wrote:
 From your rough code, I'd say the OP always needs the select block 
(just remove the else keyword and keep the block) for the current 
info at the present page refresh/load.  But I'd like clarification on 
how the OP thinks about it.




That's close, i think. But the select isn't necessary if the user has 
submitted a post because, either way, $first  $last will be set to 
the latest values.


The problem that i see is here:

if (isset($_POST))

This will always return TRUE. It should rather be:

if (isset($_POST['name_of_your_submit_btn']))

or some other form element, at least.

I don't know if this was simply because it was a rough draft of the 
code or even if it's the cause of the problem (which i still don't 
quite understand) but, anyway ...


brian

nope. ONLY when form with method POST is submitted. if you open the page 
first time else block will be executed.
though, I agree it's much better to have if(isset($_POST['SubmitForm']) 
and $_POST['SubmitForm'] == 'Submit')

where input type=Submit name=SubmitForm value=Submit
but, as I said earlier, it's not the code, just an idea.

-afan

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



Re: [PHP] Reload page after form submit

2007-08-31 Thread brian

Instruct ICC wrote:
 From your rough code, I'd say the OP always needs the select block 
(just remove the else keyword and keep the block) for the current info 
at the present page refresh/load.  But I'd like clarification on how the 
OP thinks about it.




That's close, i think. But the select isn't necessary if the user has 
submitted a post because, either way, $first  $last will be set to the 
latest values.


The problem that i see is here:

if (isset($_POST))

This will always return TRUE. It should rather be:

if (isset($_POST['name_of_your_submit_btn']))

or some other form element, at least.

I don't know if this was simply because it was a rough draft of the code 
or even if it's the cause of the problem (which i still don't quite 
understand) but, anyway ...


brian

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



[PHP] regular expression question

2007-08-31 Thread Matthew Lasar

Hello:

I've adapted this regular expression script from a book, but I'm not 
clear why it works.


$email = [EMAIL PROTECTED];
$pattern = /[EMAIL PROTECTED]@([-a-z0-9]+\.)+[a-z]{2,}/;
___

if ( preg_match($pattern,$email) )
{
print yes!  . $email .  matches!;
}
else { print no match; }
___

When I run this script, I get the yes! [EMAIL PROTECTED] 
matches! statement.


But I don't understand why the second half of the regular expression 
works. I'm talking about this part:


@([-a-z0-9]+\.)+[a-z]{2,}/;

why is it able to detect repeated sections of the email address after 
@ that are separated by periods? like @email.alaska.com . It 
looks to me like it's only looking for one example of that pattern. 
Does the () allow an unlimited number of patterns to pass?


thanks for any and all guidance

Matthew

Matthew Lasar  ||  llfcc.net  


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



Re: [PHP] regular expression question

2007-08-31 Thread Per Jessen
Matthew Lasar wrote:

 But I don't understand why the second half of the regular expression
 works. I'm talking about this part:
 
 @([-a-z0-9]+\.)+[a-z]{2,}/;
 
 why is it able to detect repeated sections of the email address after
 @ that are separated by periods? like @email.alaska.com . It
 looks to me like it's only looking for one example of that pattern.
 Does the () allow an unlimited number of patterns to pass?

No, but the following '+' does. 


/Per Jessen, Zürich

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



Re: [PHP] regular expression question

2007-08-31 Thread Matthew Lasar

At 11:32 AM 8/31/2007, Per Jessen wrote:

Matthew Lasar wrote:

 But I don't understand why the second half of the regular expression
 works. I'm talking about this part:

 @([-a-z0-9]+\.)+[a-z]{2,}/;

 why is it able to detect repeated sections of the email address after
 @ that are separated by periods? like @email.alaska.com . It
 looks to me like it's only looking for one example of that pattern.
 Does the () allow an unlimited number of patterns to pass?

No, but the following '+' does.


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




/Per Jessen, Zürich

--
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.484 / Virus Database: 269.13.0/980 
- Release Date: 8/30/2007 6:05 PM


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



[PHP] PHP + PDO + MySQL + Stored Procedure + PREPARE = Problem

2007-08-31 Thread Uzed

Hi all,

I've found a bug when working on a PHP script using a PDO connector.

When I made a Store Procedure using the PREPARE statement something 
messed up the result im my PHP script.



Please go to my blog http://huzed.com/zed/?p=21 and see code.



Tanks for help.


ZED

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



Re: [PHP] regular expression question

2007-08-31 Thread Per Jessen
Matthew Lasar wrote:

 At 11:32 AM 8/31/2007, Per Jessen wrote:
Matthew Lasar wrote:

  But I don't understand why the second half of the regular
  expression works. I'm talking about this part:
 
  @([-a-z0-9]+\.)+[a-z]{2,}/;
 
  why is it able to detect repeated sections of the email address
  after @ that are separated by periods? like @email.alaska.com .
  It looks to me like it's only looking for one example of that
  pattern. Does the () allow an unlimited number of patterns to
  pass?

No, but the following '+' does.
 
 But how? The +[a-z]{2,} seems to allow at least
 two a-z clusters, but it doesn't include a period. /ml
 

That plus applies to the grouping () before it:

([-a-z0-9]+\.)+   one or more sequences of -a-z0-9 followed by a period



/Per Jessen, Zürich

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



[PHP] Is a small memory footprint better for a php script?

2007-08-31 Thread Mark
Hey,

I'm wondering something about memory usage.
I just looked at how much memory the newest phpbb is using and that's
over 2 mega bytes!!

Now i'm working on a php script that is currently using around 600 kilo bytes.

The question now is: what is better? a script with a small memory
usage? or is that something i don't need to look at?

And when is memory usage gonna be a issue? is that when you have ALOT
of simultaneous users? (lets say 100 all the time.. not that i have
that.. but just for the idea).

Thanx,
Mark.

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



Re: [PHP] Is a small memory footprint better for a php script?

2007-08-31 Thread Robert Cummings
On Fri, 2007-08-31 at 23:06 +0200, Mark wrote:

 The question now is: what is better? a script with a small memory
 usage? or is that something i don't need to look at?

It depends... do you find the following script better? Better than what?
It definitely has a small memory footpring:

?php

echo 'Brought to you by the ridiculous question department.';

?

 And when is memory usage gonna be a issue? is that when you have ALOT
 of simultaneous users? (lets say 100 all the time.. not that i have
 that.. but just for the idea).

Let's see... (100 * 2) = 200 megs.
My desktop computer... (2048 - 200) = 1848.

I'm not seeing an issue... A greater problem is going to be
database/filesystem bottlenecks, or possible poorly written scripts that
suck the life out of your processor(s)/core(s).

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



[PHP] Re: About Session And Cookies

2007-08-31 Thread Dan
Wow, you really need to be carefull when ever you're dealing with money, 
although if you're just handing the objects in a cart and passing that to a 
secure payment system then it's not as big of a deal.


Cookies can be stolen.

Sessions are vulnerable to snooping if you're on a shared server.

They have their pros and cons, and it would take way to long to explain the 
way each of them work.  You're best off to learn about both in a depth with 
a security standpoint.



Kelvin Park [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

I am trying to setup a secure login system.
I've heard that if I use just cookies for login, members without cookie
turned out won't be able to see the member pages.

Is using session recommended for e-commerce websites with shopping carts?
Or, using both of them might be more effective in some way.



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



[PHP] Re: text to HTML

2007-08-31 Thread Dan
As I know there's no real WYSIWYG text to html converters.  Plus this 
wouldn't do much more than handling paragraphs and new lines.


If you're looking for a way to write html from a textbox check out 
FCKEditor.


Sorry I couldn't help much.  If you really do have only the limited need of 
paragaphs and newlines then go with Ron's solution, it'll work just fine.


- Dan

Ron Piggott [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]


Is there a PHP command that turns text into HTML?

EXAMPLE:

before

Hi.

How are you doing?

after

Hi.p

How are you doing?p




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



Re: [PHP] help with session

2007-08-31 Thread Dan
You should be sanatizing code here.  When you save it to the session and 
when it's output.  Look arround the newsgroups or online for info about it, 
it's everywhere.


- Dan

mike [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

On 8/26/07, Jason Cartledge [EMAIL PROTECTED] wrote:

I would replace $_REQUEST with $_GET or $_POST (as appropriate)


  if ( !empty($_REQUEST['gender']) )
 {
   $registrationGender=$_REQUEST['gender'];
 }
 else {


Personally I would use if(isset($_SESSION['registrationGender'])) here


if (session_is_registered('registrationGender'))
 {
  $registrationGender=$_SESSION['registrationGender'];
  print you are preregistered as a $registrationGender;
 }
 else
 {
  print your gender is unknown, youare assumed to be a 
male;


   $_SESSION['registrationGender']='male';

I would change it to assign it here. No need to assign it a second
time below, since you are just printing the session variable if it is
already set


 }
  }



Those are a couple quick things my tired bloodshot eyes thought of.



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



[PHP] Re: Which CAPTCHA is the besta?

2007-08-31 Thread Dan
Well what do you mean by best?  Best at keeping spammers away, ease of 
use(playing sound for handicapped people), fastest?


If you want to keep spammers away you could go with some super complicated 
script that distorts letters so much that it's really hard.  This keeps away 
not only spambots but also your users :'(.  If you go for ease of use then 
it's probably a popular script and people already have bots that look for 
sites using those particular scripts and have other bots which can crack the 
capchas.


In my opinion the best of both worlds can be done by making it yourslef... 
yes form scratch.  If there's a one of a kind script nobody has seen it 
before and they probably dont' have programs to crack it.  Plus it's really 
easy for users to use since it can be made simple.  Plus then you have 
control over the source.


- Dan

Tony Di Croce [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

I need a CAPTCHA script Which one is the best? (I dont mind if its
somewhat difficult).



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



Re: [PHP] for loop inside a switch

2007-08-31 Thread Dan
Sanjeev is right.  You're thinking about the problem backwards.  You're 
trying to build a Switch inside a loop.  Remember, if you ever have to do 
some operating multiple times you're using a forloop, then the thing that 
you want to repeat(switch case) is INSIDE the for loop.


- Dan

Sanjeev N [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

This will not work at all..
Instead of switch try with if condition as follows

for ($i=0; $i 21; $i++) {
if(faq$i == $q){
echo $faq1;
break;
}
}
Now it works..

You can write the code to display the result how you want.. but you cant
write the code to write a code :)

Cheers

Warm Regards,
Sanjeev
http://www.sanchanworld.com
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
-Original Message-
From: Hulf [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 16, 2007 3:11 PM
To: php-general@lists.php.net
Subject: [PHP] for loop inside a switch

Hi,

switch ($q) {

for ($i=0; $i 21; $i++) {
case 'faq$i':
   echo $faq1;
   break;
}
}


I just want to loop out a big long list of cases.

--
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] Reload page after form submit

2007-08-31 Thread brian

Afan Pasalic wrote:


brian wrote:


The problem that i see is here:

if (isset($_POST))

This will always return TRUE. It should rather be:

if (isset($_POST['name_of_your_submit_btn']))

or some other form element, at least.

I don't know if this was simply because it was a rough draft of the 
code or even if it's the cause of the problem (which i still don't 
quite understand) but, anyway ...


brian

nope. ONLY when form with method POST is submitted. if you open the page 
first time else block will be executed.
though, I agree it's much better to have if(isset($_POST['SubmitForm']) 
and $_POST['SubmitForm'] == 'Submit')

where input type=Submit name=SubmitForm value=Submit
but, as I said earlier, it's not the code, just an idea.



?php
if (isset($_POST))
{
print('What did i tell you?');
}
?

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



[PHP] Re: text to HTML

2007-08-31 Thread M. Sokolewicz

Dan wrote:
As I know there's no real WYSIWYG text to html converters.  Plus this 
wouldn't do much more than handling paragraphs and new lines.


If you're looking for a way to write html from a textbox check out 
FCKEditor.


Sorry I couldn't help much.  If you really do have only the limited need 
of paragaphs and newlines then go with Ron's solution, it'll work just 
fine.


- Dan

Ron Piggott [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]


Is there a PHP command that turns text into HTML?

EXAMPLE:

before

Hi.

How are you doing?

after

Hi.p

How are you doing?p




Since using p to insert line-breaks is bad style, use br instead (or 
the br / variant if using XHTML).

You can use php's built-in nl2br() function to do this.

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



Re: [PHP] for loop inside a switch

2007-08-31 Thread Robert Cummings
On Fri, 2007-08-31 at 15:56 -0700, Dan wrote:
 Sanjeev is right.  You're thinking about the problem backwards.  You're 
 trying to build a Switch inside a loop.  Remember, if you ever have to do 
 some operating multiple times you're using a forloop, then the thing that 
 you want to repeat(switch case) is INSIDE the for loop.

Not always true. Sometimes once you've made the switch it applies to all
members of a data array. In which case switching on every iteration is a
waste of processor since you can check a single time outside the loop.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



[PHP] How to implement Open-ID on my web server?

2007-08-31 Thread Ronald Wiplinger

Hi,

I am looking for a way to implement OpenID on my webserver. Can anybody 
point me on ONE place that describes ONE way, please!


I found many links, but I am now confused what I really need ;-(

I want that the customer can use his/her openid to login to signup/login 
to our web sites. Herby the user should get the choice to use some of 
the Open-ID preset field values to complete the signup process faster.


Thanks!

bye

Ronald

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



[PHP] for loop inside a switch

2007-08-31 Thread jekillen

On Aug 31, 2007, at 6:26 PM, Robert Cummings wrote:


On Fri, 2007-08-31 at 15:56 -0700, Dan wrote:
Sanjeev is right.  You're thinking about the problem backwards.  
You're
trying to build a Switch inside a loop.  Remember, if you ever have 
to do
some operating multiple times you're using a forloop, then the thing 
that

you want to repeat(switch case) is INSIDE the for loop.


Not always true. Sometimes once you've made the switch it applies to 
all
members of a data array. In which case switching on every iteration is 
a

waste of processor since you can check a single time outside the loop.

Cheers,
Rob.
--

You can run a switch inside a for loop and when a case is matched set a 
variable to true.
the break statement will break out of the switch, then inside the 
iteration code, after
the switch block, test the variable for true. If it is true the use 
another break instruction.
That should break out of the loop altogether at the end on that 
particular iteration.

like so:
for($i = 0; $i  somevalue; $i++)
{
   $bar = false;
  switch($anotherValue[$i]) // /this assumes you are looping 
through an indexed array

   { case 'foo':
 $bar = true
 //other code;
 break;
 default;
 // $bar is not set  to true so the loop continues
   }
 if($bar == true)
   {
 break;
   }
   /* instead of the default line in the switch statement
else
  {
continue;
  }
   */
 }

Hope this is useful.
Jeff K

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