Connecting Tech Pros Worldwide Forums | Help | Site Map

PHP tutorial for building user-login sites

Bennett Haselton
Guest
 
Posts: n/a
#1: Jul 17 '05
I'm looking for a PHP tutorial that specializes in how to build sites
that are based around user logins. i.e. the user logs in on the front
page, and are taken to a main login page where fields on the page are
populated with values from some server-side database. Ideally, there
would be a server-side "user" database table, with fields such as
"age", so that you could insert a short tag in the PHP source like:

Your age is: <?php [something goes here] ?>

and the "age" value from the user table would be interpolated, such
that the "[something goes here]" in the example above would be
something short like "user.age", and not something clunky like an
entire SQL query statement. (Preferably the database lookup of the
user's record would be done just once per page load, or even once per
user login, so that it wouldn't require a separate database query to
populate every value on the page.) Also, ideally, a way to do queries
against other tables in the server-side database, so you could have
something in the page source like:

Your ordered items are: <?php [whatever goes here] ?>

which would query against another MySQL table like "orders" for orders
whose user_id field matched the "ID" field of the user in your "user"
table, and display the results in a table format according to some
specified template. Again, it would be elegant if the stuff in
"[whatever goes here]" could be brief (the bare minimum you'd need to
specify would be the "orders" table and the name of the template that
controls the formatting of the results), instead of having to be an
entire SQL query.

Can PHP do this? The first few sites that I found when searching for
"PHP tutorial":

http://www.php.net/tut.php
http://hotwired.lycos.com/webmonkey/...tutorial4.html
http://www.gimpster.com/wiki/PhpTutorial

didn't talk much about building a user-login site like the one I'm
describing. Is there a tutorial which specializes in how to build
that kind of site with PHP?

-Bennett

Guest
 
Posts: n/a
#2: Jul 17 '05

re: PHP tutorial for building user-login sites



"Bennett Haselton" <bennett@peacefire.org> wrote in message
news:e614455c.0312131520.6e146ec3@posting.google.c om...[color=blue]
> I'm looking for a PHP tutorial that specializes in how to build sites
> that are based around user logins. i.e. the user logs in on the front
> page, and are taken to a main login page where fields on the page are
> populated with values from some server-side database. Ideally, there
> would be a server-side "user" database table, with fields such as
> "age", so that you could insert a short tag in the PHP source like:
>
> Your age is: <?php [something goes here] ?>
>
> and the "age" value from the user table would be interpolated, such
> that the "[something goes here]" in the example above would be
> something short like "user.age", and not something clunky like an
> entire SQL query statement. (Preferably the database lookup of the
> user's record would be done just once per page load, or even once per
> user login, so that it wouldn't require a separate database query to
> populate every value on the page.) Also, ideally, a way to do queries
> against other tables in the server-side database, so you could have
> something in the page source like:
>
> Your ordered items are: <?php [whatever goes here] ?>
>
> which would query against another MySQL table like "orders" for orders
> whose user_id field matched the "ID" field of the user in your "user"
> table, and display the results in a table format according to some
> specified template. Again, it would be elegant if the stuff in
> "[whatever goes here]" could be brief (the bare minimum you'd need to
> specify would be the "orders" table and the name of the template that
> controls the formatting of the results), instead of having to be an
> entire SQL query.
>
> Can PHP do this? The first few sites that I found when searching for
> "PHP tutorial":
>
> http://www.php.net/tut.php
>[/color]
http://hotwired.lycos.com/webmonkey/...tutorial4.html[color=blue]
> http://www.gimpster.com/wiki/PhpTutorial
>
> didn't talk much about building a user-login site like the one I'm
> describing. Is there a tutorial which specializes in how to build
> that kind of site with PHP?
>
> -Bennett[/color]

Your description sounds unnecessarily difficult. I must be missing
something.
What is wrong with having the person log in - and then storing session
variable $userID as $resultSet["userId"] ?
userId is of course your unique field from your table -
USERS(USERID,USERNAME,PASSWORD).
You are then free to use this id wherever you want, with any sql syntax you
want - simple or complicated.




R. Rajesh Jeba Anbiah
Guest
 
Posts: n/a
#3: Jul 17 '05

re: PHP tutorial for building user-login sites


bennett@peacefire.org (Bennett Haselton) wrote in message news:<e614455c.0312131520.6e146ec3@posting.google. com>...[color=blue]
> I'm looking for a PHP tutorial that specializes in how to build sites
> that are based around user logins.[/color]

<snip>
[color=blue]
> Can PHP do this? The first few sites that I found when searching for
> "PHP tutorial":
>
> http://www.php.net/tut.php
> http://hotwired.lycos.com/webmonkey/...tutorial4.html
> http://www.gimpster.com/wiki/PhpTutorial
>
> didn't talk much about building a user-login site like the one I'm
> describing. Is there a tutorial which specializes in how to build
> that kind of site with PHP?[/color]

1. http://www.google.com/search?&q=php+login+script
2. http://martin.f2o.org/php/login

--
"Silence is the only right answer for many wrong questions" --
G.K.Moopanar, Politician
Email: rrjanbiah-at-Y!com
Closed Thread