Paul, have you found your solution yet? (Yea, my reply here is quite late . . . have not been checking mail.)

Anyway, if you haven't the solution, here's the correct code . . .

<?php
  if (!isset($_POST['Username']) && !isset($_POST['Password']))
  {
?>
  <form action="" method="post">
  <table>
<tr><td>Username</td><td><input type="text" name="Username" size="30"></td></tr> <tr><td>Password</td><td><input type="password" name="Password" size="30"></td></tr> <tr><td></td><td><input type="submit" value="Log in" id="submit"></td></tr>
  </table>
  </form>
<?php
  }
  else
  {
    // Handle the incoming Post array from Login form above
    $LoginName     = $_POST['Username'];
    $LoginPass     = $_POST['Password'];
    //Validate code here
    //If OK,
    header("Location: http://www.example.com/myPage.php";);
    exit;
  }
?>

Hope this helps.
jc





Quoting [email protected]:

Send talk mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.nyphp.org/mailman/listinfo/talk
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of talk digest..."


Today's Topics:

   1. Header() Redirect ([email protected])
   2. Re: Header()  Redirect!! (David Krings)
   3. Re: oo php (shaiju davis)
   4. Re: Header() Redirect!! (Elijah Insua)
   5. Re: oo php (Greg Rundlett (freephile))
   6. Re: Header()  Redirect!! (Paul A Houle)
   7. SEO & Php (Michele Waldman)
   8. Re: SEO & Php (Michael Hernandez)


----------------------------------------------------------------------

Message: 1
Date: Fri, 12 Jun 2009 01:56:20 GMT
From: "[email protected]" <[email protected]>
To: [email protected]
Subject: [nyphp-talk] Header() Redirect
Message-ID: <[email protected]>
Content-Type: text/plain; charset="windows-1252"

Hi everybody!
Sorry, I deleted the last thread about the page redirection. This is the guy that needs help with the page redirection.
Here is an abreviated code that I wanted to accomplish:
<?php
if ( !isset($_POST['Username']) && !isset(_POST['Password']))
  {
   <form action="<?=$PHP_SELF?>" method="post">
   <table>
<tr><td>Username</td><td><input type="text" name="Username" size="30"></td></tr> <tr><td>Password</td><td><input type="password" name="Password" size="30"></td></tr>
  <tr><td></td><td><input type="submit" value="Log in" id="submit"></td>
  </tr>
 </table>
  </form>
    }
else
    {
     // Handle the incoming Post array from Login form above
     $LoginName     = $_POST['Username'];
     $LoginPass     = $_POST['Password'];
    //Validate code here
    //If OK,
   header("Location: http://www.example.com/myPage.php";);
  exit;
 }
?>
Is there something is wrong?
I tested it and it didn't give any error, but didn't redirect the page either.
Any help?
Thanks!
Paul


____________________________________________________________
Click here for free information and resources about managing your inheritance.
http://thirdpartyoffers.netzero.net/TGL2231/fc/BLSrjnxQ00XjyIphwS4uGMYkr6ZRV0VpXdDmfbgB0IcJpIBFEIIs0U4bwdS/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090612/ef3f9b61/attachment-0001.html>

------------------------------

Message: 2
Date: Thu, 11 Jun 2009 22:07:58 -0400
From: David Krings <[email protected]>
To: NYPHP Talk <[email protected]>
Subject: Re: [nyphp-talk] Header()  Redirect!!
Message-ID: <[email protected]>
Content-Type: text/plain; charset=windows-1252; format=flowed

[email protected] wrote:
  > |<html>
<?php
/* This will give an error. Note the output
 * above, which is before the header() call */
header('Location: http://www.example.com/');
?>|
||
|If this statement is true, then how do you use header() function in any
script that does not contain any "normal HTML tags" since you typically
have to output something, whether before or after the call to the header()?|

The way I use header redirects is by first having a script that generates
output and includes some sort of a form (can even be a static page). That form gets submitted to a script that evaluates the parameters and values passed and
based on that redirects to other scripts that generate particular content.

So yes, there is a good possibility that the script using the redirect never
generates any output. BUT, some craft their applications using only a few
files that each are a huge switch statement with various blocks of code. In
those cases the first block can very well generate output whereas the second
block has the redirects. It is just that when the second block gets called the
first block is not executed. So it doesn't matter what comes first within the
script, but what ultimately gets sent to the browser first.
By the time the browser displays something it already got the header. So since
the header is already sent you cannot modify it any longer. It's like trying
to sign a check that you mailed yesterday and that the recipient already received.

David


------------------------------

Message: 3
Date: Fri, 12 Jun 2009 08:09:33 +0530
From: shaiju davis <[email protected]>
To: NYPHP Talk <[email protected]>
Subject: Re: [nyphp-talk] oo php
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

hi,

    Include the class in the file and use classsName::functionName(). I hope
it helps..


Thanks,
Shaiju Davis.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090612/f26d4939/attachment-0001.html>

------------------------------

Message: 4
Date: Fri, 12 Jun 2009 00:02:02 -0400
From: Elijah Insua <[email protected]>
To: NYPHP Talk <[email protected]>
Subject: Re: [nyphp-talk] Header() Redirect!!
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

You can also use output buffering for some interesting behavior

[ http://us3.php.net/manual/en/book.outcontrol.php ]

<?php
ob_start()
?>

<html>
 ....
</html>

<?php

if ($success)
{
  header("Location: /success");
}

ob_flush_clean()
?>

I prefer to set headers at the end of the script because it is at the end of
processing
a request that you are best able to do content-type negotiation and status
based redirection.

-- Elijah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090612/eca2462f/attachment-0001.html>

------------------------------

Message: 5
Date: Fri, 12 Jun 2009 08:24:23 -0400
From: "Greg Rundlett (freephile)" <[email protected]>
To: NYPHP Talk <[email protected]>
Subject: Re: [nyphp-talk] oo php
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Assuming the class definition is in memory b/c the defining file is loaded
(require, include, auto-load),
you can call the method by either:
a) instantiating an object instance of the class and then calling the method
b) calling the method statically (having no object).
See the manual for an example:
http://us.php.net/manual/en/language.oop5.basic.php

~ Greg

--
Greg Rundlett
Web Developer - Initiative in Innovative Computing
http://iic.harvard.edu
camb 617-384-5872
nbpt 978-225-8302
m. 978-764-4424
-skype/aim/irc/twitter freephile
http://profiles.aim.com/freephile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090612/2cb54178/attachment-0001.html>

------------------------------

Message: 6
Date: Fri, 12 Jun 2009 09:41:15 -0400
From: Paul A Houle <[email protected]>
To: NYPHP Talk <[email protected]>
Subject: Re: [nyphp-talk] Header()  Redirect!!
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

David Krings wrote:

So yes, there is a good possibility that the script using the redirect
never generates any output. BUT, some craft their applications using
only a few files that each are a huge switch statement with various
blocks of code. In those cases the first block can very well generate
output whereas the second block has the redirects. It is just that
when the second block gets called the first block is not executed. So
it doesn't matter what comes first within the script, but what
ultimately gets sent to the browser first.

    Formalize this and you've got the paradigm that is (mis)-named MVC.

    Most web apps should (i) process input,  (ii) think,  then (iii)
display something.  The thing that gets displayed is called a "view",
and one of the jobs of the "controller" is to display a different "view"
depending on what the application thought in stage (ii).  In a good
system,  the controller is able to surround a "view" with a "layout"
(visual shell:  all of the chrome that goes at the top of the page,  on
the side and on the bottom) or be able to do a redirect,  or suppress
the "layout" in case we want to send back,  say,  JSON or
comma-separated text as an output.

    I think the roles of the controllers and views are non-controversial
at this point,  but the role of the "model" is more controversial.  I
like to call this architecture CAV (Controller-Action-View) since it
reflects the organization of the code from the controller's viewpoint:
the controller decides which action code to run,  the action code
recalls data from the database,  changes data in the database or both,
and then the controller displays a view.

    Although frameworks like Rails,  Symfony and CakePHP have promoted
these ideas,  they may have also slowed the understanding of these
ideas.  (We think they're a property of a specific,  complex,  product
rather than a self-evident truth.)  A "micro-framework" that implements
a powerful and complete controller can be implemented about 50 lines of
PHP;  you don't even need to use objects.

    As David mentions,  you can also implement a "controller" by using
switch statements or conditionals:  there the "actions" and "views" are
chunks of code that are inside the switch blocks.  You can get the
functional benefits of the CAV architecture this way,  but the trouble
is that your actions and views are mixed in with the controllers in one
big file,  and often it gets hard to maintain.  In a mature CAV
architecture,  actions and views can be packed as individual source code
files,  or as individual functions,  classes,  or methods.

    "MVC" frameworks add all kinds of bells and whistles to this idea,
but this is the heart of how they work.


------------------------------

Message: 7
Date: Fri, 12 Jun 2009 09:41:50 -0400
From: "Michele Waldman" <[email protected]>
To: "'NYPHP Talk'" <[email protected]>
Subject: [nyphp-talk] SEO & Php
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

I know that web crawlers doen't execute javascript when indexing webpages.



Does the php get evaluated when indexing?  I'm thinking I does.



Michele



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090612/c7a5fdc5/attachment-0001.html>

------------------------------

Message: 8
Date: Fri, 12 Jun 2009 09:48:44 -0400
From: Michael Hernandez <[email protected]>
To: NYPHP Talk <[email protected]>
Subject: Re: [nyphp-talk] SEO & Php
Message-ID: <[email protected]>
Content-Type: text/plain; charset="windows-1252"; Format="flowed";
        DelSp="yes"


On Jun 12, 2009, at 9:41 AM, Michele Waldman wrote:

I know that web crawlers doen?t execute javascript when indexing
webpages.

Does the php get evaluated when indexing?  I?m thinking I does.

Michele


Your PHP code could definitely factor into SEO, take for example the
difference between

http://somedomain.com/1/1/2/useless/17/article.php?id=567

versus

http://somedomain.com/articles/meaningfulname/specificstuff/page/2

The URL that is used to access your content could make a major
difference. I'm not an SEO expert, but that is the difference between
"search engine friendly URL" and it's opposite.  CMS usually include a
"Search engine friendly" feature, you might want to consider making
your URLs friendly.

--Mike H

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090612/ad6636a7/attachment.html>

------------------------------

_______________________________________________
talk mailing list
[email protected]
http://lists.nyphp.org/mailman/listinfo/talk

End of talk Digest, Vol 32, Issue 16
************************************



_______________________________________________
New York PHP User Group Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

http://www.nyphp.org/show_participation.php

Reply via email to