[PHP] Re: importing contacts

2007-02-19 Thread Haydar Tuna
Hello,
 You can access your gmail account with libgmailer PHP library. 
libgmailer (class GMailer) is a PHP library that allow you to write PHP 
program to access Google's free webmail. You can download this library from 
below links

http://gmail-lite.sourceforge.net/wordpress/index.php/about/libgmailer/


Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

"kumar3k" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> hai
>  I am doing MCA in India ,now i am doing final year project in php
> language,my project title is "importing contact from gmail" any one know 
> the
> coding in php language help me.
>
> my id:[EMAIL PROTECTED]
> -- 
> View this message in context: 
> http://www.nabble.com/importing-contacts-tf3256650.html#a9054316
> 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] Poblem with sesions

2007-02-19 Thread Peter Lauri
Have you tried to print_r($_SESSION) on all the pages so that you can see
what the $_SESSION is containing and how it is changing?

Best regards,

Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free



-Original Message-
From: Ashish Rizal [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 20, 2007 12:26 AM
To: php-general@lists.php.net
Subject: [PHP] Poblem with sesions

Hi , I am having problem with log in and log out . I have a main
login page where one can login with the username and password
stored in mysql database.
PHP Code:



location.href='$adminAddress'; 
exit();
}
else if ($accesslevel == "user") {
$_SESSION['level'] = "user";
$_SESSION['username'] = $_POST['UserName'];
$_SESSION["userid"] = login($_POST);
include ('userlogin.php');
exit();
}
}
else {
//$_SESSION['loggedIn'] = false;
unset ($_SESSION['userid']);
unset ($_SESSION['username']);
unset ($_SESSION['level']);
echo "Error :$error";
}
}
//ob_end_flush();
?>





so after login user is directed to the corresponding page.

The problem is that when some user is logged in to the user page
or admin page, at the same time if i want to login to the user
page from other computers , it lets me login but after that
whatever link i click in userlogin page, takes me back to login
page. And i have to log in to userpage and click on log out and
then it will work.
its quite strange and i dont know why it is acting like this.
Also in userlogin page i am have a link to other page which i am
calling by
PHP Code:

 if ($_GET['mode'] == "basketball"){
include ('basket_closed.php');
}
and link is userlogin.php?mode=basketball 



My Log out script is
PHP Code:





I need help on this...i couldn't came up with any clue, Any idea..
i really appreciate your help

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

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



[PHP] importing contacts

2007-02-19 Thread kumar3k

hai
  I am doing MCA in India ,now i am doing final year project in php
language,my project title is "importing contact from gmail" any one know the
coding in php language help me.

my id:[EMAIL PROTECTED]
-- 
View this message in context: 
http://www.nabble.com/importing-contacts-tf3256650.html#a9054316
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: FW: [PHP] Re: LOL, preg_match still not working.

2007-02-19 Thread Gregory Beaver
Beauford wrote:
> I pasted this right from my PHP file, so it is correct. Just to elaborate. I
> have tested this until my eyes are bleeding.
> 
> Sometimes this works sometimes it doesn't.
> 
> One minute !!!##$$ This is a test &&%% will work the way it is supposed to,
> the next minute it does not.
> 
> It seems that the first time through it is fine, but on the second time and
> on it is not.
> So if I keep hitting submit on my form with the above string, it will be ok
> on the first submit, but on subsequent submits it says there are invalid
> characters.
> 
> Suffice it to say, it is wonky. It seems like it works when it wants to.

The problem is in the rest your code, not the regex, otherwise it would
fail every time.  Please post the code after removing sensitive
passwords and other information, but leave as unaltered as possible.
Only then can anyone help debug this problem.

Thanks,
Greg

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



FW: [PHP] Re: LOL, preg_match still not working.

2007-02-19 Thread Beauford
I pasted this right from my PHP file, so it is correct. Just to elaborate. I
have tested this until my eyes are bleeding.

Sometimes this works sometimes it doesn't.

One minute !!!##$$ This is a test &&%% will work the way it is supposed to,
the next minute it does not.

It seems that the first time through it is fine, but on the second time and
on it is not.
So if I keep hitting submit on my form with the above string, it will be ok
on the first submit, but on subsequent submits it says there are invalid
characters.

Suffice it to say, it is wonky. It seems like it works when it wants to.

Thanks

-Original Message-
From: Janet Valade [mailto:[EMAIL PROTECTED] 
Sent: February 18, 2007 11:07 AM
To: Beauford
Subject: Re: [PHP] Re: LOL, preg_match still not working.

Perhaps the code in your email, that is working for other people, is not 
the same code that you are testing and having problems with. Perhaps you 
should try clipboarding the code from the email into a file to test 
yourself. Perhaps there is a typo in the code you are actually testing, 
so that it is not the same as the code in the email you sent to the 
list. Anyway, you can test that by clipboarding the code from your 
email, like others are doing, and testing it.

Janet


Beauford wrote:

> Mails been down since this morning (sorry, that's yesterday morning).
> Anyway, not sure if this went through, so here it is again. 
> 
> --
> 
> The bottom line is I want to allow everything in the expression and
nothing
> else. The new line does not seem to be an issue - I can put as many
returns
> as I want, but as soon as I add some punctuation, it falls apart.
> 
> As I said before, the ! and the period from my original example are
reported
> as invalid - as they are in the expression they should be valid, I'm sure
> there are other examples as well, but you can see what the problem is. If
I
> take out the ! and period from my example and leave the new lines in, it
> works fine.
> 
> Thanks
> 
> 
> 
> 
>>-Original Message-
>>From: Gregory Beaver [mailto:[EMAIL PROTECTED] 
>>Sent: February 17, 2007 12:21 PM
>>To: Beauford
>>Cc: PHP
>>Subject: [PHP] Re: LOL, preg_match still not working.
>>
>>Beauford wrote:
>>
>>>Hi,
>>>
>>>I previously had some issues with preg_match and many of 
>>
>>you tried to help,
>>
>>>but the same  problem still exists. Here it is again, if 
>>
>>anyone can explain
>>
>>>to me how to get this to work it would be great - otherwise 
>>
>>I'll just remove
>>
>>>it as I just spent way to much time on this.
>>>
>>>Thanks
>>>
>>>Here's the code.
>>>
>>> if(empty($comment)) { $formerror['comment'] = nocomments; 
>>> }
>>> elseif(!preg_match('|[EMAIL PROTECTED]&*();:_. /\t-]+$|',
>>>$comment)) {
>>> $formerror['comment'] = invalidchars;
>>> }   
>>>
>>>This produces an error, which I believe it should not.
>>>
>>>Testing 12345. This is a test of the emergency broadcast system.
>>>
>>>WAKE UP!!
>>
>>Hi,
>>
>>Your sample text contains newlines.  If you wish to allow newlines,
>>instead of " \t" you should use the whitespace selector "\s"
>>
>>>$comment = 'Testing 12345. This is a test of the emergency 
>>broadcast system.
>>
>>WAKE UP!!';
>>if(!preg_match('|[EMAIL PROTECTED]&*();:_.\s/-]+$|', $comment)) {
>>echo 'oops';
>>} else {
>>echo 'ok';
>>}
>>?>
>>
>>Try that code sample, and you'll see that it says "ok"
>>
>>What exactly are you trying to accomplish with this 
>>preg_match()?  What
>>exactly are you trying to filter out?  I understand you want to
>>eliminate "invalid characters" but why are they invalid?  I 
>>ask because
>>there may be a simpler way to solve the problem, if you can 
>>explain what
>>the problem is.
>>
>>Thanks,
>>Greg
>>
>>-- 
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
> 
> 


-- 
Janet Valade -- janet.valade.com

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



[PHP] Classified Ads Script

2007-02-19 Thread Matt Arnilo S. Baluyos (Mailing Lists)

Hello everyone,

I'm planning to put up a local classified ads website and I'm looking
for an open-source script for this.

I've already had some links from Google and Sourceforge but I'd like
to get some opinions on people who've already run a classifieds
website as to what they're using and what they think of it.

Best Regards,
Matt

--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

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



RE: [PHP] Re: LOL, preg_match still not working.

2007-02-19 Thread Beauford
Read my original email for the example string, I have referred to this in
every one of my emails. It's even at the bottom of this one.

-Original Message-
From: Al [mailto:[EMAIL PROTECTED] 
Sent: February 18, 2007 10:35 AM
To: php-general@lists.php.net
Subject: [PHP] Re: LOL, preg_match still not working.

If you want help, you must provide some example text strings that are to be 
matched.  You keep posting your pattern and that's the problem.



Beauford wrote:
> Mails been down since this morning (sorry, that's yesterday morning).
> Anyway, not sure if this went through, so here it is again. 
> 
> --
> 
> The bottom line is I want to allow everything in the expression and
nothing
> else. The new line does not seem to be an issue - I can put as many
returns
> as I want, but as soon as I add some punctuation, it falls apart.
> 
> As I said before, the ! and the period from my original example are
reported
> as invalid - as they are in the expression they should be valid, I'm sure
> there are other examples as well, but you can see what the problem is. If
I
> take out the ! and period from my example and leave the new lines in, it
> works fine.
> 
> Thanks
> 
> 
> 
>> -Original Message-
>> From: Gregory Beaver [mailto:[EMAIL PROTECTED] 
>> Sent: February 17, 2007 12:21 PM
>> To: Beauford
>> Cc: PHP
>> Subject: [PHP] Re: LOL, preg_match still not working.
>>
>> Beauford wrote:
>>> Hi,
>>>
>>> I previously had some issues with preg_match and many of 
>> you tried to help,
>>> but the same  problem still exists. Here it is again, if 
>> anyone can explain
>>> to me how to get this to work it would be great - otherwise 
>> I'll just remove
>>> it as I just spent way to much time on this.
>>>
>>> Thanks
>>>
>>> Here's the code.
>>>
>>> if(empty($comment)) { $formerror['comment'] = nocomments; 
>>> }
>>> elseif(!preg_match('|[EMAIL PROTECTED]&*();:_. /\t-]+$|',
>>> $comment)) {
>>> $formerror['comment'] = invalidchars;
>>> }   
>>>
>>> This produces an error, which I believe it should not.
>>>
>>> Testing 12345. This is a test of the emergency broadcast system.
>>>
>>> WAKE UP!!
>> Hi,
>>
>> Your sample text contains newlines.  If you wish to allow newlines,
>> instead of " \t" you should use the whitespace selector "\s"
>>
>> > $comment = 'Testing 12345. This is a test of the emergency 
>> broadcast system.
>>
>> WAKE UP!!';
>> if(!preg_match('|[EMAIL PROTECTED]&*();:_.\s/-]+$|', $comment)) {
>> echo 'oops';
>> } else {
>> echo 'ok';
>> }
>> ?>
>>
>> Try that code sample, and you'll see that it says "ok"
>>
>> What exactly are you trying to accomplish with this 
>> preg_match()?  What
>> exactly are you trying to filter out?  I understand you want to
>> eliminate "invalid characters" but why are they invalid?  I 
>> ask because
>> there may be a simpler way to solve the problem, if you can 
>> explain what
>> the problem is.
>>
>> Thanks,
>> Greg
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>

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

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



[PHP] Poblem with sesions

2007-02-19 Thread Ashish Rizal
Hi , I am having problem with log in and log out . I have a main
login page where one can login with the username and password
stored in mysql database.
PHP Code:



location.href='$adminAddress'; 
exit();
}
else if ($accesslevel == "user") {
$_SESSION['level'] = "user";
$_SESSION['username'] = $_POST['UserName'];
$_SESSION["userid"] = login($_POST);
include ('userlogin.php');
exit();
}
}
else {
//$_SESSION['loggedIn'] = false;
unset ($_SESSION['userid']);
unset ($_SESSION['username']);
unset ($_SESSION['level']);
echo "Error :$error";
}
}
//ob_end_flush();
?>





so after login user is directed to the corresponding page.

The problem is that when some user is logged in to the user page
or admin page, at the same time if i want to login to the user
page from other computers , it lets me login but after that
whatever link i click in userlogin page, takes me back to login
page. And i have to log in to userpage and click on log out and
then it will work.
its quite strange and i dont know why it is acting like this.
Also in userlogin page i am have a link to other page which i am
calling by
PHP Code:

 if ($_GET['mode'] == "basketball"){
include ('basket_closed.php');
}
and link is userlogin.php?mode=basketball 



My Log out script is
PHP Code:





I need help on this...i couldn't came up with any clue, Any idea..
i really appreciate your help

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



Re: [PHP] WHERE problem

2007-02-19 Thread Mike Shanley

This was the problem. Thanks very much!

Brad Fuller wrote:


2) INDEX is a mysql keyword.  Try putting backticks around it.
"... WHERE `index` = $randi"


  


--
Mike Shanley

~you are almost there~

"A new eye opens on March 5." -Omniversalism.com

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



RE: [PHP] WHERE problem

2007-02-19 Thread Jay Blanchard
[snip]
// Get randomized!... the moderated way...

$randi = mt_rand(1, $max-1);
$q = "SELECT text FROM fortunes WHERE index = '$randi'";
$choose = mysql_query($q);
$chosen1 = mysql_fetch_array($choose);
[/snip]

Put the random statement in the query

SELECT foo FROM bar ORDER BY RAND() LIMIT 1

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



RE: [PHP] WHERE problem

2007-02-19 Thread Brad Fuller
> -Original Message-
> From: Mike Shanley [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 3:50 PM
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] WHERE problem
> 
> Without the single-quotes, I still get nothing returned.
> 
> Bruce Cowin wrote:
> > Are you getting an error or just nothing returned?  The first thing I'd
> check is if index is a numeric field and if it is, remove the single
> quotes from around $randi in the where clause.
> >

Two things that come to mind...

1) If there are 100 records in there, is the value of the 'index' column
exactly 1-100?  It won't do any good to give it a random value of 1-100 if
your records are numbered 101-200 :P

2) INDEX is a mysql keyword.  Try putting backticks around it.
"... WHERE `index` = $randi"

If all else fails, remove the part of your code that generates the random
'index' and just use "ORDER BY RAND() LIMIT 1" in your query.

HTH,

Brad

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



Re: [PHP] WHERE problem

2007-02-19 Thread Mike Shanley

Without the single-quotes, I still get nothing returned.

Bruce Cowin wrote:

Are you getting an error or just nothing returned?  The first thing I'd check 
is if index is a numeric field and if it is, remove the single quotes from 
around $randi in the where clause.



Regards,

Bruce

  

Mike Shanley <[EMAIL PROTECTED]> 20/02/2007 9:23:08 a.m. >>>

I'd like to think I understood code a little better than this, but I've 
got a problem with my WHERE...


I know it's the WHERE because I get a good result when I leave it out. 
And the random function is also working... I honestly can't figure it 
out. Thanks in advance for help with this laughable prob.

---
// How many are there?

$result = mysql_query("SELECT count(*) FROM fortunes");
$max = mysql_result($result, 0);

// Get randomized!... the moderated way...

$randi = mt_rand(1, $max-1);
$q = "SELECT text FROM fortunes WHERE index = '$randi'";
$choose = mysql_query($q);
$chosen1 = mysql_fetch_array($choose);

// Ready to ship...

$fortune = '"' . $chosen1[0] . 
'"-Omniversalism.com';


mysql_close();

  


--
Mike Shanley

~you are almost there~

"A new eye opens on March 5." -Omniversalism.com

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



Re: [PHP] WHERE problem

2007-02-19 Thread Bruce Cowin
Are you getting an error or just nothing returned?  The first thing I'd check 
is if index is a numeric field and if it is, remove the single quotes from 
around $randi in the where clause.



Regards,

Bruce

>>> Mike Shanley <[EMAIL PROTECTED]> 20/02/2007 9:23:08 a.m. >>>
I'd like to think I understood code a little better than this, but I've 
got a problem with my WHERE...

I know it's the WHERE because I get a good result when I leave it out. 
And the random function is also working... I honestly can't figure it 
out. Thanks in advance for help with this laughable prob.
---
// How many are there?

$result = mysql_query("SELECT count(*) FROM fortunes");
$max = mysql_result($result, 0);

// Get randomized!... the moderated way...

$randi = mt_rand(1, $max-1);
$q = "SELECT text FROM fortunes WHERE index = '$randi'";
$choose = mysql_query($q);
$chosen1 = mysql_fetch_array($choose);

// Ready to ship...

$fortune = '"' . $chosen1[0] . 
'"-Omniversalism.com';

mysql_close();

-- 
Mike Shanley

~you are almost there~

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

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



[PHP] WHERE problem

2007-02-19 Thread Mike Shanley
I'd like to think I understood code a little better than this, but I've 
got a problem with my WHERE...


I know it's the WHERE because I get a good result when I leave it out. 
And the random function is also working... I honestly can't figure it 
out. Thanks in advance for help with this laughable prob.

---
// How many are there?

$result = mysql_query("SELECT count(*) FROM fortunes");
$max = mysql_result($result, 0);

// Get randomized!... the moderated way...

$randi = mt_rand(1, $max-1);
$q = "SELECT text FROM fortunes WHERE index = '$randi'";
$choose = mysql_query($q);
$chosen1 = mysql_fetch_array($choose);

// Ready to ship...

$fortune = '"' . $chosen1[0] . 
'"-Omniversalism.com';


mysql_close();

--
Mike Shanley

~you are almost there~

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



RE: [PHP] Catch STDERR

2007-02-19 Thread Peter Lauri
It looks like that will be the situation. Sad that exec() don't have that
feature as an option. Maybe in the future :)

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free


-Original Message-
From: M.Sokolewicz [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 19, 2007 11:59 AM
To: Frank Arensmeier
Cc: Peter Lauri; php-general@lists.php.net
Subject: Re: [PHP] Catch STDERR

you could instead use the proc_* functions to do this. However, seen as 
those are pretty complicated and were not available in most php versions 
ran by most hosts, a lot of people had to come up with  other ways 
around it. The most used way is indeed what you described. A simple:
$t = tempnam();
exec('/bin/SomeCommand 2>'.$t);
$stderror = file_get_contents($t);

is what most scripts seem to use currently
- tul

Frank Arensmeier wrote:
> Spontaneously, my suggestion would to pipe the STDERR output from your 
> command to a file. I have to admit that this doesn't feel like the most 
> efficient solution since you would involve some reading / writing to 
> your filesystem.
> 
> Regards.
> //frank
> 
> 17 feb 2007 kl. 21.49 skrev Peter Lauri:
> 
>> Hi,
>>
>> I am executing exec('some cool command', $stdout, $exitcode);
>>
>> That is fine. I get what I in the beginning wanted. However, now I 
>> need to
>> catch the STDERR that the command is generating as well. Some of you 
>> might
>> tell me to redirect STDERR to STDOUT, but that is not possible as I 
>> need to
>> use the STDOUT as is to automate a process.
>>
>> I know I can do fwrite(STDERR, 'Output some error\n');
>>
>> So could I fread(STDERR, SOMESIZE)?
>>
>> Is there anyone with experience of best way of doing this? Should I maybe
>> use proc_open or something similar and then write it to a file, and then
>> read that file? Hrm, doesn't make any sense to do that.
>>
>> Best regards,
>> Peter Lauri
>>
>> www.dwsasia.com - company web site
>> www.lauri.se - personal web site
>> www.carbonfree.org.uk - become Carbon Free
>>
>> -- 
>> 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] Month

2007-02-19 Thread Dan Shirah

GAH!   Sorry.  

On 2/19/07, Brad Bonkoski <[EMAIL PROTECTED]> wrote:


Dan Shirah wrote:
> Just when I think I'm getting the hang of PHP, I get confused beyond
> belief
> :|
>
> Is this working for you guys?  When I test my page only 1/2 of the
months
> show up now.  
>
> 
> for ($m=1;$m<=12;$m++) {
> $months=date('M', mktime(0, 0, 0, $m, 1));
> echo "$months";
Still missing a double quote in there.
echo "$months";
> }
>?>
> 
>
>
> On 2/19/07, Brad Fuller <[EMAIL PROTECTED]> wrote:
>>
>> > -Original Message-
>> > From: Dan Shirah [mailto:[EMAIL PROTECTED]
>> > Sent: Monday, February 19, 2007 2:08 PM
>> > To: Brad Fuller
>> > Cc: Jay Blanchard; php-general
>> > Subject: Re: [PHP] Month
>> >
>> > Okay, when I try the sprintf I get the following error when I try to
>> save
>> > my
>> > form
>> >
>> > Incorrect syntax near 's'.
>> >
>> > 
>> > > >  for ($m=1;$m<=12;$m++) {
>> >  $months=date('M', mktime(0, 0, 0, $m, 2));
>> >  echo "$months";
>> >  }
>> > ?>
>> > 
>>
>> I'm pretty sure you need to use double quotes on the format string.
>>
>> echo "$months";
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>




Re: [PHP] Month

2007-02-19 Thread Brad Bonkoski

Dan Shirah wrote:
Just when I think I'm getting the hang of PHP, I get confused beyond 
belief

:|

Is this working for you guys?  When I test my page only 1/2 of the months
show up now.  


   $months";

Still missing a double quote in there.
echo "$months";

}
   ?>



On 2/19/07, Brad Fuller <[EMAIL PROTECTED]> wrote:


> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 2:08 PM
> To: Brad Fuller
> Cc: Jay Blanchard; php-general
> Subject: Re: [PHP] Month
>
> Okay, when I try the sprintf I get the following error when I try to
save
> my
> form
>
> Incorrect syntax near 's'.
>
> 
>   for ($m=1;$m<=12;$m++) {
>  $months=date('M', mktime(0, 0, 0, $m, 2));
>  echo "$months";
>  }
> ?>
> 

I'm pretty sure you need to use double quotes on the format string.

echo "$months";

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

2007-02-19 Thread Dan Shirah

Just when I think I'm getting the hang of PHP, I get confused beyond belief
:|

Is this working for you guys?  When I test my page only 1/2 of the months
show up now.  


   $months";
}
   ?>



On 2/19/07, Brad Fuller <[EMAIL PROTECTED]> wrote:


> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 2:08 PM
> To: Brad Fuller
> Cc: Jay Blanchard; php-general
> Subject: Re: [PHP] Month
>
> Okay, when I try the sprintf I get the following error when I try to
save
> my
> form
>
> Incorrect syntax near 's'.
>
> 
>   for ($m=1;$m<=12;$m++) {
>  $months=date('M', mktime(0, 0, 0, $m, 2));
>  echo "$months";
>  }
> ?>
> 

I'm pretty sure you need to use double quotes on the format string.

echo "$months";

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




Re: [PHP] Month

2007-02-19 Thread Brad Bonkoski

Dan Shirah wrote:
Okay, when I try the sprintf I get the following error when I try to 
save my

form

Incorrect syntax near 's'.


   $months";

try: echo "$months";
your trying to call a function inside of a string...
-B

}
   ?>



On 2/19/07, Brad Fuller <[EMAIL PROTECTED]> wrote:


> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 1:44 PM
> To: Jay Blanchard
> Cc: php-general
> Subject: Re: [PHP] Month
>
> Okay, so sprintf("%02s", $m) means that the value of $m would be 
checked

> for
> the amount of digits returned.  If less than two digits a zero 
would be

> added to the front, correct?

Yes.

% = start of format string
0 = padding specifier
2 = width specifier
s = type specifier (string)

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

2007-02-19 Thread Brad Bonkoski

Brad Bonkoski wrote:

Dan Shirah wrote:
Okay, when I try the sprintf I get the following error when I try to 
save my

form

Incorrect syntax near 's'.


   $months";

try: echo "$months";
your trying to call a function inside of a string...

oops..typo, forgot the additional {"}
echo "$months";


-B

}
   ?>



On 2/19/07, Brad Fuller <[EMAIL PROTECTED]> wrote:


> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 1:44 PM
> To: Jay Blanchard
> Cc: php-general
> Subject: Re: [PHP] Month
>
> Okay, so sprintf("%02s", $m) means that the value of $m would be 
checked

> for
> the amount of digits returned.  If less than two digits a zero 
would be

> added to the front, correct?

Yes.

% = start of format string
0 = padding specifier
2 = width specifier
s = type specifier (string)

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

2007-02-19 Thread Brad Fuller
> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 2:08 PM
> To: Brad Fuller
> Cc: Jay Blanchard; php-general
> Subject: Re: [PHP] Month
> 
> Okay, when I try the sprintf I get the following error when I try to save
> my
> form
> 
> Incorrect syntax near 's'.
> 
> 
>   for ($m=1;$m<=12;$m++) {
>  $months=date('M', mktime(0, 0, 0, $m, 2));
>  echo "$months";
>  }
> ?>
> 

I'm pretty sure you need to use double quotes on the format string.

echo "$months";

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



Re: [PHP] Month

2007-02-19 Thread Dan Shirah

Okay, when I try the sprintf I get the following error when I try to save my
form

Incorrect syntax near 's'.


   $months";
}
   ?>



On 2/19/07, Brad Fuller <[EMAIL PROTECTED]> wrote:


> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 1:44 PM
> To: Jay Blanchard
> Cc: php-general
> Subject: Re: [PHP] Month
>
> Okay, so sprintf("%02s", $m) means that the value of $m would be checked
> for
> the amount of digits returned.  If less than two digits a zero would be
> added to the front, correct?

Yes.

% = start of format string
0 = padding specifier
2 = width specifier
s = type specifier (string)

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




RE: [PHP] Month

2007-02-19 Thread Brad Fuller
> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 1:44 PM
> To: Jay Blanchard
> Cc: php-general
> Subject: Re: [PHP] Month
> 
> Okay, so sprintf("%02s", $m) means that the value of $m would be checked
> for
> the amount of digits returned.  If less than two digits a zero would be
> added to the front, correct?

Yes.

% = start of format string
0 = padding specifier
2 = width specifier
s = type specifier (string)

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



Re: [PHP] Month

2007-02-19 Thread Dan Shirah

Okay, so sprintf("%02s", $m) means that the value of $m would be checked for
the amount of digits returned.  If less than two digits a zero would be
added to the front, correct?

On 2/19/07, Jay Blanchard <[EMAIL PROTECTED]> wrote:


[snip]
If I change my date value to m instead of M, that would only affect the
visual month representation that they see, and not the "selected" value
that I want to input into my database thoughright?
[/snip]

Do a combination.



RE: [PHP] Month

2007-02-19 Thread Jay Blanchard
[snip]
If I change my date value to m instead of M, that would only affect the
visual month representation that they see, and not the "selected" value
that I want to input into my database thoughright?
[/snip]

Do a combination.

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



RE: [PHP] Month

2007-02-19 Thread Brad Fuller
> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 1:27 PM
> To: php-general
> Subject: [PHP] Month
> 
> Greetings,
> 
> I have the following code which populates a dropdown box so a user can
> select a month.  They see the month name and the SELECTED value is the
> corresponding numeric value 1-12 for the month.   However, the selected
> value for January would be 1.   I need the selected value fro January to
> be
> 01.  How would I accomplish this?
> 
> 
>   for ($m=1;$m<=12;$m++)
>  {
>   $months=date('M', mktime(0, 0, 0, $m, 1));
>   if ($m == $_POST['month'])
>echo "{$months}";
>   else
>echo "$months";
>  }
> ?>
> 

sprintf("%02s", $m)

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



Re: [PHP] Month

2007-02-19 Thread Dan Shirah

If I change my date value to m instead of M, that would only affect the
visual month representation that they see, and not the "selected" value that
I want to input into my database thoughright?

On 2/19/07, Jay Blanchard <[EMAIL PROTECTED]> wrote:


[snip]
I have the following code which populates a dropdown box so a user can
select a month.  They see the month name and the SELECTED value is the
corresponding numeric value 1-12 for the month.   However, the selected
value for January would be 1.   I need the selected value fro January to
be
01.  How would I accomplish this?


   {$months}";
 else
  echo "$months";
}
   ?>

[/snip]

http://www.php.net/date




Re: [PHP] Month

2007-02-19 Thread Brad Bonkoski

Dan Shirah wrote:

Greetings,

I have the following code which populates a dropdown box so a user can
select a month.  They see the month name and the SELECTED value is the
corresponding numeric value 1-12 for the month.   However, the selected
value for January would be 1.   I need the selected value fro January 
to be

01.  How would I accomplish this?


   {$months}";
 else
  echo "$months";
}
   ?>



Probably a number of options..
check functions... str_pad(), sprintf()
Or you could just have an array...
$months = array('01'=>'January','02'=>'February', ...)
foreach($months as $k => $v) {
   echo "$v\n";
}
(Not usually recommended, but the name/values of months do not change 
often...)


-B

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



RE: [PHP] Month

2007-02-19 Thread Jay Blanchard
[snip]
I have the following code which populates a dropdown box so a user can
select a month.  They see the month name and the SELECTED value is the
corresponding numeric value 1-12 for the month.   However, the selected
value for January would be 1.   I need the selected value fro January to
be
01.  How would I accomplish this?


{$months}";
  else
   echo "$months";
 }
?>

[/snip]

http://www.php.net/date

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



[PHP] Month

2007-02-19 Thread Dan Shirah

Greetings,

I have the following code which populates a dropdown box so a user can
select a month.  They see the month name and the SELECTED value is the
corresponding numeric value 1-12 for the month.   However, the selected
value for January would be 1.   I need the selected value fro January to be
01.  How would I accomplish this?


   {$months}";
 else
  echo "$months";
}
   ?>



Re: [PHP] serialize() and special ANSI characters

2007-02-19 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-02-19 17:29:53 +0100:
> Roman Neuhauser wrote:
> >
> >class serializeASCII241 extends Tence_TestCase
> >{
> >function testTruncates()
> >{
> >return $this->assertEquals(
> >"120GB 2X512MB 15.4IN DVD",
> >serialize("120GB 2X512MB 15.4IN DVD" . chr(241) . "RW VHP  FR")
> >);
> >}
> >}
> >
> >?>
> 
> I'd just like to point out that your test will fail systematically 
> unless you use something like this :
> 
>  function testTruncates()
>  {
>   $string = "120GB 2X512MB 15.4IN DVD" . chr(241) . "RW VHP  FR";
> return $this->assertEquals(
>  "s:" . strlen($string) . ":\"120GB 2X512MB 15.4IN DVD",
>  serialize("120GB 2X512MB 15.4IN DVD" . chr(241) . "RW VHP  FR")
>  );
>  }

You're right, of course, I wrote that in a hurry, after I checked the
output of serialize() contained the whole input.

This is a better test, and it does work with the beforementioned
configuration (5.2.1 on FreeBSD).

raw = "120GB 2X512MB 15.4IN DVD" . chr(241) . "RW VHP  FR";
$this->serialized = sprintf(
's:%d:"%s";', strlen($this->raw), $this->raw
);
}
function testWorksAsExpected()
{
return $this->assertEquals(
$this->serialized,
serialize($this->raw)
);
}
}

?>

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] css in mail()

2007-02-19 Thread tedd

At 4:38 PM +0100 2/19/07, Jochem Maas wrote:

Danial Rahmanzadeh wrote:

 how can i use css with mail()?


this kind of question is really annoying [today] - it shows that you are
a f***ing lazy b'std who can't even be bothered to formulate a question
properly let alone type something like 'CSS mail php' into the nearest
search engine.

we are not here to do your job for you.**

please STFW and go find yourself a tutorial/clue/code-snippet
related to sending HTML email [using php].

**suppressing the desire to rant along the lines of "my job went to India
and now I'm relegated to spoon feeding the answers to the moron, who has been
programming for all of 3 days but *is* getting paid for the work I'm 
still doing,

for free"


Jochem:

Well... I see no reason to sugar-coat your reply. Tell him what you 
really think. :-)


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

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



Re: [PHP] css in mail()

2007-02-19 Thread Sancar Saran
On Monday 19 February 2007 17:03, Danial Rahmanzadeh wrote:
> how can i use css with mail()?
> thank u



Title
".$data."


Html content

";

mail('[EMAIL PROTECTED]', 'You are welcome', $mail);
?>

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



Re: [PHP] Change in 5.2.1 re. parsing of URL

2007-02-19 Thread Lewis Kapell
If this has nothing to do with PHP, maybe you can explain why the 
behavior was broken when I upgraded from 5.2.0 to 5.2.1, and started 
working again the instant I reverted back to 5.2.0.  No other 
configuration changes were made on the web server.


??

Thank you,

Lewis Kapell
Computer Operations
Seton Home Study School


Jochem Maas wrote:

Lewis Kapell wrote:

There seems to be a behavior change introduced in 5.2.1 and I would like
to know if it was deliberate.


[snip]


this is nothing to do with php - it's down to your webserver settings.




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



Re: [PHP] serialize() and special ANSI characters

2007-02-19 Thread Youri LACAN-BARTLEY

Roman Neuhauser wrote:

# [EMAIL PROTECTED] / 2007-02-19 15:56:15 +0100:
I'm just curious to find out if I'm the only person to have bumped into 
this kind of issue with serialize/unserialize.


When I try and serialize an array containing a string value with the "?" 
character (alt+241 ASCII) such as :

"120GB 2X512MB 15.4IN DVD?RW VHP  FR"

The resulting serialized array is truncated.
ie. I would obtain :
			 
"a:17:{i:0;s:1:"A";i:1;s:7:"TOSHIBA";i:2;s:4:"3740";i:3;s:7:"404D862";i:4;s:31:"SATELLITE 
A100-044 CD/T2060-1.6";i:5;s:35:"120GB 2X512MB 15.4IN DVD"


As you can see serialization seems to stall as soon as the "?" character 
shows up.


I don't see the effect you're mentioning, but this is on FreeBSD, so
perhaps there's a problem on Windows.  I don't really believe it,
though, and would hazard a guess you're running into display problems
with your browser.

Another thing to mention is that ASCII only goes up to 127.  You may
desire for ASCII 241 to mean +/-, but n-tilde is also a popular
interpretation... Use a character set which actually includes +/- as a
single character, and an encoding that can handle that charset.


I'm probably just running into so encoding issues with the CSV files I'm 
using on which I have no control whatsoever.




The following test fails in 5.2.1:

assertEquals(
"120GB 2X512MB 15.4IN DVD",
serialize("120GB 2X512MB 15.4IN DVD" . chr(241) . "RW VHP  FR")
);
}
}

?>


I'd just like to point out that your test will fail systematically 
unless you use something like this :


 function testTruncates()
 {
$string = "120GB 2X512MB 15.4IN DVD" . chr(241) . "RW VHP  FR";
return $this->assertEquals(
 "s:" . strlen($string) . ":\"120GB 2X512MB 15.4IN DVD",
 serialize("120GB 2X512MB 15.4IN DVD" . chr(241) . "RW VHP  FR")
 );
 }





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



Re: [PHP] Change in 5.2.1 re. parsing of URL

2007-02-19 Thread Jochem Maas
Lewis Kapell wrote:
> There seems to be a behavior change introduced in 5.2.1 and I would like
> to know if it was deliberate.
> 
> A couple of years ago, PHP introduced functionality that made it
> possible to use a certain trick.  I don't know how to describe this
> trick in words, so I will illustrate with an example.
> 
> http://www.mydomain.com/mypage.php/phonypage.pdf
> 
> In this example there is a PHP script called mypage.php which serves up
> a PDF.  Putting the extra text at the end of the URL makes it appear to
> the user's browser that the URL ends with '.pdf' rather than '.php'.  We
> introduced this hack at my company because a few users were unable to
> view pages containing PDF or RTF content, presumably because of some
> combination of browser and/or firewall settings.
> 
> I find that version 5.2.1 breaks this behavior - attempting to visit a
> URL such as the above produces a 'page not found' error.  Presumably
> because it is trying to find the file 'phonypage.pdf' which doesn't exist.
> 
> My question is, should this be regarded as a bug which might be fixed?
> Or is this a deliberate change of behavior?

this is nothing to do with php - it's down to your webserver settings.

> 

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



[PHP] Change in 5.2.1 re. parsing of URL

2007-02-19 Thread Lewis Kapell
There seems to be a behavior change introduced in 5.2.1 and I would like 
to know if it was deliberate.


A couple of years ago, PHP introduced functionality that made it 
possible to use a certain trick.  I don't know how to describe this 
trick in words, so I will illustrate with an example.


http://www.mydomain.com/mypage.php/phonypage.pdf

In this example there is a PHP script called mypage.php which serves up 
a PDF.  Putting the extra text at the end of the URL makes it appear to 
the user's browser that the URL ends with '.pdf' rather than '.php'.  We 
introduced this hack at my company because a few users were unable to 
view pages containing PDF or RTF content, presumably because of some 
combination of browser and/or firewall settings.


I find that version 5.2.1 breaks this behavior - attempting to visit a 
URL such as the above produces a 'page not found' error.  Presumably 
because it is trying to find the file 'phonypage.pdf' which doesn't exist.


My question is, should this be regarded as a bug which might be fixed? 
Or is this a deliberate change of behavior?


--

Thank you,

Lewis Kapell
Computer Operations
Seton Home Study School

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



[PHP] Re: remote fopen not working, despite allow_url_fopen = on

2007-02-19 Thread alex handle

On 2/15/07, alex handle <[EMAIL PROTECTED]> wrote:


Hi all,

i recently upgraded a server from
freebsd 5.x to 6.2
php 4.4.2  -> php 4.4.4
apache 1.3 -> apache 2.2.4.

It worked all great till i noticed that the remote fopen()/file() did not
work.

allow_url_fopen is set to "On" and the httpd-error.log shows this error
message:

[Thu Feb 15 14:15:42 2007] [error] [client xxx] PHP Warning:  file() [function.file ]: php_network_getaddresses:
getaddrinfo failed: hostname nor servname provided, or not known in
/home/domains/x/xxx/tmp/remote.php on line 2
[Thu Feb 15 14:15:42 2007] [error] [client xxx] PHP Warning:  file(
http://google.com/) [function.file]: failed to
open stream: Invalid argument in /home/domains/x/xxx/tmp/remote.php on line
2

A lynx from the server to google.com works.
Then i put google.com in the /etc/hosts file and i got this message:

[Thu Feb 15 14:19:47 2007] [error] [client xxx] PHP Warning:  file(
http://google.com/) [function.file]: failed to
open stream: HTTP request failed!  in /home/domains/x/xxx/tmp/remote.php on
line 2

With curl i can fetch remote content, but i have to put the domainname in
the hosts file. Verry strange!?

Here my test file:
http://google.com/') );
?>

phpinfo and configure.log of the freebsd-ports is attached

 Thanks in
advance!

Alex




A minute ago i tried to run my test script (remote.php) on the shell and the
remote fopen works!!
The problem must be within the php apache module or apache self.
Is there a way to debug the php apache module?


Re: [PHP] serialize() and special ANSI characters

2007-02-19 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-02-19 15:56:15 +0100:
> I'm just curious to find out if I'm the only person to have bumped into 
> this kind of issue with serialize/unserialize.
> 
> When I try and serialize an array containing a string value with the "?" 
> character (alt+241 ASCII) such as :
>   "120GB 2X512MB 15.4IN DVD?RW VHP  FR"
> 
> The resulting serialized array is truncated.
> ie. I would obtain :
>
> "a:17:{i:0;s:1:"A";i:1;s:7:"TOSHIBA";i:2;s:4:"3740";i:3;s:7:"404D862";i:4;s:31:"SATELLITE
>  
> A100-044 CD/T2060-1.6";i:5;s:35:"120GB 2X512MB 15.4IN DVD"
> 
> As you can see serialization seems to stall as soon as the "?" character 
> shows up.

I don't see the effect you're mentioning, but this is on FreeBSD, so
perhaps there's a problem on Windows.  I don't really believe it,
though, and would hazard a guess you're running into display problems
with your browser.

Another thing to mention is that ASCII only goes up to 127.  You may
desire for ASCII 241 to mean +/-, but n-tilde is also a popular
interpretation... Use a character set which actually includes +/- as a
single character, and an encoding that can handle that charset.

The following test fails in 5.2.1:

assertEquals(
"120GB 2X512MB 15.4IN DVD",
serialize("120GB 2X512MB 15.4IN DVD" . chr(241) . "RW VHP  FR")
);
}
}

?>

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

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



Re: [PHP] css in mail()

2007-02-19 Thread Jochem Maas
Danial Rahmanzadeh wrote:
> how can i use css with mail()?

this kind of question is really annoying [today] - it shows that you are
a f***ing lazy b'std who can't even be bothered to formulate a question
properly let alone type something like 'CSS mail php' into the nearest
search engine.

we are not here to do your job for you.**

please STFW and go find yourself a tutorial/clue/code-snippet
related to sending HTML email [using php].

**suppressing the desire to rant along the lines of "my job went to India
and now I'm relegated to spoon feeding the answers to the moron, who has been
programming for all of 3 days but *is* getting paid for the work I'm still 
doing,
for free"

> thank u
> 

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



[PHP] css in mail()

2007-02-19 Thread Danial Rahmanzadeh

how can i use css with mail()?
thank u


[PHP] serialize() and special ANSI characters

2007-02-19 Thread Youri LACAN-BARTLEY

Hi all,

I'm just curious to find out if I'm the only person to have bumped into 
this kind of issue with serialize/unserialize.


When I try and serialize an array containing a string value with the "±" 
character (alt+241 ASCII) such as :

"120GB 2X512MB 15.4IN DVD±RW VHP  FR"

The resulting serialized array is truncated.
ie. I would obtain :
			 
"a:17:{i:0;s:1:"A";i:1;s:7:"TOSHIBA";i:2;s:4:"3740";i:3;s:7:"404D862";i:4;s:31:"SATELLITE 
A100-044 CD/T2060-1.6";i:5;s:35:"120GB 2X512MB 15.4IN DVD"


As you can see serialization seems to stall as soon as the "±" character 
shows up.


Do any of you have the same issue? And what could be a work around for 
this sort of problem.


This has occurred on a Windows XP box running PHP 5.2.0. The string is 
obtained from a CSV file using ANSI encoding.


Thanks,

Youri

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



RE: [PHP] Re: Securing user table with sha function

2007-02-19 Thread Tim
 

> -Message d'origine-
> De : Haydar Tuna [mailto:[EMAIL PROTECTED] 
> Envoyé : lundi 19 février 2007 08:12
> À : php-general@lists.php.net
> Objet : [PHP] Re: Securing user table with sha function
> 
> Hello,
> 
> 1) If you protect your site from SQL Injection, you must 
> replace all quote and blank character in your form data. 
> (with string functions)
> 2) After this step, you can  compare your password (with 
> SHA1) and database password field (with SHA1).
> 3) if comparing passwords are true, then you must use session 
> variables for username
> 4) if user forget his or her password, you can send email to 
> the user when the user answer password protected question.

Yes i have read many tutorials with this "classic" method of authentication
system.
My "vision" is to tighten it even more by using only sha1() strings in my
SELECT statements for both username and password field.
Upon conversion to SHA regardless of the input you get a 40char string so no
need for classic form input filtering using my method of storing username
and pass as SHA hash's...

Ie: 
$query = 'SELECT * FROM users WHERE username=\'' . Sha1($_POST['username'])
. '\' and pass=\'' . Sha1($_POST['pass']) . '\''; 

Well was just an idea, i'll try it, doesn't seem to interest many people,
that's ok keep using the classic method ;P

Regards,

Tim
> --
> Haydar TUNA
> Republic Of Turkey - Ministry of National Education Education 
> Technology Department Ankara / TURKEY
> Web: http://www.haydartuna.net
> 
> ""Tim"" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> > Hello,
> >
> > Now moving on into other aspects of security :P I was thinking of a 
> > way to secure my login inputs the best way possible.
> > Seeing how many different types of injection attacks their is and 
> > while observing different authentication systems I often notice the 
> > sha() function being used for passwords, which of course is the 
> > minimum requirements to saving passwords but.. Why manipulate this 
> > information in clear text wether it be email or username or pass 
> > fields, such as when you use sessions/cookies, or any other 
> method of 
> > passing authentication information from page to page (an 
> sha hash is x 
> > times less "geussable" then any other human term)... AND 
> how to secure 
> > for injection attacks?
> >
> > Now this is where i thought hey, on every login page there 
> is a user 
> > and pass input field and thus this is the only place one 
> could "peak" 
> > into my user table, and I don't want someone injecting 
> through their 
> > as the user table (three fields seperate from profile, username, 
> > email, pass) is the key to entry to the site.. SO, why not just 
> > encrypt all three fields? And store "copies" of email and username 
> > (not pass :P) in another database unecrypted or with a salt for 
> > further recovery..
> >
> > This would ensure that ANY information entered into the user and 
> > passowrd will be run through sha() thus creating a 40 char 
> length hash 
> > and covering any (?) injection possiblity through a forged input in 
> > one of those fields via my "select" routine..
> >
> > Just wondering what other security conscious people think 
> of this "plan"
> > even though it may slow down logins a tad but the tight 
> security in my 
> > opinion justifies this..
> >
> > Does anyone see an ugly flaw in this scheme?
> > Does it look viable?
> >
> > Thanks for any input,
> >
> > Regards,
> >
> > Tim
> 
> --
> PHP General Mailing List (http://www.php.net/) To 
> unsubscribe, visit: http://www.php.net/unsub.php
> 

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



[PHP] Re: What is $this->

2007-02-19 Thread Dick Richard
Thanks for the responses. Searching the web for "$this-> provided no help at
all. Your explainations got me on track and now I can find the right manual
to read!

Dick
""Dick Richard"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can someone explain what $this-> does and means. For example what does
this
> bit ot php code mean?
>
> $this->SetFont('Arial','B',15);
>
> Thanks
>
> [EMAIL PROTECTED]

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



Re: [PHP] What is $this->

2007-02-19 Thread M.Sokolewicz
Ok, I'm pretty sure you have a point there, but I can't really see it to 
be honest.


First of all, let's start out with the usual: RTFM! This page: 
http://www.php.net/oop should explain basic class/object/method/member 
terminology required to understand what's going on here.


In short you could say:
a 'class' is a collection of functions (known as 'methods') and 
variables (known as 'members'). A class is a static structure. Each 
class can spawn so-called 'objects' which are instances of that class, 
more-or-less something like a copy (better explained in the manual, 
linked).


In an object (note, not the class, but the object) the variable $this 
references that object (it references itself basically). -> is an 
operator stating 'perform the right-hand action on the left-hand object 
(referenced by that variable). So $object->help() will call the function 
help() on the object referenced as $object.


Now, I suggest you read trough the entire oop section of the manual to 
find out more in detail and better wording.


- tul

Sancar Saran wrote:

Hi,

I believe there are more offical answes available at around the web.

This is what I understand $this->

This is a base OO programming thing.

IN oo world you have to create new object to do someting.

like

$db = new adodb;

so after the generate object you will modify this object via functions.

$db->execSql($sql);

when you send this command, your class have to do someting with the object...

and program have to know which object?, because you can create unlimited 
amount of object from same code. So. $this points current object.


when you do someting with any object, inside of his class code his name was 
always $this.


Hope helps.

Sancar




On Monday 19 February 2007 02:52, Dick Richard wrote:

Can someone explain what $this-> does and means. For example what does this
bit ot php code mean?

$this->SetFont('Arial','B',15);

Thanks

[EMAIL PROTECTED]


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



Re: [PHP] What is $this->

2007-02-19 Thread Sancar Saran
Hi,

I believe there are more offical answes available at around the web.

This is what I understand $this->

This is a base OO programming thing.

IN oo world you have to create new object to do someting.

like

$db = new adodb;

so after the generate object you will modify this object via functions.

$db->execSql($sql);

when you send this command, your class have to do someting with the object...

and program have to know which object?, because you can create unlimited 
amount of object from same code. So. $this points current object.

when you do someting with any object, inside of his class code his name was 
always $this.

Hope helps.

Sancar




On Monday 19 February 2007 02:52, Dick Richard wrote:
> Can someone explain what $this-> does and means. For example what does this
> bit ot php code mean?
>
> $this->SetFont('Arial','B',15);
>
> Thanks
>
> [EMAIL PROTECTED]

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



Re: [PHP] What is $this->

2007-02-19 Thread Leonard Burton

oops, typo.

Should have been $this->message.

Leonard

On 2/18/07, André Medeiros <[EMAIL PROTECTED]> wrote:

Actually, $this->$message would be wrong, but the concept is right.

On 2/19/07, Leonard Burton <[EMAIL PROTECTED]> wrote:
> HI,
>
> > $this->SetFont('Arial','B',15);
>
> what you include is a snippet from a class.  Here is a brief into to
> how a class works, sort of like a function.  The $this refers to the
> class from inside of the class.
>
> 
> class write{
>
> var $message;
>
> function set($message){
>
>$this->$message = $message;
> }
>
> function display(){
>
>   print "$this->message\n";
> }
>
> }// class write
>
> //actually use the class
> $class = new write();
> $class->set("This is a test message");
> $class->display();
>
> ?>
>
> I hope this helps.
>
> Leonard
>
>
> --
> Leonard Burton, N9URK
> http://www.jiffyslides.com
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]
>
> "The prolonged evacuation would have dramatically affected the
> survivability of the occupants."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>




--
Leonard Burton, N9URK
http://www.jiffyslides.com
[EMAIL PROTECTED]
[EMAIL PROTECTED]

"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

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



Re: [PHP] Catch STDERR

2007-02-19 Thread M.Sokolewicz
you could instead use the proc_* functions to do this. However, seen as 
those are pretty complicated and were not available in most php versions 
ran by most hosts, a lot of people had to come up with  other ways 
around it. The most used way is indeed what you described. A simple:

$t = tempnam();
exec('/bin/SomeCommand 2>'.$t);
$stderror = file_get_contents($t);

is what most scripts seem to use currently
- tul

Frank Arensmeier wrote:
Spontaneously, my suggestion would to pipe the STDERR output from your 
command to a file. I have to admit that this doesn't feel like the most 
efficient solution since you would involve some reading / writing to 
your filesystem.


Regards.
//frank

17 feb 2007 kl. 21.49 skrev Peter Lauri:


Hi,

I am executing exec('some cool command', $stdout, $exitcode);

That is fine. I get what I in the beginning wanted. However, now I 
need to
catch the STDERR that the command is generating as well. Some of you 
might
tell me to redirect STDERR to STDOUT, but that is not possible as I 
need to

use the STDOUT as is to automate a process.

I know I can do fwrite(STDERR, 'Output some error\n');

So could I fread(STDERR, SOMESIZE)?

Is there anyone with experience of best way of doing this? Should I maybe
use proc_open or something similar and then write it to a file, and then
read that file? Hrm, doesn’t make any sense to do that.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

--
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] Multi lingual pages

2007-02-19 Thread Otto Wyss

Jochem Maas wrote:


don't go down the define('LANG_KEY', 'lang string value'); route - defines
are comparatively SLOW to create. IF you go down the road of loading in text
from 'per lang' files I would suggest using an array as the storage mechanism:

$Lang = array(
'LANG_KEY' => 'lang string value',
// .. etc
);

assoc array are much less heavy to create.


Thanks, I'll try the assoc array.


also consider that there are, imho, 2 kinds of language specific data:

1. 'static' values - button texts, [error] messages - these are specified 
during site/application
design.

Yes these are the static texts I'm talking about. They don't depend on 
data, only on layout and design.



2. 'dynamic' values - document titles, headers, content - these are specified 
by the owner/user during
the lifetime of the site/application


Sure, I've these values too and store them in the database.


for the rest I'll just say 'ditto' to most of what the other list members 
replied :-)


Thanks a lot.

O. Wyss

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



Re: [PHP] Multi lingual pages

2007-02-19 Thread Otto Wyss

Paul Novitski wrote:

Unless your site is insanely popular or huge, does the method really 


Sure I hope to once have an insanely popular or huge site, albeit that 
probably won't happen.


O. Wyss

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



Re: [PHP] Catch STDERR

2007-02-19 Thread Frank Arensmeier
Spontaneously, my suggestion would to pipe the STDERR output from  
your command to a file. I have to admit that this doesn't feel like  
the most efficient solution since you would involve some reading /  
writing to your filesystem.


Regards.
//frank

17 feb 2007 kl. 21.49 skrev Peter Lauri:


Hi,

I am executing exec('some cool command', $stdout, $exitcode);

That is fine. I get what I in the beginning wanted. However, now I  
need to
catch the STDERR that the command is generating as well. Some of  
you might
tell me to redirect STDERR to STDOUT, but that is not possible as I  
need to

use the STDOUT as is to automate a process.

I know I can do fwrite(STDERR, 'Output some error\n');

So could I fread(STDERR, SOMESIZE)?

Is there anyone with experience of best way of doing this? Should I  
maybe
use proc_open or something similar and then write it to a file, and  
then

read that file? Hrm, doesn’t make any sense to do that.

Best regards,
Peter Lauri

www.dwsasia.com - company web site
www.lauri.se - personal web site
www.carbonfree.org.uk - become Carbon Free

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