php-general Digest 1 Aug 2011 11:34:24 -0000 Issue 7423

Topics (messages 314252 through 314263):

Re: Session treating
        314252 by: Andre Polykanine

Problem with header("Location:" )...
        314253 by: Jason Pruim
        314254 by: Dajka Tamas
        314255 by: Jason Pruim
        314260 by: Tamara Temple
        314261 by: Jason Pruim

Phone numbers....
        314256 by: Jason Pruim
        314257 by: Alex Nikitin
        314258 by: Jason Pruim
        314259 by: Ashley Sheridan

Understanding deprecated features from 5.2 -> 5.3
        314262 by: robert mena

What is valid for a named parameter in a prepared query using PDO_SQLSRV.
        314263 by: Richard Quadling

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
 Hello Ashley,

> One thing sticks out a little bit to me. In your index.php file, you're 
> accessing an element of the $_SESSION array, but without calling 
> session_start() first. I believe this may be causing the issue you are seeing.

I tried using it without success. I'm having now 3 separate session IDs:
                                                                     1. Before 
the login form is processed,
2. After the login form is processed,
3. When clicking the Articles link, on the articles.php page.


-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion


--- End Message ---
--- Begin Message ---
So I'm attempting to redirect back to the main site of a page after a 
successful insert into a database... Here's my code:
<?PHP

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {

      $name = mysql_real_escape_string($_POST['txtName']);
      $comment = mysql_real_escape_string($_POST['areaComment']);
      $phonelink = mysql_real_escape_string($_POST['phonelink']);
      $SQL = "INSERT INTO comments (name, comment, phonelink) VALUES ('$name', 
'$comment', '$phonelink')";

      mysql_query($SQL) or die("Unable to insert at this time. Sorry for the 
inconvience");
      //echo "Insert successful!";
        header("Location: 
HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/");

      
      // Your code here to handle a successful verification
  }


?>


The insert happens, BUT it won't redirect back to the site....  There isn't any 
reason I should be able to do a header() redirect at that point is there?

Or is there a better way to do it?

Thanks Everyone!


Jason Pruim
li...@pruimphotography.com




--- End Message ---
--- Begin Message ---
Try lowercase 'http'. Anything in error log? Try turning on display_errors.

Cheers,

        Tamas

-----Original Message-----
From: Jason Pruim [mailto:li...@pruimphotography.com] 
Sent: Sunday, July 31, 2011 8:40 PM
To: <php-gene...@lists.php.net>
Subject: [PHP] Problem with header("Location:" )...

So I'm attempting to redirect back to the main site of a page after a
successful insert into a database... Here's my code:
<?PHP

  if (!$resp->is_valid) {
    // What happens when the CAPTCHA was entered incorrectly
    die ("The reCAPTCHA wasn't entered correctly. Go back and try it again."
.
         "(reCAPTCHA said: " . $resp->error . ")");
  } else {

      $name = mysql_real_escape_string($_POST['txtName']);
      $comment = mysql_real_escape_string($_POST['areaComment']);
      $phonelink = mysql_real_escape_string($_POST['phonelink']);
      $SQL = "INSERT INTO comments (name, comment, phonelink) VALUES
('$name', '$comment', '$phonelink')";

      mysql_query($SQL) or die("Unable to insert at this time. Sorry for the
inconvience");
      //echo "Insert successful!";
        header("Location:
HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/");

      
      // Your code here to handle a successful verification
  }


?>


The insert happens, BUT it won't redirect back to the site....  There isn't
any reason I should be able to do a header() redirect at that point is
there?

Or is there a better way to do it?

Thanks Everyone!


Jason Pruim
li...@pruimphotography.com




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



--- End Message ---
--- Begin Message ---
Jason Pruim
li...@pruimphotography.com



On Jul 31, 2011, at 2:50 PM, Dajka Tamas wrote:

> Try lowercase 'http'. Anything in error log? Try turning on display_errors.

Tried both, upper and lower case http nothing changed... And nothing in the 
error log... I try a simple echo with a link and that works just fine... 

Starting to get frustrated with it....



--- End Message ---
--- Begin Message ---

On Jul 31, 2011, at 1:40 PM, Jason Pruim wrote:

So I'm attempting to redirect back to the main site of a page after a successful insert into a database... Here's my code:
<?PHP

 if (!$resp->is_valid) {
   // What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
        "(reCAPTCHA said: " . $resp->error . ")");
 } else {

     $name = mysql_real_escape_string($_POST['txtName']);
     $comment = mysql_real_escape_string($_POST['areaComment']);
     $phonelink = mysql_real_escape_string($_POST['phonelink']);
$SQL = "INSERT INTO comments (name, comment, phonelink) VALUES ('$name', '$comment', '$phonelink')";

mysql_query($SQL) or die("Unable to insert at this time. Sorry for the inconvience");
     //echo "Insert successful!";
header("Location: HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/ ");


     // Your code here to handle a successful verification
 }


?>


The insert happens, BUT it won't redirect back to the site.... There isn't any reason I should be able to do a header() redirect at that point is there?

Since the echo is commented out, there shouldn't be any output if that is sum total of the code executing on the http request. If this file is called from some other script, you might check to see if any output is sent from there. If display_errors is on, you should be getting something like "Unable to send headers after output" or some such (I can't offhand think of the actual error message).

You can keep the "error successful" message for verification if you write it directly to the error log, via:

        error_log("Insert successful".PHP_EOL);

Sometimes, it's also nice to insert markers to let you know where the log is emanating from:

        error_log(__FILE__.'@'.__LINE__.': '."Insert successful".PHP_EOL);

Sometimes, a vexing sort of error is a blank line at the top or bottom of a file, outside the <?..?>


Or is there a better way to do it?

Thanks Everyone!


Jason Pruim
li...@pruimphotography.com




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



--- End Message ---
--- Begin Message ---




On Jul 31, 2011, at 6:23 PM, Tamara Temple wrote:

> 
> On Jul 31, 2011, at 1:40 PM, Jason Pruim wrote:
> 
>> So I'm attempting to redirect back to the main site of a page after a 
>> successful insert into a database... Here's my code:
>> <?PHP
>> 
>> if (!$resp->is_valid) {
>>   // What happens when the CAPTCHA was entered incorrectly
>>   die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
>>        "(reCAPTCHA said: " . $resp->error . ")");
>> } else {
>> 
>>     $name = mysql_real_escape_string($_POST['txtName']);
>>     $comment = mysql_real_escape_string($_POST['areaComment']);
>>     $phonelink = mysql_real_escape_string($_POST['phonelink']);
>>     $SQL = "INSERT INTO comments (name, comment, phonelink) VALUES ('$name', 
>> '$comment', '$phonelink')";
>> 
>>     mysql_query($SQL) or die("Unable to insert at this time. Sorry for the 
>> inconvience");
>>     //echo "Insert successful!";
>>       header("Location: 
>> HTTP://jason.pruimphotography.com/dev/clients/flewid/Phone/");
>> 
>> 
>>     // Your code here to handle a successful verification
>> }
>> 
>> 
>> ?>
>> 
>> 
>> The insert happens, BUT it won't redirect back to the site....  There isn't 
>> any reason I should be able to do a header() redirect at that point is there?
> 
> Since the echo is commented out, there shouldn't be any output if that is sum 
> total of the code executing on the http request. If this file is called from 
> some other script, you might check to see if any output is sent from there. 
> If display_errors is on, you should be getting something like "Unable to send 
> headers after output" or some such (I can't offhand think of the actual error 
> message).
> 
> You can keep the "error successful" message for verification if you write it 
> directly to the error log, via:
> 
>       error_log("Insert successful".PHP_EOL);
> 
> Sometimes, it's also nice to insert markers to let you know where the log is 
> emanating from:
> 
>       error_log(__FILE__.'@'.__LINE__.': '."Insert successful".PHP_EOL);
> 
> Sometimes, a vexing sort of error is a blank line at the top or bottom of a 
> file, outside the <?..?>

Just before I got your e-mail, I found there were 3 spaces at the very top of 
the file in front of my <?PHP.... I was fit to be tied as they say in the 
south...

But it is up and working properly now! 

Thank you all for your help with this! :)


Jason Pruim
li...@pruimphotography.com

--- End Message ---
--- Begin Message ---
No I'm not looking for your phone number... Or for the guy/girl whose number 
you thought you got last night at the bar but turned out to be the information 
number...

I'm working on a project for a client that I need to represent all the possible 
phone numbers in the US and Canada... Which thankfully use the same format (10 
digits) but if my math and searching are correct... I'm looking at a 
possibility of 10 BILLION possible numbers... I can think of away to program 
the insert of all 10 billion possible entries, but not really formatted 
properly...

Does any one have a database that they could send me like that? :) Or any tips 
on phone numbers?

Thanks again! :)


Jason Pruim
li...@pruimphotography.com




--- End Message ---
--- Begin Message ---
There are databases with area codes for the first 3, so you only have to
generate 1 million. Why do you need to store all of them again?
On Jul 31, 2011 4:06 PM, "Jason Pruim" <li...@pruimphotography.com> wrote:
> No I'm not looking for your phone number... Or for the guy/girl whose
number you thought you got last night at the bar but turned out to be the
information number...
>
> I'm working on a project for a client that I need to represent all the
possible phone numbers in the US and Canada... Which thankfully use the same
format (10 digits) but if my math and searching are correct... I'm looking
at a possibility of 10 BILLION possible numbers... I can think of away to
program the insert of all 10 billion possible entries, but not really
formatted properly...
>
> Does any one have a database that they could send me like that? :) Or any
tips on phone numbers?
>
> Thanks again! :)
>
>
> Jason Pruim
> li...@pruimphotography.com
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
On Jul 31, 2011, at 4:14 PM, Alex Nikitin wrote:

> There are databases with area codes for the first 3, so you only have to 
> generate 1 million. Why do you need to store all of them again?
> 

I don't necessarily need to store it... BUT I do need to be able to represent 
all the numbers somehow... The site is a "Find out who called me and why" type 
of site... So some of the numbers will have comments on them other won't... But 
I need to be able to show all the possibilities so they can add their comment 
to it....

Unless I grab the area code, the first 3 of the phone number, and then just 
randomly generate the last 4? Might be a little easier that way.... And then 
only store it once they comment on it...



--- End Message ---
--- Begin Message ---
On Sun, 2011-07-31 at 16:18 -0400, Jason Pruim wrote:

> On Jul 31, 2011, at 4:14 PM, Alex Nikitin wrote:
> 
> > There are databases with area codes for the first 3, so you only have to 
> > generate 1 million. Why do you need to store all of them again?
> > 
> 
> I don't necessarily need to store it... BUT I do need to be able to represent 
> all the numbers somehow... The site is a "Find out who called me and why" 
> type of site... So some of the numbers will have comments on them other 
> won't... But I need to be able to show all the possibilities so they can add 
> their comment to it....
> 
> Unless I grab the area code, the first 3 of the phone number, and then just 
> randomly generate the last 4? Might be a little easier that way.... And then 
> only store it once they comment on it...
> 
> 


You could just store the number as and when it gets entered. However,
have you checked on the legal ramifications of this? What you're doing
is essentially storing information which can identify an individual
(more so than a name, as names are very rarely unique) There may be
issues with doing this on numbers that are marked as unlisted, as this
is often a premium service people pay for purposely to prevent their
number appearing on such listings.

For many people, a phone number is far more private than an email
address. Most people wouldn't think twice about entering their email
address into any old blog/forum/social site, but would have great
reservations about doing so with their phone number.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hi,

I am planning to upgrade my server from 5.2 to 5.3 but I am not sure if the
deprecated features will simply throw warning messages but work or won't
work at all.  So far I've read that deprecated features are going to be
removed on later versions.

Unfortunately I host sites and some may use features like register_globals
and I need to know what to expect.

--- End Message ---
--- Begin Message ---
Hi.

Just started using PDO with the nice and shiny SQLSRV driver form
Microsoft for SQL Server.

I seem to be having an issue with named parameters in prepared statements.

Are there limitations to the characters that can be used for named parameters.

UPPER, lower and MixedCase all seem OK, but I think I'm messing up with _.

And my brain JUST fired and told me _ is a single character wildcard
(as when used within a LIKE statement).

Can anyone confirm?

The usernote http://www.php.net/manual/en/pdo.prepared-statements.php#97162
mentions the use of hyphen (-), but not underscore (_).

I'm also going to be converting an old style coding mysql to mysqli
prepared statements (I know very little mysql, so 2 lots of learning
going on here).

Would mysqli have the same behaviour?

Is it driver specific?

Regards,

Richard.

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

--- End Message ---

Reply via email to