Re: [PHP] floored by floor()

2010-10-14 Thread gaojian
在 2010-10-13三的 22:48 -0700,Mattias Thorslund写道:
> Hi List,
> 
> I'm having a problem with the behavior of the floor() function:
> 
> echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!
> 
> Sanity check:
> var_dump(327.03 * 100); //prints "float(32703)" as expected
> 
> Any ideas why this happens, and how to work around it?
> 
> Thanks,
> 
> Mattias
> 
> 

i think u should read the manual about int and float:

http://www.php.net/manual/en/language.types.integer.php

http://www.php.net/manual/en/language.types.float.php#warn.float-precision


jim



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



[PHP] searching for application like Google Doc

2010-10-14 Thread 肖晗
Is there any application like Google Doc(here I mean the spreadsheet).

thanks


[PHP] Stuck in implementing PHP with HTML

2010-10-14 Thread vivek
Hi All,

Hi i am a newbie in PHP environment.

First of all my sincere regards to all behind developing this fabulous
language & of-course to every one who are sharing their knowledge & views
making others comfortable with the same.
Coming to the point i am trying to create a contact form applying server
side validation for my site using PHP. Here the problem had arises.
I have designed a from & applied validation referring the tutorials
available on web but unfortunately it is not working.
I am applying the validation & trying to show the error in the same field if
there
Here i am sending you the code snippet what i am trying to do. Your help is
highly appreciable. kindly help me out.

*form.php:-*

"Name","number"=>"Number","email"=>"Email","detail"=>"Comment");
foreach($required as $field => $label){
if(!$_POST[$field]){
$warnings[$field] = "Required";
}
if($_POST["email"] && !eregi
("^[_a-z0-9-]+(\.[_a-z0-9-]+)*...@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$_POST["email"]))
$warnings["email"] = "Invalid Email Format";

if($_POST["number"] && !eregi ("^[0-9]{10}$",$_POST["number"]))
$warnings["number"] = "Invalid number Format";

if(count($warnings)>0){
?>


Contact Form:-


Name  value="">>
Number 
value="">
Email 
value="">
Comment 
value="">






*submit.php*
 ".mysql_error()."");
mysql_select_db("dbname",$con) or die (mysql_errno().":
".mysql_error()."");

$insert_query = 'insert into GUESTBOOK (NAME,NUMBER,EMAIL,DETAIL) values(
"' . $_POST['name'] . '",
"' . $_POST['number'] . '",
"' . $_POST['email'] . '",
"' . $_POST['detail'] . '"
)';
mysql_query($insert_query) or die ('Error updating database');
mysql_close($con);
?>
header('Location: http://www.sweetsamaira.com/guest.php');

Kindly help me out. Thanks in advance.


-- 
Kind Regards,
Vivek Jadiya


RE: [PHP] Stuck in implementing PHP with HTML

2010-10-14 Thread Tommy Pham
> -Original Message-
> From: vivek [mailto:er.jadiyavi...@gmail.com]
> Sent: Thursday, October 14, 2010 2:26 AM
> To: php-general@lists.php.net
> Subject: [PHP] Stuck in implementing PHP with HTML
> 
> Hi All,
> 
> Hi i am a newbie in PHP environment.
> 
> First of all my sincere regards to all behind developing this fabulous
> language & of-course to every one who are sharing their knowledge & views
> making others comfortable with the same.
> Coming to the point i am trying to create a contact form applying server
side
> validation for my site using PHP. Here the problem had arises.
> I have designed a from & applied validation referring the tutorials
available
> on web but unfortunately it is not working.
> I am applying the validation & trying to show the error in the same field
if
> there Here i am sending you the code snippet what i am trying to do. Your
> help is highly appreciable. kindly help me out.
> 
> *form.php:-*
> 
>  $required =
> array("name"=>"Name","number"=>"Number","email"=>"Email","detail"=>
> "Comment");
> foreach($required as $field => $label){
> if(!$_POST[$field]){
> $warnings[$field] = "Required";
> }
> if($_POST["email"] && !eregi
> ("^[_a-z0-9-]+(\.[_a-z0-9-]+)*...@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-
> z]{2,3})$",$_POST["email"]))
> $warnings["email"] = "Invalid Email Format";
> 
> if($_POST["number"] && !eregi
("^[0-9]{10}$",$_POST["number"]))
> $warnings["number"] = "Invalid number Format";
> 
> if(count($warnings)>0){
> ?>
> 
> 
> Contact Form:-
> 
> 

Here is your problem... The form is submitting to submit.php while your
validation is done in form.php.  What you should do is have the form submit
TO form.php.  If validation passes, redirect via header() [1].  You might
have to use session [2] to have the value accessible in submit.php for
security reasons.

> Name   value=" echo $_POST["name"];?>"> $warnings["name"];?>>
> Number  size="40" 
> value=""> $warnings["number"];?>
> Email  size="40" 
> value=""> $warnings["email"];?>
> Comment  id="detail" 
> value=""> $warnings["detail"];?>
>  type="submit" name="Submit" value="Submit">
>  value="Reset">
> 
>  }
> else{
> echo "Thanks for valuable comments";
> }
> ?>
> 
> 
> *submit.php*
>  $con=mysql_connect("localhost","test","test1234") or die
> (mysql_errno().": ".mysql_error()."");
> mysql_select_db("dbname",$con) or die (mysql_errno().":
> ".mysql_error()."");
> 
> $insert_query = 'insert into GUESTBOOK (NAME,NUMBER,EMAIL,DETAIL)
> values(
> "' . $_POST['name'] . '",
> "' . $_POST['number'] . '",
> "' . $_POST['email'] . '",
> "' . $_POST['detail'] . '"
> )';

In submit.php, the values should be retrieved from $_SESSION.  Also, this is
very bad to SQL injection.  Look into escaping the input [3].  I suggest you
to use mysqli extension, if you can, over mysql extension.  There many
benefits to it.

> mysql_query($insert_query) or die ('Error updating database');
> mysql_close($con); ?>
> header('Location: http://www.sweetsamaira.com/guest.php');
> 
> Kindly help me out. Thanks in advance.
> 
> 
> --
> Kind Regards,
> Vivek Jadiya

Regards,
Tommy

[1] http://php.net/manual/en/function.header.php
[2] http://www.php.net/manual/en/book.session.php
[3] http://us2.php.net/manual/en/function.mysql-real-escape-string.php



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



RE: [PHP] searching for application like Google Doc

2010-10-14 Thread Bob McConnell
From: ?? 

> Is there any application like Google Doc(here I mean the spreadsheet).

What is your conception of "like"?

Have you looked at OpenOffice?

Bob McConnell

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



[PHP] Buffering output to allow headers late in code?

2010-10-14 Thread MikeB
I'm working through my class on PHP and I tried to put information from 
my sign-on process in the navbar. This didn't work well, since I had to 
reload the page to see it as the navbar was constructed earlier in the 
code than the signon process. (Hard to explain, as we are building a 
"dynamic" web page with lots of include files to fill in the main contnt 
portion of the page.)


My instructor suggested that I do the reload of the page via php

header("Location: index.php");

after the sign-in. To do this, I have to turn on output buffering.

I recall struggling to turn off output buffering since someone here 
recommended against it.


Any thoughts on this? Is this just a "quick and dirty" bypass for my 
problem, accepted practice, a really bad idea, or customary practice?


I think I can code around this with some effort by putting a switch 
statement in the header of the index.php, but that may be clumsy as 
parts of the same web page will then be processed in two different areas.


What to do?

Thanks for any advice.


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



Re: [PHP] Buffering output to allow headers late in code?

2010-10-14 Thread chris h
>
>
> I'm working through my class on PHP and I tried to put information from my
> sign-on process in the navbar. This didn't work well, since I had to reload
> the page to see it as the navbar was constructed earlier in the code than
> the signon process. (Hard to explain, as we are building a "dynamic" web
> page with lots of include files to fill in the main contnt portion of the
> page.)
>
>
I don't know if this will be much help, but I try to do all the controller /
model work before I mess with the view side.  So the controller starts off
with the ball, then he and the model pass it between each other a few times
until the controller finally hands it over to the view, who does her magic
and makes the score! ... Perhaps that analogy went to far.

At any rate!  Ideally the sign-on task would be done before any tasks that
would use sign-on data. Additionally, the layout of your page should
not necessarily dictate the order of any tasks (i.e. the sign-on box being
below the welcome box should not mean that the sign-on task gets done before
the welcome task).


Hope that helps!
Chris.


[PHP] Re: Buffering output to allow headers late in code?

2010-10-14 Thread MikeB

chris h wrote:



I'm working through my class on PHP and I tried to put information from my
sign-on process in the navbar. This didn't work well, since I had to reload
the page to see it as the navbar was constructed earlier in the code than
the signon process. (Hard to explain, as we are building a "dynamic" web
page with lots of include files to fill in the main contnt portion of the
page.)



I don't know if this will be much help, but I try to do all the controller /
model work before I mess with the view side.  So the controller starts off
with the ball, then he and the model pass it between each other a few times
until the controller finally hands it over to the view, who does her magic
and makes the score! ... Perhaps that analogy went to far.

At any rate!  Ideally the sign-on task would be done before any tasks that
would use sign-on data. Additionally, the layout of your page should
not necessarily dictate the order of any tasks (i.e. the sign-on box being
below the welcome box should not mean that the sign-on task gets done before
the welcome task).


Hope that helps!
Chris.



I guess that is kind of how I was thinking I might have to rewrite the 
code - but that seems to be a major departure from the current 
"architecture" of the website we're developing in the course and I'm 
kind of worried that it might get harder and harder to follow along in 
the lessons if I deviate too much.



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



Re: [PHP] Re: Buffering output to allow headers late in code?

2010-10-14 Thread Richard Quadling
On 14 October 2010 15:01, MikeB  wrote:
> chris h wrote:
>>>
>>>
>>> I'm working through my class on PHP and I tried to put information from
>>> my
>>> sign-on process in the navbar. This didn't work well, since I had to
>>> reload
>>> the page to see it as the navbar was constructed earlier in the code than
>>> the signon process. (Hard to explain, as we are building a "dynamic" web
>>> page with lots of include files to fill in the main contnt portion of the
>>> page.)
>>>
>>>
>> I don't know if this will be much help, but I try to do all the controller
>> /
>> model work before I mess with the view side.  So the controller starts off
>> with the ball, then he and the model pass it between each other a few
>> times
>> until the controller finally hands it over to the view, who does her magic
>> and makes the score! ... Perhaps that analogy went to far.
>>
>> At any rate!  Ideally the sign-on task would be done before any tasks that
>> would use sign-on data. Additionally, the layout of your page should
>> not necessarily dictate the order of any tasks (i.e. the sign-on box being
>> below the welcome box should not mean that the sign-on task gets done
>> before
>> the welcome task).
>>
>>
>> Hope that helps!
>> Chris.
>>
>
> I guess that is kind of how I was thinking I might have to rewrite the code
> - but that seems to be a major departure from the current "architecture" of
> the website we're developing in the course and I'm kind of worried that it
> might get harder and harder to follow along in the lessons if I deviate too
> much.

If your code is being developed along the lines of ...



then that is _PROBABLY_ of for a small one of script or a very very
small amount of code.

But for most long term development, this isn't a nice way to work.

Many developers don't like mixing things up.

A mechanism I employ that helped me when I started working with PHP is
to only have 1 echo statement in the entire page.

That way, headers, cookies, etc. can all take place as they need to
but only at the end of the script is the content released to the
client.

In effect, I was doing my own output buffering.




-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Re: Buffering output to allow headers late in code?

2010-10-14 Thread Richard Quadling
On 14 October 2010 15:09, Richard Quadling  wrote:
> then that is _PROBABLY_ of for a small one of script or a very very

"... _PROBABLY_ ok ..."

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Re: Buffering output to allow headers late in code?

2010-10-14 Thread Peter Lind
Just out of curiosity: why were you told to switch off output buffering?

Regards
Peter

-- 

WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15


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



Re: [PHP] floored by floor()

2010-10-14 Thread Mattias Thorslund

On 10/13/2010 11:56 PM, gaojian wrote:

在 2010-10-13三的 22:48 -0700,Mattias Thorslund写道:
   

Hi List,

I'm having a problem with the behavior of the floor() function:

echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!

Sanity check:
var_dump(327.03 * 100); //prints "float(32703)" as expected

Any ideas why this happens, and how to work around it?

Thanks,

Mattias


 

i think u should read the manual about int and float:

http://www.php.net/manual/en/language.types.integer.php

http://www.php.net/manual/en/language.types.float.php#warn.float-precision


jim
   


Thanks, I guess I needed to read that again. What confused me here was 
that var_dump(327.03 * 100) returns the expected value and not something 
like (float)32702.99...


Cheers,

Mattias


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



Re: [PHP] floored by floor()

2010-10-14 Thread Glen Fuller

On 10/13/2010 10:48 PM, Mattias Thorslund wrote:

Hi List,

I'm having a problem with the behavior of the floor() function:

echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!

Sanity check:
var_dump(327.03 * 100); //prints "float(32703)" as expected

Any ideas why this happens, and how to work around it?

Thanks,

Mattias




Wouldn't that be equivalent to floor(32703), and since 32703 is the 
nearest integer to 32703 it returns it?


Glen Fuller


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



Re: [PHP] floored by floor()

2010-10-14 Thread chris h
floor(32703) is different then floor(327.03 * 100).  The former is an int,
while the later is a float.  Read those links that were sent :)


Chris.


On Thu, Oct 14, 2010 at 2:14 AM, Glen Fuller  wrote:

> On 10/13/2010 10:48 PM, Mattias Thorslund wrote:
>
>> Hi List,
>>
>> I'm having a problem with the behavior of the floor() function:
>>
>> echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!
>>
>> Sanity check:
>> var_dump(327.03 * 100); //prints "float(32703)" as expected
>>
>> Any ideas why this happens, and how to work around it?
>>
>> Thanks,
>>
>> Mattias
>>
>>
>>
> Wouldn't that be equivalent to floor(32703), and since 32703 is the nearest
> integer to 32703 it returns it?
>
> Glen Fuller
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] floored by floor()

2010-10-14 Thread Mattias Thorslund

On 10/13/2010 11:14 PM, Glen Fuller wrote:

On 10/13/2010 10:48 PM, Mattias Thorslund wrote:

Hi List,

I'm having a problem with the behavior of the floor() function:

echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!

Sanity check:
var_dump(327.03 * 100); //prints "float(32703)" as expected

Any ideas why this happens, and how to work around it?

Thanks,

Mattias




Wouldn't that be equivalent to floor(32703), and since 32703 is the 
nearest integer to 32703 it returns it?


Glen Fuller


Nope, this is floating-point math fuzziness. Try it:

echo floor(32703)."\n";
echo floor(327.03 * 100)."\n";

Cheers,

Mattias

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



Re: [PHP] References in Sessions

2010-10-14 Thread Alexander Schrijver
Is my message unclear? or didn't anyone  ran into this problem?

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



Re: [PHP] References in Sessions

2010-10-14 Thread Sebastian Detert

Alexander Schrijver schrieb:

Is my message unclear? or didn't anyone  ran into this problem?

  
If you want an atomic solution, you need to save the session to your 
database. How often do you need to delete data? Isn't it better to 
delete at night when noone is online, or logout all users for some 
minutes while deleting? In addition to that I don't understand, why it 
is important to prevent deletion if a point is selected ... If you want 
to work with something that was deleted, print an error and that's it.


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



[PHP] Text messaging from the web

2010-10-14 Thread Paul M Foster
Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?

Paul

-- 
Paul M. Foster

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



Re: [PHP] Text messaging from the web

2010-10-14 Thread Larry Martell
On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster  wrote:
> Folks:
>
> Being fairly geezerly, I know almost nothing about this, so be gentle.
>
> Assuming someone entered information in a form on a website. Normally,
> you would email the responses to someone. But what if you wanted to
> send this information to a smartphone via text messaging?
>
> Is this possible, given normal programming tools (PHP/Javascript), or
> would you have to go through some commercial web to text messaging
> gateway? Does anyone know if this could be done, and how?

You can send a text message via email:

Verizon: 10digitphonenum...@vtext.com
AT&T: 10digitphonenum...@txt.att.net
Sprint: 10digitphonenum...@messaging.sprintpcs.com
T-Mobile: 10digitphonenum...@tmomail.net
Nextel: 10digitphonenum...@messaging.nextel.com
Cingular: 10digitphonenum...@cingularme.com
Virgin Mobile: 10digitphonenum...@vmobl.com
Alltel: 10digitphonenum...@message.alltel.com
CellularOne: 10digitphonenum...@mobile.celloneusa.com
Omnipoint: 10digitphonenum...@omnipointpcs.com
Qwest: 10digitphonenum...@qwestmp.com

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



Re: [PHP] Text messaging from the web

2010-10-14 Thread Alexis

iT DEPENDS on which country you are in.

In Canada you can send a text message to any mobile phone simply by 
sending an email to the phone number followed by the service provider's 
details...eg 1234567...@telus.net

Details for the exact addresses each provider use, can be found on the net.

In England there were free providers a few years ago, but I believe now 
you have to pay for the service.


Alexis

On 14/10/10 09:45, Paul M Foster wrote:

Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?

Paul



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



Re: [PHP] Text messaging from the web

2010-10-14 Thread Sebastian Detert

Paul M Foster schrieb:

Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?

Paul

  
I guess you have to connect to any kind of interface of a commercial 
provider. I searched for "php sms" on google and got several tutorials 
and informations. Just give it a try.


Sebastian

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



RE: [PHP] Text messaging from the web

2010-10-14 Thread Jay Blanchard
[snip]
Being fairly geezerly, I know almost nothing about this, so be gentle.
[/snip]

Rubber gloves first

[snip]
text messaging gateway?
[/snip]

It is fairly simple and we offer that from one of our sites (because it
is a cell phone service provider). In this case we use PHP to send the
information to the SMS gateway that the provider owns. It is a one way
operation - send only, no receive. You'd have to get into near-real time
CDR's etc - for receiving and it isn't worth it.

All of the commercial gateways that I am familiar with offer API's that
are simple and easy to implement. 

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



Re: [PHP] Text messaging from the web

2010-10-14 Thread chris h
>
> You can send a text message via email:
>
>Verizon: 10digitphonenum...@vtext.com
>AT&T: 10digitphonenum...@txt.att.net
>Sprint: 10digitphonenum...@messaging.sprintpcs.com
>T-Mobile: 10digitphonenum...@tmomail.net
>Nextel: 10digitphonenum...@messaging.nextel.com
>Cingular: 10digitphonenum...@cingularme.com
>Virgin Mobile: 10digitphonenum...@vmobl.com
>Alltel: 10digitphonenum...@message.alltel.com
>CellularOne: 10digitphonenum...@mobile.celloneusa.com
>Omnipoint: 10digitphonenum...@omnipointpcs.com
>Qwest: 10digitphonenum...@qwestmp.com
>
>
Larry, it seems like this method would only be useful if you knew the
carrier of a specific number.  Do you know of a way to determine that?


Chris.


Re: [PHP] Text messaging from the web

2010-10-14 Thread Sebastian Detert

Larry Martell schrieb:

On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster  wrote:
  

Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?



You can send a text message via email:

Verizon: 10digitphonenum...@vtext.com
AT&T: 10digitphonenum...@txt.att.net
Sprint: 10digitphonenum...@messaging.sprintpcs.com
T-Mobile: 10digitphonenum...@tmomail.net
Nextel: 10digitphonenum...@messaging.nextel.com
Cingular: 10digitphonenum...@cingularme.com
Virgin Mobile: 10digitphonenum...@vmobl.com
Alltel: 10digitphonenum...@message.alltel.com
CellularOne: 10digitphonenum...@mobile.celloneusa.com
Omnipoint: 10digitphonenum...@omnipointpcs.com
Qwest: 10digitphonenum...@qwestmp.com

  
Me again ;) Is that for free? I just found this interesting site: 
http://www.tech-faq.com/how-to-send-text-messages-free.html


Re: [PHP] Text messaging from the web

2010-10-14 Thread Bastien Koert
On Thu, Oct 14, 2010 at 11:50 AM, Larry Martell
 wrote:
> On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster  
> wrote:
>> Folks:
>>
>> Being fairly geezerly, I know almost nothing about this, so be gentle.
>>
>> Assuming someone entered information in a form on a website. Normally,
>> you would email the responses to someone. But what if you wanted to
>> send this information to a smartphone via text messaging?
>>
>> Is this possible, given normal programming tools (PHP/Javascript), or
>> would you have to go through some commercial web to text messaging
>> gateway? Does anyone know if this could be done, and how?
>
> You can send a text message via email:
>
>    Verizon: 10digitphonenum...@vtext.com
>    AT&T: 10digitphonenum...@txt.att.net
>    Sprint: 10digitphonenum...@messaging.sprintpcs.com
>    T-Mobile: 10digitphonenum...@tmomail.net
>    Nextel: 10digitphonenum...@messaging.nextel.com
>    Cingular: 10digitphonenum...@cingularme.com
>    Virgin Mobile: 10digitphonenum...@vmobl.com
>    Alltel: 10digitphonenum...@message.alltel.com
>    CellularOne: 10digitphonenum...@mobile.celloneusa.com
>    Omnipoint: 10digitphonenum...@omnipointpcs.com
>    Qwest: 10digitphonenum...@qwestmp.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Actually email doesn't work reliably with all providers. I was looking
into this for a client project. The main issue is that some providers
require the user to have a data plan since the message will arrive as
email, as opposed to text. The other is that if there is enough
traffic from your site, it may become marked as spam and future
connections will be refused.

The best is to hook up with an SMS provider who can provide the
services at a reasonable cost (cell-trust or click-a-tell) and let
them manage the SMS portion. You then need to code against their
service, which is usually pretty easy

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Text messaging from the web

2010-10-14 Thread Paul M Foster
On Thu, Oct 14, 2010 at 11:56:20AM -0400, chris h wrote:

>  You can send a text message via email:
>  � �Verizon: [1]10digitphonenum...@vtext.com
>  � �AT&T: [2]10digitphonenum...@txt.att.net
>  � �Sprint: [3]10digitphonenum...@messaging.sprintpcs.com
>  � �T-Mobile: [4]10digitphonenum...@tmomail.net
>  � �Nextel: [5]10digitphonenum...@messaging.nextel.com
>  � �Cingular: [6]10digitphonenum...@cingularme.com
>  � �Virgin Mobile: [7]10digitphonenum...@vmobl.com
>  � �Alltel: [8]10digitphonenum...@message.alltel.com
>  � �CellularOne: [9]10digitphonenum...@mobile.celloneusa.com
>  � �Omnipoint: [10]10digitphonenum...@omnipointpcs.com
>  � �Qwest: [11]10digitphonenum...@qwestmp.com
> 
>Larry, it seems like this method would only be useful if you knew the
>carrier of a specific number. �Do you know of a way to determine that?
>Chris.

Normally, you'd know who you were sending the form email to, and I would
assume you can find out their cell phone provider as well.

Paul

-- 
Paul M. Foster

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



Re: [PHP] Text messaging from the web

2010-10-14 Thread Larry Martell
On Thu, Oct 14, 2010 at 10:01 AM, Sebastian Detert
 wrote:
> Larry Martell schrieb:
>
> On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster 
> wrote:
>
>
> Folks:
>
> Being fairly geezerly, I know almost nothing about this, so be gentle.
>
> Assuming someone entered information in a form on a website. Normally,
> you would email the responses to someone. But what if you wanted to
> send this information to a smartphone via text messaging?
>
> Is this possible, given normal programming tools (PHP/Javascript), or
> would you have to go through some commercial web to text messaging
> gateway? Does anyone know if this could be done, and how?
>
>
> You can send a text message via email:
>
> Verizon: 10digitphonenum...@vtext.com
> AT&T: 10digitphonenum...@txt.att.net
> Sprint: 10digitphonenum...@messaging.sprintpcs.com
> T-Mobile: 10digitphonenum...@tmomail.net
> Nextel: 10digitphonenum...@messaging.nextel.com
> Cingular: 10digitphonenum...@cingularme.com
> Virgin Mobile: 10digitphonenum...@vmobl.com
> Alltel: 10digitphonenum...@message.alltel.com
> CellularOne: 10digitphonenum...@mobile.celloneusa.com
> Omnipoint: 10digitphonenum...@omnipointpcs.com
> Qwest: 10digitphonenum...@qwestmp.com
>
>
>
> Me again ;) Is that for free? I just found this interesting site:
> http://www.tech-faq.com/how-to-send-text-messages-free.html

Yes, you can send text messages for free this way.

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



[PHP] Re: Buffering output to allow headers late in code?

2010-10-14 Thread MikeB

Peter Lind wrote:

Just out of curiosity: why were you told to switch off output buffering?

Regards
Peter



I can't find the thread now, but it was in regards to my early 
experiments with cookies.  I was creating cookies and it worked 
mid-code, since buffering was active.


Then someone said that using buffering was a bad idea and I should 
disable it.




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



Re: [PHP] Text messaging from the web

2010-10-14 Thread Sebastian Detert

Larry Martell schrieb:

On Thu, Oct 14, 2010 at 10:01 AM, Sebastian Detert
 wrote:
  

Larry Martell schrieb:

On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster 
wrote:


Folks:

Being fairly geezerly, I know almost nothing about this, so be gentle.

Assuming someone entered information in a form on a website. Normally,
you would email the responses to someone. But what if you wanted to
send this information to a smartphone via text messaging?

Is this possible, given normal programming tools (PHP/Javascript), or
would you have to go through some commercial web to text messaging
gateway? Does anyone know if this could be done, and how?


You can send a text message via email:

Verizon: 10digitphonenum...@vtext.com
AT&T: 10digitphonenum...@txt.att.net
Sprint: 10digitphonenum...@messaging.sprintpcs.com
T-Mobile: 10digitphonenum...@tmomail.net
Nextel: 10digitphonenum...@messaging.nextel.com
Cingular: 10digitphonenum...@cingularme.com
Virgin Mobile: 10digitphonenum...@vmobl.com
Alltel: 10digitphonenum...@message.alltel.com
CellularOne: 10digitphonenum...@mobile.celloneusa.com
Omnipoint: 10digitphonenum...@omnipointpcs.com
Qwest: 10digitphonenum...@qwestmp.com



Me again ;) Is that for free? I just found this interesting site:
http://www.tech-faq.com/how-to-send-text-messages-free.html



Yes, you can send text messages for free this way.

  
I just tried it. I guess, it is only possible to use those E-Mails if 
you are a customer of that phone company, right? I tried it with my own 
provider (O2 germany),
sending an email to phonenum...@o2online.de failed, I had to activate 
that serviceby sending +OPEN to 6245, but every email to sms costs money ...
Are you sure it is possible to send sms to phones around the world to 
any provider? How do u distinguish between provider and country?


I'm sorry if I'm asking stupid stuff


Re: [PHP] Text messaging from the web

2010-10-14 Thread Larry Martell
On Thu, Oct 14, 2010 at 10:29 AM, Sebastian Detert
 wrote:
> Larry Martell schrieb:
>
> On Thu, Oct 14, 2010 at 10:01 AM, Sebastian Detert
>  wrote:
>
>
> Larry Martell schrieb:
>
> On Thu, Oct 14, 2010 at 9:45 AM, Paul M Foster 
> wrote:
>
>
> Folks:
>
> Being fairly geezerly, I know almost nothing about this, so be gentle.
>
> Assuming someone entered information in a form on a website. Normally,
> you would email the responses to someone. But what if you wanted to
> send this information to a smartphone via text messaging?
>
> Is this possible, given normal programming tools (PHP/Javascript), or
> would you have to go through some commercial web to text messaging
> gateway? Does anyone know if this could be done, and how?
>
>
> You can send a text message via email:
>
> Verizon: 10digitphonenum...@vtext.com
> AT&T: 10digitphonenum...@txt.att.net
> Sprint: 10digitphonenum...@messaging.sprintpcs.com
> T-Mobile: 10digitphonenum...@tmomail.net
> Nextel: 10digitphonenum...@messaging.nextel.com
> Cingular: 10digitphonenum...@cingularme.com
> Virgin Mobile: 10digitphonenum...@vmobl.com
> Alltel: 10digitphonenum...@message.alltel.com
> CellularOne: 10digitphonenum...@mobile.celloneusa.com
> Omnipoint: 10digitphonenum...@omnipointpcs.com
> Qwest: 10digitphonenum...@qwestmp.com
>
>
>
> Me again ;) Is that for free? I just found this interesting site:
> http://www.tech-faq.com/how-to-send-text-messages-free.html
>
>
> Yes, you can send text messages for free this way.
>
>
>
> I just tried it. I guess, it is only possible to use those E-Mails if you
> are a customer of that phone company, right? I tried it with my own provider
> (O2 germany),
> sending an email to phonenum...@o2online.de failed, I had to activate that
> serviceby sending +OPEN to 6245, but every email to sms costs money ...
> Are you sure it is possible to send sms to phones around the world to any
> provider? How do u distinguish between provider and country?
>
> I'm sorry if I'm asking stupid stuff

I have no idea how it works in other countries or with every single
provider. I do know that here in the US I do it all the time with the
carriers I listed above. I have cron based monitors that text people
via email when there are problems.

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



Re: [PHP] Text messaging from the web

2010-10-14 Thread Larry Martell
On Thu, Oct 14, 2010 at 9:56 AM, chris h  wrote:
>> You can send a text message via email:
>>    Verizon: 10digitphonenum...@vtext.com
>>    AT&T: 10digitphonenum...@txt.att.net
>>    Sprint: 10digitphonenum...@messaging.sprintpcs.com
>>    T-Mobile: 10digitphonenum...@tmomail.net
>>    Nextel: 10digitphonenum...@messaging.nextel.com
>>    Cingular: 10digitphonenum...@cingularme.com
>>    Virgin Mobile: 10digitphonenum...@vmobl.com
>>    Alltel: 10digitphonenum...@message.alltel.com
>>    CellularOne: 10digitphonenum...@mobile.celloneusa.com
>>    Omnipoint: 10digitphonenum...@omnipointpcs.com
>>    Qwest: 10digitphonenum...@qwestmp.com
>>
>
> Larry, it seems like this method would only be useful if you knew the
> carrier of a specific number.  Do you know of a way to determine that?

http://www.fonefinder.net/

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



Re: [PHP] Re: Buffering output to allow headers late in code?

2010-10-14 Thread chris h
>
>
> Then someone said that using buffering was a bad idea and I should disable
> it.
>
>
I think it leads to poor habits like calling controller methods out of the
view (essentially what you are wanting to use it for). Using it like that is
asking for spaghetti code that's hard to maintain, scale, and train new
developers on.  I'd imagine it also adds overhead, though I don't know how
much - my guess is negligible.

OB can be a great tool, but it shouldn't be a hack to get around sloppy
architecture.

Just my 2 cents :)
Chris.


Re: [PHP] floored by floor()

2010-10-14 Thread Shawn McKenzie
On 10/14/2010 09:22 AM, Mattias Thorslund wrote:
> Thanks, I guess I needed to read that again. What confused me here was
> that var_dump(327.03 * 100) returns the expected value and not something
> like (float)32702.99...
> 
> Cheers,
> 
> Mattias
> 

echo serialize(327.03 * 100);

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] References in Sessions

2010-10-14 Thread Alexander Schrijver
On Thu, Oct 14, 2010 at 05:36:29PM +0200, Sebastian Detert wrote:
> Alexander Schrijver schrieb:
> >Is my message unclear? or didn't anyone  ran into this problem?
> >
> If you want an atomic solution, you need to save the session to your
> database. How often do you need to delete data? Isn't it better to
> delete at night when noone is online, or logout all users for some
> minutes while deleting? In addition to that I don't understand, why
> it is important to prevent deletion if a point is selected ... If
> you want to work with something that was deleted, print an error and
> that's it.

Yes, i can use a database. But i can't properly use the SESSION abstraction
with a database.

suppose i build a Session handler which writes to the database it needs to
write to specific tables which contain the proper constraints.

e.g. 

table session
session_id (PK)

table companies
company_id (PK)
session_id -> session(session_id)

i.e. (one to many relationship)

Thus $_SESSION['companies'] = Array(1,2,3) needs to be translated to insert a
row in the companies table.

Now suppose someone does $_SESSION['somethingwhichdoesnexist'] = 'bladiebla'
(which is invalid) i can't make it properly fail. Because the Session handler
is run at a later point.

I can't find a method to properly work around this without rewriting to whole
session handler.

Doing deletions at night isn't solving the problem. Users can exist at night.

Printing an error isn't solving the problem either. What kind of message should
i print? "Something went wrong; i am not entirely sure what but it probably the
administrator deleted or changed a the database. Oh, and your session is now
useless".

This seemed like an obvious problem to me with an obvious solution which i
missed. Nobody has this problem?


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



[PHP] RegExp question: how to add a number?

2010-10-14 Thread Andre Polykanine
Hi everyone,
I hope you're doing well (haven't written here for a long time :-)).
The question is as follows: I have a regexp that would do the
following. If the string begins with "Re:", it will change the
beginning to "Re[2]:"; if it doesn't, then it would add "Re:" at the
beginning. But (attention, here it is!) if the string starts with
something like "Re[4]:", it should replace it by "Re[5]:".
Here's the code:

$start=mb_strtolower(mb_substr($f['Subject'], 0, 3));
if ($start=="re:") {
$subject=preg_replace("/^re:(.+?)$/usi", "re[2]:$1", $f['Subject']);
} elseif ($start=="re[") {
// Here $1+1 doesn't work, it returns "Re[4+1]:"!
$subject=preg_replace("/^re\[(\d+)\]:(.+?)$/usi", "re[$1+1]:$2", $f['Subject']);
} else {
$subject="Re: ".$f['Subject'];
}

I know there actually exists a way to do the numeral addition
("Re[5]:", not "Re[4+1]:").
How do I manage to do this?
Thanks!

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


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



[PHP] Help with sending credentials?

2010-10-14 Thread Brian Dunning
Gents -

I'm trying to work with a major vendor's web service, but all my efforts are 
met with a 401 authentication error response. I can log in manually to this URL 
using these credentials through a browser, so I know the credentials are good. 
Unfortunately the support guys at the vendor don't see any problem with my code 
and have not been able to help.

$url = "https://servername.com/script";;
$ctx = stream_context_create(array('https' => array(
'timeout' => 10,
'header'  => sprintf("Authorization: Basic %s\r\n", 
base64_encode("myUsername:myPassword"))
)));
$result = file_get_contents($url, 0, $ctx); 
$http_response = explode(' ', $http_response_header[0]);
$response_code = $http_response[1]; <<<=== This is evaluating to '401'


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



Re: [PHP] Help with sending credentials?

2010-10-14 Thread Adam Richardson
On Thu, Oct 14, 2010 at 4:45 PM, Brian Dunning wrote:

> Gents -
>
> I'm trying to work with a major vendor's web service, but all my efforts
> are met with a 401 authentication error response. I can log in manually to
> this URL using these credentials through a browser, so I know the
> credentials are good. Unfortunately the support guys at the vendor don't see
> any problem with my code and have not been able to help.
>
> $url = "https://servername.com/script";;
> $ctx = stream_context_create(array('https' => array(
>'timeout' => 10,
>'header'  => sprintf("Authorization: Basic %s\r\n",
> base64_encode("myUsername:myPassword"))
>)));
> $result = file_get_contents($url, 0, $ctx);
> $http_response = explode(' ', $http_response_header[0]);
> $response_code = $http_response[1]; <<<=== This is evaluating to '401'
>
>
> Thanks.
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Could the method (POST vs GET) or the content type be causing the issue
(hard to guess beyond this without knowing the service?)  See this simple
twitter function for examples of what I'm wondering about:
http://fabien.potencier.org/article/20/tweeting-from-php

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] RegExp question: how to add a number?

2010-10-14 Thread David Harkness
On Thu, Oct 14, 2010 at 1:42 PM, Andre Polykanine  wrote:

> But (attention, here it is!) if the string starts with
> something like "Re[4]:", it should replace it by "Re[5]:".
>

Regular expressions do not support any mathematical operations. Instead, you
need to use preg_match() to extract the number inside the brackets,
increment it, and build a new string using simple concatenation (.).

elseif ($start=="re[") {
if (preg_match('/^re\[(\d+)\](.*)/i', $f['Subject'], $matches) > 0)
{
$f['Subject'] = 'Re[' . ($matches[1] + 1) . ']' . $matches[2];
}
else {
// no closing brace -- now what?
}
}

David


Re: [PHP] RegExp question: how to add a number?

2010-10-14 Thread Richard Quadling
On 14 October 2010 21:42, Andre Polykanine  wrote:
> Hi everyone,
> I hope you're doing well (haven't written here for a long time :-)).
> The question is as follows: I have a regexp that would do the
> following. If the string begins with "Re:", it will change the
> beginning to "Re[2]:"; if it doesn't, then it would add "Re:" at the
> beginning. But (attention, here it is!) if the string starts with
> something like "Re[4]:", it should replace it by "Re[5]:".
> Here's the code:
>
> $start=mb_strtolower(mb_substr($f['Subject'], 0, 3));
> if ($start=="re:") {
> $subject=preg_replace("/^re:(.+?)$/usi", "re[2]:$1", $f['Subject']);
> } elseif ($start=="re[") {
> // Here $1+1 doesn't work, it returns "Re[4+1]:"!
> $subject=preg_replace("/^re\[(\d+)\]:(.+?)$/usi", "re[$1+1]:$2", 
> $f['Subject']);
> } else {
> $subject="Re: ".$f['Subject'];
> }
>
> I know there actually exists a way to do the numeral addition
> ("Re[5]:", not "Re[4+1]:").
> How do I manage to do this?
> Thanks!

Can you adapt this ...

http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] searching for application like Google Doc

2010-10-14 Thread Sharl.Jimh.Tsin
Are you looking for a open-source project likes it?

searching it via Google with "php"、"office doc"、"open source" key
words may help you.

Best regards,
Sharl.Jimh.Tsin (From China)



2010/10/14 Bob McConnell :
> From: ??
>
>> Is there any application like Google Doc(here I mean the spreadsheet).
>
> What is your conception of "like"?
>
> Have you looked at OpenOffice?
>
> Bob McConnell
>
> --
> 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] floored by floor()

2010-10-14 Thread Glen Fuller

On 10/14/2010 7:49 AM, chris h wrote:

floor(32703) is different then floor(327.03 * 100).  The former is an int,
while the later is a float.  Read those links that were sent :)


Chris.


On Thu, Oct 14, 2010 at 2:14 AM, Glen Fuller  wrote:


On 10/13/2010 10:48 PM, Mattias Thorslund wrote:


Hi List,

I'm having a problem with the behavior of the floor() function:

echo floor(327.03 * 100)."\n"; //prints "32702" and not "32703"!!

Sanity check:
var_dump(327.03 * 100); //prints "float(32703)" as expected

Any ideas why this happens, and how to work around it?

Thanks,

Mattias




Wouldn't that be equivalent to floor(32703), and since 32703 is the nearest
integer to 32703 it returns it?

Glen Fuller



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







I, see - makes sense now, thank you!


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