Re: [PHP-DB] value error in PHP form

2004-06-24 Thread Rinku
Hi Zak,
 
Thanks for your suggestion.
It really worked.
Now pls answer for the query described below :
 
I had written the code :
if(isset($_POST['Variable1'])isset($_POST['Variable2']))
{
  Print Rinku;
}
  Here, even if variables are not set then even I am getting Output as Rinku.
 
Could you  pls answer for the query.
Thanks,
Rinku

Zachary Krakov [EMAIL PROTECTED] wrote:
Hi Rinku,
One problem I see is that the HTML tags appear to be off... Your HTML is
improperly formatted, which could be causing rendering anomalies to occur,
in addition to the register globals issue which I'll mention shortly. Please
correct your HTML code to read:






HTML_BODY_HERE



Two, Like Kenny said, change the register_globals = Off directive in your
PHP.ini file to  register_globals = On so that variables are carried from
your form values into your post-processing PHP print functions.

Hope this helps,
Best,
-Zak


On 6/20/04 4:34 AM, Kenny wrote:

 This could be due to register globals on/off
 
 Use
 print $_POST['action'];
 print $_POST['Name'];
 
 Kenny
 
 -Original Message-
 From: Rinku [mailto:[EMAIL PROTECTED]
 Sent: 20 June 2004 12:23
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] value error in PHP form
 
 Dear All,
 
 I have installed PHP on WinXp. I am using MySql as Backend on Apache
 server.
 Now the problem is..
 I am writing this code :
 
 
 
 
 
 
 
 
 
  [input] 
  [input] 
  print $action;
 print $Name;
 ?
 
 
 
 Here I should get output as LoginRinku
 But I am getting nothing.
 
 Can any of you guide me on this?
 
 Regards,
 Rinku
 
 
 
 
 
 
 -
 Do you Yahoo!?
 New and Improved Yahoo! Mail - Send 10MB messages!

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



-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

[PHP-DB] Posting Data to MySQL

2004-06-24 Thread Tom Chubb
I am trying to design a form that posts the data to a DB, but being new to
PHP/MySQL, it takes me ages to hand write the code and I'm sure there must
be an easier way to do it?
My form has 100 fields using 20 rows and 5 columns and it's taking me ages
to write the code for it.
Can anyone advise how they code large forms like that and if you know of any
software to make it easier?
I've searched Google for hours and checked loads of Database scripts on
sites like Hotscripts, but can't find anything.
Thanks,
Tom


[PHP-DB] Re: Posting Data to MySQL

2004-06-24 Thread Torsten Roehr
Tom Chubb [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am trying to design a form that posts the data to a DB, but being new to
 PHP/MySQL, it takes me ages to hand write the code and I'm sure there must
 be an easier way to do it?
 My form has 100 fields using 20 rows and 5 columns and it's taking me ages
 to write the code for it.
 Can anyone advise how they code large forms like that and if you know of
any
 software to make it easier?
 I've searched Google for hours and checked loads of Database scripts on
 sites like Hotscripts, but can't find anything.

Hi Tom,

that's a lot of information to display on one page. Can you split it up into
several forms? Of course this would not mean fewer work but maybe make it a
bit mor concise.

Regards, Torsten Roehr

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



RE: [PHP-DB] Re: Posting Data to MySQL

2004-06-24 Thread Galbreath, Mark A
Doesn't matter how many fields are on a form; they are returned as an array
of strings in the request object.  Just iterate through the array and update
the corresponding database fields.

Mark

-Original Message-
From: Torsten Roehr [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 24, 2004 10:02 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: Posting Data to MySQL


Tom Chubb [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am trying to design a form that posts the data to a DB, but being new to
 PHP/MySQL, it takes me ages to hand write the code and I'm sure there must
 be an easier way to do it?
 My form has 100 fields using 20 rows and 5 columns and it's taking me ages
 to write the code for it.
 Can anyone advise how they code large forms like that and if you know of
any
 software to make it easier?
 I've searched Google for hours and checked loads of Database scripts on
 sites like Hotscripts, but can't find anything.

Hi Tom,

that's a lot of information to display on one page. Can you split it up into
several forms? Of course this would not mean fewer work but maybe make it a
bit mor concise.

Regards, Torsten Roehr

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

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



[PHP-DB] [PHP]: session problem

2004-06-24 Thread H. J. Wils
I want to use sessions to check wether a user is logged in or not. 
Therefore,I use session_start and session_register. When I registere the 
values on the same page, they all seem to work. But when I ask the value of 
a registered session variable on another page, it is empty?!?! Does anyone 
know how this comes? i am using session_start() at every page..

i believe it must be in my php.ini setting because on my hosting provider it 
does work all correctly.. can anyone helpme?

_
Play online games with your friends with MSN Messenger 
http://messenger.msn.nl/

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


Re: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Matt Matijevich
[snip]
But when I ask the value of 
a registered session variable on another page, it is empty?!?! Does
anyone 
know how this comes? i am using session_start() at every page..
[/snip]

try the $_SESSION array for starage of session variables.

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



Re: [PHP-DB] Re: Posting Data to MySQL

2004-06-24 Thread Torsten Roehr
Mark A Galbreath [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Doesn't matter how many fields are on a form; they are returned as an
array
 of strings in the request object.  Just iterate through the array and
update
 the corresponding database fields.

Mark, what I was trying to say was that having 100 form elements on one page
is quite a lot of information to comprehend for the user. And if each form
element has a different name you cannot just handle the data as an array.
You have to address each value individually.

Regards, Torsten

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



Re: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Matt Matijevich
[snip]
i do ($_SESSION['sid']), but the variables remain empty...
[/snip]

If you are using the array forget about session_register. 
http://www.php.net/session_register

Could you post a little code?  That will make this easier to solve.

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



Re: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Daniel Clark
Are you getting any errors displayed?

The php.ini file has to have a directory specified for the session temp
variables.

 I want to use sessions to check wether a user is logged in or not.
 Therefore,I use session_start and session_register. When I registere the
 values on the same page, they all seem to work. But when I ask the value
 of
 a registered session variable on another page, it is empty?!?! Does anyone
 know how this comes? i am using session_start() at every page..

 i believe it must be in my php.ini setting because on my hosting provider
 it
 does work all correctly.. can anyone helpme?

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



Re: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Matt Matijevich
do you get any output on the second page if you do this? 

?php

session_start();

print 'pre';
print_r($_SESSION);
print '/pre';

if ( isset($_SESSION['logged_in'])){

echo Welcome...;

}else{
  header(location: user.php?action=9);
}
?

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



RE: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Hutchins, Richard
So, on your second page you NEVER see the Welcome... get echoed out? It
always forwards you to the user.php page?

 -Original Message-
 From: H. J. Wils [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 24, 2004 11:44 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] [PHP]: session problem
 
 
 this is the code, but this code works on my hosting provider 
 but not on my 
 own server. I think i have to change settings in php.ini but 
 dont know 
 which...
 first page:
 
 session_start();
 
 include connect.php;
 include functions.php;
 
   $user= $_GET[email];
   $ww = $_GET[ww];
 
   $check_user_query = select id,email, password from 
 user where 
 email='$user' and password='$ww';
   $check_user_res = mysql_query($check_user_query) or 
 die(mysql_error().: $check_user_query);
 
   if (mysql_num_rows($check_user_res) == 1){
  //user is ingelogd
 
$userdata = 
 mysql_fetch_array($check_user_res);
$sid=session_id();
$uid=$userdata[id];
$_SESSION['logged_in'] = true;
$_SESSION['sid'] = $sid;
$_SESSION['user'] = $uid;
 
$dt = date(Y-m-d H:i:s);
 
  header(location: user.php?action=0);
   }else{
  header(location: user.php?action=9);
   }
 
 
 second page:
 
 ?php
 
 session_start();
 
 if ( isset($_SESSION['logged_in'])){
 
 echo Welcome...;
 
 }else{
 header(location: user.php?action=9);
 }
 ?
 
 _
 Hotmail en Messenger on the move 
 http://www.msn.nl/communicatie/smsdiensten/hotmailsmsv2/
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Jason Wong
On Thursday 24 June 2004 23:43, H. J. Wils wrote:

[snip]

$_SESSION['logged_in'] = true;
$_SESSION['sid'] = $sid;
$_SESSION['user'] = $uid;

$dt = date(Y-m-d H:i:s);

You should always session_write_close() before you redirect.

  header(location: user.php?action=0);

You should be using an absolute URI rather than a relative one.

And just to be safe always have an exit() right after your redirect header(s).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
It is a hard matter, my fellow citizens, to argue with the belly,
since it has no ears.
-- Marcus Porcius Cato
*/

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
Fun Facts, #14:
In table tennis, whoever gets 21 points first wins.  That's how
it once was in baseball -- whoever got 21 runs first won.
*/

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



RE: [PHP-DB] [PHP]: session problem

2004-06-24 Thread H. J. Wils
indeed...
From: Hutchins, Richard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] [PHP]: session problem
Date: Thu, 24 Jun 2004 11:52:38 -0400
MIME-Version: 1.0
Received: from pb1.pair.com ([216.92.131.4]) by mc6-f23.hotmail.com with 
Microsoft SMTPSVC(5.0.2195.6713); Thu, 24 Jun 2004 08:53:06 -0700
Received: (qmail 46847 invoked by uid 1010); 24 Jun 2004 15:52:42 -
Received: (qmail 46808 invoked by uid 1010); 24 Jun 2004 15:52:42 -
X-Message-Info: JGTYoYF78jFRl5xFT3FYrNMzPyW4jY3K
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:[EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Message-ID: [EMAIL PROTECTED]
X-Mailer: Internet Mail Service (5.5.2657.72)
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 24 Jun 2004 15:53:08.0025 (UTC) 
FILETIME=[57F45A90:01C45A03]

So, on your second page you NEVER see the Welcome... get echoed out? It
always forwards you to the user.php page?
 -Original Message-
 From: H. J. Wils [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 24, 2004 11:44 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] [PHP]: session problem


 this is the code, but this code works on my hosting provider
 but not on my
 own server. I think i have to change settings in php.ini but
 dont know
 which...
 first page:

 session_start();

 include connect.php;
 include functions.php;

$user= $_GET[email];
$ww = $_GET[ww];

$check_user_query = select id,email, password from
 user where
 email='$user' and password='$ww';
$check_user_res = mysql_query($check_user_query) or
 die(mysql_error().: $check_user_query);

if (mysql_num_rows($check_user_res) == 1){
   //user is ingelogd

 $userdata =
 mysql_fetch_array($check_user_res);
 $sid=session_id();
 $uid=$userdata[id];
 $_SESSION['logged_in'] = true;
 $_SESSION['sid'] = $sid;
 $_SESSION['user'] = $uid;

 $dt = date(Y-m-d H:i:s);

   header(location: user.php?action=0);
}else{
   header(location: user.php?action=9);
}


 second page:

 ?php

 session_start();

 if ( isset($_SESSION['logged_in'])){

 echo Welcome...;

 }else{
  header(location: user.php?action=9);
 }
 ?

 _
 Hotmail en Messenger on the move
 http://www.msn.nl/communicatie/smsdiensten/hotmailsmsv2/

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


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
_
Talk with your online friends with MSN Messenger http://messenger.msn.nl/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] regular expression help

2004-06-24 Thread Larry Sandwick
The *if* statement should fail with the password abcdef being qualified but
it never fails ?

 

If I understand the expression right, it should have at 1 number in it
between 2 letters ?

 

$password = abcdef;

 

if (preg_match (/[A-z]+[0-9]+[A-z]+/, $password)) {

   die (You must have a number between 2 letters in your password ...
0-9);

}

 

 

 

Larry Sandwick

Sarreid, Ltd.

Network/System Administrator

phone: (252) 291-1414 x223

fax  : (252) 237-1592

 


  _  

My Inbox is protected by SPAMfighter
2224 spam mails have been blocked so far.
Download free SPAMfighter http://www.spamfighter.com/  today! 


Re: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Daniel Clark
What are you setting $_SESSION['sid'] to?


 i do ($_SESSION['sid']), but the variables remain empty...

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



Re: [PHP-DB] regular expression help

2004-06-24 Thread Matt Matijevich
try this 

$password = 'abcdef'; 

if (preg_match ('/\w\d\w/', $password)) {

   die (You must have a number between 2 letters in your password ...
0-9);

}

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



Re: [PHP-DB] value error in PHP form

2004-06-24 Thread Zachary Krakov
Hi Rinku,
The statement syntax that I believe will work you is the following:

If (($VARIABLE1 !== '')  ($VARIABLE2 !== '')) {
print Rinku;
}

Let me know if this works.
Hope this helps.
Best,
-Zak

From: Rinku [EMAIL PROTECTED]
Date: Thu, 24 Jun 2004 03:07:12 -0700 (PDT)
To: Zachary Krakov [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] value error in PHP form

Hi Zak,
 
Thanks for your suggestion.
It really worked.
Now pls answer for the query described below :
 
I had written the code :
if(isset($_POST['Variable1'])isset($_POST['Variable2']))
{
  Print Rinku;
}
  Here, even if variables are not set then even I am getting Output as
Rinku.
 
Could you  pls answer for the query.
Thanks,
Rinku

Zachary Krakov [EMAIL PROTECTED] wrote:
Hi Rinku,
One problem I see is that the HTML tags appear to be off... Your HTML is
improperly formatted, which could be causing rendering anomalies to occur,
in addition to the register globals issue which I'll mention shortly. Please
correct your HTML code to read:






HTML_BODY_HERE



Two, Like Kenny said, change the register_globals = Off directive in your
PHP.ini file to  register_globals = On so that variables are carried from
your form values into your post-processing PHP print functions.

Hope this helps,
Best,
-Zak


On 6/20/04 4:34 AM, Kenny wrote:

 This could be due to register globals on/off
 
 Use
 print $_POST['action'];
 print $_POST['Name'];
 
 Kenny
 
 -Original Message-
 From: Rinku [mailto:[EMAIL PROTECTED]
 Sent: 20 June 2004 12:23
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] value error in PHP form
 
 Dear All,
 
 I have installed PHP on WinXp. I am using MySql as Backend on Apache
 server.
 Now the problem is..
 I am writing this code :
 
 
 
 
 
 
 
 
 
  [input] 
  [input] 
  print $action;
 print $Name;
 ?
 
 
 
 Here I should get output as LoginRinku
 But I am getting nothing.
 
 Can any of you guide me on this?
 
 Regards,
 Rinku
 
 
 
 
 
 
 -
 Do you Yahoo!?
 New and Improved Yahoo! Mail - Send 10MB messages!

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


  
-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

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



RE: [PHP-DB] [PHP]: session problem

2004-06-24 Thread Hutchins, Richard
OK then, couple more questions.

1. What is user.php? Is it the code you posted under second page?
2. Also, on your first page, are you sure that your

$check_user_res = mysql_query($check_user_query) or 
 die(mysql_error().: $check_user_query);

query is firing properly? If it isn't then your session variables are not
being assigned. I know you said it's working on your host's server, but is
there maybe a small difference between your local and remote databases that
might cause the query to fail when executed locally?

Admittedly, I'm poking around in the dark here.

Rich Hutchins, MCIW
Sr. Technical Publications Analyst
Getinge USA
1777 E. Henrietta Rd.
Rochester NY 14623
585-272-5072
www.getingeusa.com



 -Original Message-
 From: H. J. Wils [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 24, 2004 11:44 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] [PHP]: session problem
 
 
 this is the code, but this code works on my hosting provider 
 but not on my 
 own server. I think i have to change settings in php.ini but 
 dont know 
 which...
 first page:
 
 session_start();
 
 include connect.php;
 include functions.php;
 
   $user= $_GET[email];
   $ww = $_GET[ww];
 
   $check_user_query = select id,email, password from 
 user where 
 email='$user' and password='$ww';
   $check_user_res = mysql_query($check_user_query) or 
 die(mysql_error().: $check_user_query);
 
   if (mysql_num_rows($check_user_res) == 1){
  //user is ingelogd
 
$userdata = 
 mysql_fetch_array($check_user_res);
$sid=session_id();
$uid=$userdata[id];
$_SESSION['logged_in'] = true;
$_SESSION['sid'] = $sid;
$_SESSION['user'] = $uid;
 
$dt = date(Y-m-d H:i:s);
 
  header(location: user.php?action=0);
   }else{
  header(location: user.php?action=9);
   }
 
 
 second page:
 
 ?php
 
 session_start();
 
 if ( isset($_SESSION['logged_in'])){
 
 echo Welcome...;
 
 }else{
 header(location: user.php?action=9);
 }
 ?
 
 _
 Hotmail en Messenger on the move 
 http://www.msn.nl/communicatie/smsdiensten/hotmailsmsv2/
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP-DB] value error in PHP form

2004-06-24 Thread Jason Wong
On Thursday 24 June 2004 18:07, Rinku wrote:

 I had written the code :
 if(isset($_POST['Variable1'])isset($_POST['Variable2']))
 {
   Print Rinku;
 }
   Here, even if variables are not set then even I am getting Output as
 Rinku.

Some form elements, eg input type=text ..., are always isset() even when 
you haven't entered anything into them. If you want to check that something 
has been entered into them then use:

 if (!empty($POST['doo'] ...

but depending on what type of inputs your application accepts you may have to 
do further tests.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
--
/*
QOTD:
Don't let your mind wander -- it's too little to be let out alone.
*/

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



RE: [PHP-DB] regular expression help

2004-06-24 Thread Larry Sandwick
That does not work either... I can not make the statement fail!!!

I have tried 

$password = 123456;
and
$password = abcdef;

I have change the if statement to what is below and past in all letters and
it still works?

if (preg_match ('/\d/', $password)) {

   die (You must have a number between 2 letters in your password ...
0-9);

// Larry
 
 
-Original Message-
From: Matt Matijevich [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 12:11 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] regular expression help

try this 

$password = 'abcdef'; 

if (preg_match ('/\w\d\w/', $password)) {

   die (You must have a number between 2 letters in your password ...
0-9);

}

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



My Inbox is protected by SPAMfighter
2228 spam mails have been blocked so far.
Download free www.spamfighter.com today!

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



RE: [PHP-DB] regular expression help

2004-06-24 Thread Matthias Steinböck
hi!
is this correct: you want to check if there are two letters in the 
password wich do not surround a digit? if so this is what you need:

?php
// dies
$password = 'alfgoesswimming';
// dies too
$password = 'a2lf4g2o4e7s9s3w9i0m5m7i0n3g';
// survives
$password = 'a2l5f4g2o4e7s9s3w9i0m5m7i0n3g';
$found = array();
$pattern = '#[a-z_]{2}#i';
if(preg_match_all($pattern, $password, $found)0) {
die('You must have a number between 2 letters in your password ... 0-9');
} else {
die('password accepted');
}
?
greez ma
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] regular expression help

2004-06-24 Thread Matthias Steinböck
ok... this still does not do what you want, because it does not consider 
that only digits should be between the letters... here is the correct 
solution:

?php
// dies
$password = 'alfgoesswimming';
// dies too
$password = 'a2lf4g2o4e7s9s3w9i0m5m7i0n3g';
// survives
$password = 'a2$5l5f4g2o4e7s9s3w9i0m5m7i0n3g';
$found = array();
$pattern = '#[^0-9]{2}#i';
if(preg_match_all($pattern, $password, $found)0) {
die('You must have a number between 2 letters in your password ... 0-9');
} else {
die('password accepted');
}
?
hth greez ma
Matthias Steinböck wrote:
hi!
is this correct: you want to check if there are two letters in the 
password wich do not surround a digit? if so this is what you need:

?php
// dies
$password = 'alfgoesswimming';
// dies too
$password = 'a2lf4g2o4e7s9s3w9i0m5m7i0n3g';
// survives
$password = 'a2l5f4g2o4e7s9s3w9i0m5m7i0n3g';
$found = array();
$pattern = '#[a-z_]{2}#i';
if(preg_match_all($pattern, $password, $found)0) {
die('You must have a number between 2 letters in your password ... 
0-9');
} else {
die('password accepted');
}

?
greez ma
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] regular expression help

2004-06-24 Thread Matthias Steinböck
i see... so the pattern you need is
?php
$atLeast = 2;
$pattern = '#\d{1}#';
if(preg_match_all($pattern, $password, $a)  $atLeast) {
echo 'password ok; contains at least '.$atLeast.' digits.';
}
hth greez ma
Larry Sandwick wrote:
I would like to make sure that there is at least 1 number in the password ?
// Larry
 
 

-Original Message-
From: Matthias Steinböck [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 1:41 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] regular expression help

hi!
is this correct: you want to check if there are two letters in the 
password wich do not surround a digit? if so this is what you need:

?php
// dies
$password = 'alfgoesswimming';
// dies too
$password = 'a2lf4g2o4e7s9s3w9i0m5m7i0n3g';
// survives
$password = 'a2l5f4g2o4e7s9s3w9i0m5m7i0n3g';
$found = array();
$pattern = '#[a-z_]{2}#i';
if(preg_match_all($pattern, $password, $found)0) {
die('You must have a number between 2 letters in your password ...
0-9');
} else {
die('password accepted');
}
?
greez ma
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] regular expression help

2004-06-24 Thread Matt Matijevich
you only want to check to see if there is at least one digit?

If that is true, this should work:

if(preg_match('/\d/',$password)) {
echo 'password ok';
}

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



RE: [PHP-DB] regular expression help

2004-06-24 Thread Matt Matijevich
[snip]
That does not work either... I can not make the statement fail!!!

I have tried 

$password = 123456;
and
$password = abcdef;

I have change the if statement to what is below and past in all letters
and
it still works?

if (preg_match ('/\d/', $password)) {

   die (You must have a number between 2 letters in your password ...
0-9);

// Larry
[/snip]

sorry, this should be:

if (!preg_match ('/\d/', $password)) {
   die (You must have a number between 2 letters in your password ...
0-9);
}

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



Re: [PHP-DB] help with consecutive numbers in db

2004-06-24 Thread Matt Matijevich
[snip]
The IP's (for example 192.168.1.1) are all in a single field.
[/snip]

If it is a possiblity, I would store each IP in its own row, with a
column in that row being some kind of flag, like: is_issued as a logical
column.

Can you change you db layout or is it set in stone?

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



[PHP-DB] Date help needed

2004-06-24 Thread Chris Payne
Hi there everyone,

 

I have a problem, I currently have some code which populates a dropdown box
- this code gives me every day for the next x amount of days (EG: a years
worth of days), however what I really need to be able to do, is to find a
way to display this data in the dropdown box but ONLY show 3 days a week,
IE: Mondays, Fridays and Sundays, so it would show the dates for each
Monday, Friday and Sunday for X amount of days (IE: 365 days in the
dropdown).

 

Does anyone have any idea how to do this?  I would really appreciate any
help, I'd send my sample code only I'm not at my home/work computer ATM.

 

Chris



Re: [PHP-DB] Date help needed

2004-06-24 Thread Justin Patrin
You could loop through the weeks and put those 3 specifically in:
$days = array();
for($i = 0; $i  365; $i +=7) {
  $days[] = strtotime('next Monday', strtotime('+ '.$i.' days'));
  $days[] = strtotime('next Friday', strtotime('+ '.$i.' days'));
  $days[] = strtotime('next Sunday', strtotime('+ '.$i.' days'));
}

sort($days);

foreach($days as $day) {
  echo date('Y-m-d', $day).'br/';
}

(This is not tested, but it *should* work,)

On Thu, 24 Jun 2004 17:07:12 -0400, Chris Payne
[EMAIL PROTECTED] wrote:
 
 Hi there everyone,
 
 I have a problem, I currently have some code which populates a dropdown box
 - this code gives me every day for the next x amount of days (EG: a years
 worth of days), however what I really need to be able to do, is to find a
 way to display this data in the dropdown box but ONLY show 3 days a week,
 IE: Mondays, Fridays and Sundays, so it would show the dates for each
 Monday, Friday and Sunday for X amount of days (IE: 365 days in the
 dropdown).
 
 Does anyone have any idea how to do this?  I would really appreciate any
 help, I'd send my sample code only I'm not at my home/work computer ATM.
 
 Chris
 
 !DSPAM:40db40cb34094233914063!
 


-- 
paperCrane --Justin Patrin--

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



RE: [PHP-DB] Date help needed

2004-06-24 Thread Chris Payne
Hi there,

Just got back and tried it and it works perfectly, thank you so much for
your help, you've got me out of a bind here ;-)

Chris

You could loop through the weeks and put those 3 specifically in:
$days = array();
for($i = 0; $i  365; $i +=7) {
  $days[] = strtotime('next Monday', strtotime('+ '.$i.' days'));
  $days[] = strtotime('next Friday', strtotime('+ '.$i.' days'));
  $days[] = strtotime('next Sunday', strtotime('+ '.$i.' days'));
}

sort($days);

foreach($days as $day) {
  echo date('Y-m-d', $day).'br/';
}

(This is not tested, but it *should* work,)

On Thu, 24 Jun 2004 17:07:12 -0400, Chris Payne
[EMAIL PROTECTED] wrote:
 
 Hi there everyone,
 
 I have a problem, I currently have some code which populates a dropdown
box
 - this code gives me every day for the next x amount of days (EG: a years
 worth of days), however what I really need to be able to do, is to find a
 way to display this data in the dropdown box but ONLY show 3 days a week,
 IE: Mondays, Fridays and Sundays, so it would show the dates for each
 Monday, Friday and Sunday for X amount of days (IE: 365 days in the
 dropdown).
 
 Does anyone have any idea how to do this?  I would really appreciate any
 help, I'd send my sample code only I'm not at my home/work computer ATM.
 
 Chris
 
 !DSPAM:40db40cb34094233914063!
 


-- 
paperCrane --Justin Patrin--

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



[PHP-DB] SSL with MySQL 4.0

2004-06-24 Thread Edgar Hassler
Does PHP support SSL connections to MySQL?  If no, does anyone have an idea
how to make an SSL conncetion to MySQL using PHP?
Thanks,
Edgar Hassler

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



Re: [PHP-DB] help with consecutive numbers in db

2004-06-24 Thread Pablo M. Rivas
Hello redhat,

  Hey... look at this:

CREATE TABLE `testip` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `theip` varchar(100) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `theip` (`theip`)
) TYPE=MyISAM AUTO_INCREMENT=7 ;
  

SELECT theip, SUBSTRING_INDEX( theip, ., 1 ) *1 AS one,
substring_index( SUBSTRING_INDEX( theip, ., 2 ) , ., -1 ) *1 AS two,
substring_index( SUBSTRING_INDEX( theip, ., 3 ) , ., -1 ) *1 AS three,
SUBSTRING_INDEX( theip, ., -1 ) *1 AS four
FROM `testip` 
ORDER BY one, two, three, four

And you have all ip's ordered by number...
so you can do:
?php
   $Result=mysql_query(Select theip, SUBSTRING., $db);
   $lastgroup=0.0.0;
   $key=255;
   while(list($theIP,$one,$two,$three,$four)=mysql_fetch_row($Result)) {
  if ($lastgroup$one.$two.$three) {
 while ($key80) echo $lastgroup. . ($key++) .  is freebr\n;
 $key=1;
  }
  while ($key($four*1)) echo $one.$two.$three. . ($key++) .  is freebr\n;
  echo $one.$two.$three.$four IS NOT FREEbr\n;
  $lastgroup=$one.$two.$three;
  $key++;
   }
   while ($key80) echo $lastgroup. . ($key++) .  is freebr\n;
?

P.S. I DONT KNOW IF THIS IS TOO SLOW.. you might test..

-- 
Best regards,
 Pablo

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



Re[2]: [PHP-DB] help with consecutive numbers in db

2004-06-24 Thread Pablo M. Rivas
Hello Pablo,

  I made a Typo:
  change this: while ($key80) echo $lastgroup. . ($key++) .  is freebr\n;
  for this: while ($key255) echo $lastgroup. . ($key++) .  is freebr\n;

  ;)

-- 
Best regards,
 Pablo

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



Re: [PHP-DB] Date help needed

2004-06-24 Thread Daniel Clark
A drop down with 365 days !?!?   Isn't that a little big?

 I have a problem, I currently have some code which populates a dropdown
 box
 - this code gives me every day for the next x amount of days (EG: a years
 worth of days), however what I really need to be able to do, is to find a
 way to display this data in the dropdown box but ONLY show 3 days a week,
 IE: Mondays, Fridays and Sundays, so it would show the dates for each
 Monday, Friday and Sunday for X amount of days (IE: 365 days in the
 dropdown).



 Does anyone have any idea how to do this?  I would really appreciate any
 help, I'd send my sample code only I'm not at my home/work computer ATM.

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



[PHP-DB] RE: Subject: Update data problem

2004-06-24 Thread Justin.Baiocchi
Hi Neil,

I have tried it like that with no luck, what is below just happens to be
my latest attempts to get it working.

What is happening is that it is saying that $C and $G are zero, when in
fact there is data in there.

How do I get it to 'refresh' the variables? That is what I am trying to
do with:
$query = SELECT C, G FROM media;
$result = mysql_query($query);


-Original Message-
From: Neil Smith [MVP, Digital media]
[mailto:[EMAIL PROTECTED] 
Sent: Friday, 25 June 2004 1:51 AM
To: [EMAIL PROTECTED]
Cc: Baiocchi, Justin (LI, Armidale)
Subject: Re: Subject: Update data problem


Is there any obvious reason why you're not doing this in one query

$query = UPDATE media SET A='$A', B='$B', C='$C', G=E*'$C';

Or have I missed something here ?

Cheers - Neil

At 10:07 24/06/2004 +, you wrote:
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary=_=_NextPart_001_01C459A5.F8D9AF1D
Date: Thu, 24 Jun 2004 14:44:45 +1000
Message-ID:
[EMAIL PROTECTED]
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Update data problem


if($update)

{

mysql_pconnect(localhost,root,password);
mysql_select_db(options);


$query = UPDATE media SET A='$A', B='$B', C='$C';
$result = mysql_query($query);

$query = SELECT C, G FROM media;
$result = mysql_query($query);

$E= $C*$G;


$query = UPDATE media SET E='$E';
$result = mysql_query($query);

}



CaptionKit http://www.captionkit.com : Production tools
for accessible subtitled internet media, transcripts
and searchable video. Supports Real Player, Quicktime
and Windows Media Player.

VideoChat with friends online, get Freshly Toasted every
day at http://www.fresh-toast.net : NetMeeting solutions
for a connected world.

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



Re: [PHP-DB] SSL with MySQL 4.0

2004-06-24 Thread Cole S. Ashcraft
Is there such thing as SSL connections to MySQL?
Edgar Hassler wrote:
Does PHP support SSL connections to MySQL?  If no, does anyone have an idea
how to make an SSL conncetion to MySQL using PHP?
Thanks,
   Edgar Hassler
 


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is believed to be clean.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Date help needed

2004-06-24 Thread Chris Payne
Hi there,

A drop down with 365 days !?!?   Isn't that a little big?

Actually it's Fridays, Sundays and Tuesdays for 2 years (365 was an example)
it's for an Admin for a client, and he asked that it be in a dropdown box
and he's the boss, so he gets what he wants :-)

One thing he wanted which I didn't know how to do (Javascript I guess which
I don't know much about) was to preload a database of email address, and as
he started to type an email address it would do a sort of auto-complete, but
have no clue how to go about that so just told him not viable ATM.

Chris

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