bs0d |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 3:53 am on Apr 05 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
Edited at 04:01:24 am on 04/05/10
|
Viewed: 29,836 Times | |  |
teachpower |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 12:40 pm on Apr 05 2010
|
|
|
Member #: 1228 Rank: user - (12) Since: 04/05/10 Posts: 12 From: FL
|
bsod...
First of all I
did forget to
mention the
fact I am also
following the
"Site
Design Made
Simple"
tutorial. I can
have a cleaner
more manageable
site and I am
also guessing a
better site to
navigate for
the user. This
site has some
great tutorials
and community
.
Yes I do
understand your
code piece. My
question is can
I restrict
non-members
from viewing
certain parts
of the page
while still
showing the
rest of the
page? FOR
EXAMPLE: On the
page
http://www.t
eachpower.net/L
essons/science_
lessons.htm
non-members
will be
restricted from
viewing member
feature buttons
like
"Upload&
quot;,
"Profile
", etc.?
I just thought
of this right
now. Would I
attach a
<?
if($_SESSION['
username'] !=
"Guest&q
uot;
die("Memb
ers
Only";
?>
to each member
only feature
button so that
if a member
clicks on the
button it
executes that
feature (i.e.
uploading
content), while
a non-member
would be
checked as
"Guest&q
uot; and be
thrown to the
login/registrat
ion page?
Edited at 01:36:24 pm on 04/05/10
-TeachPower
TeachPower.net
founder
Education
Resource
Library for the
classroom &
boardroom |
Viewed: 29,824 Times | |  |
bs0d |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 2:10 pm on Apr 05 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
Yes, I think
you're getting
the idea. If
you want
buttons to
appear for
members only,
then only
display them
within an IF
condition.
<?
if($_SESSION['
username'] !=
"Guest&q
uot
echo("mem
bers ony
link" ;
?>
*note - you
wouldn't use
die(); because
that will
terminate
execution of
the page,
unless of
course that's
what you want
to do.
This way you
can display the
page, but
you're now
just specifying
some areas or
links that will
appear for
members, but
not for
guests.
There are
multiple ways
to authenticate
users, like
cookies for
instance if you
didn't want to
use session
variables. You
might read up
on that at some
point, but this
should be
enough to get
you started.
|
Viewed: 29,817 Times | |  |
TeachPower |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 2:11 am on Apr 19 2010
|
|
|
Member #: 1228 Rank: user - (12) Since: 04/05/10 Posts: 12 From: FL
|
bsod... OK I
read through
the membership
tutorial
several times
and I am
understanding
what the code
is doing. Now
where do I put
those code
pieces? Do I
put them all in
the
<head>
part of the
webpage?
-TeachPower
TeachPower.net
founder
Education
Resource
Library for the
classroom &
boardroom |
Viewed: 29,750 Times | |  |
bs0d |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 3:09 am on Apr 19 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
Put the code at
the beginning
of the
page_header
file, even
before
<html>.
|
Viewed: 29,743 Times | |  |
teachpower |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 9:59 pm on Apr 26 2010
|
|
|
Member #: 1228 Rank: user - (12) Since: 04/05/10 Posts: 12 From: FL
|
OK I am stuck
now. I created
a membership
table with the
fields I want
and the correct
values in
phpMyAdmin
using XAMPP
Now what?
Where is this
table saved in
XAMPP? Is the
database a file
that I need to
put somewhere
in my website
structure or do
I just put the
SQL table code
to create the
table the same
place I put the
other
membership code
pieces?
-TeachPower
TeachPower.net
founder
Education
Resource
Library for the
classroom &
boardroom |
Viewed: 29,689 Times | |  |
bs0d |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 3:29 am on Apr 27 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
You will create
the database
probably in
your hosting
control panel
if you use a
3rd party for a
host. Or are
you hosting
yourself?
You will use
phpMyAdmin to
connect to the
database and be
able to create
tables and so
on.
The pages you
build will
allow users to
fill out a form
to register,
and the script
behind the
scenes will
connect to the
database and
insert the
appropriate
data in the
specified
table.
|
Viewed: 29,681 Times | |  |
teachpower |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 3:49 am on Apr 29 2010
|
|
|
Member #: 1228 Rank: user - (12) Since: 04/05/10 Posts: 12 From: FL
|
So the SQL
database I made
in XAMPP with
localhost was
just for
that...
localhost? I
have to connect
to the host
(godaddy.com)
with myphpAdmin
and once I am
connected
create the
database? The
database will
be its own file
in my website
structure on
the host
server? How do
I found out how
to connect to
my host through
phpmyAdmin? I
am sorry but in
this area you
can call me a
semi-noob.
-TeachPower
-TeachPower
TeachPower.net
founder
Education
Resource
Library for the
classroom &
boardroom |
Viewed: 29,650 Times | |  |
bs0d |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 5:18 pm on Apr 29 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
Login to your
hosting control
panel @
GoDaddy. There
should be an
option to
create a
database, pick
a name for it,
and setup user
accounts with
passwords to
access it. Once
you have that,
you can use
phpMyAdmin to
create the
tables. Then
when you're
creating
scripts to
interact with
the database
(read, write,
delete,
modify), then
you need to
connect to the
database first.
You can do that
with this
code
. After that
point, your
queries should
work.
|
Viewed: 29,640 Times | |  |
teachpower |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 1:48 am on Apr 30 2010
|
|
|
Member #: 1228 Rank: user - (12) Since: 04/05/10 Posts: 12 From: FL
|
OK I figured
out how to and
created a
database
through
godaddy. The
database is
created and I
also figured
out the
variables of
dbuser, dname,
etc. which I
was very
confused of
what those were
when I
originally was
reading your
membership
tutorial. My
questions now
is, if I put
that in the
webpage code
where you told
me to put it,
can't anybody
that views my
webpage source
online see the
username and
pass I use to
connect to the
database and
use it to login
as me? How can
I hide that
info in the
database
connect
code?
-TeachPower
-TeachPower
TeachPower.net
founder
Education
Resource
Library for the
classroom &
boardroom |
Viewed: 29,633 Times | |  |
bs0d |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 2:56 am on Apr 30 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
All of your
webpages should
now carry the
.php extension.
This tells the
server that the
file contains
server side
code. All PHP
code is
executed on the
server and the
result is
displayed back
to the clients
browser.
Therefore, the
client can
never see the
PHP code. The
database
connection is
PHP code. As
the article
indicates, you
should have
this as a
separate file
(like:
db_connect.php)
and include the
file like
this:
require_once($_
SERVER['DOCUME
NT_ROOT'].'/d
b_connect.php'
);
|
Viewed: 29,628 Times | |  |
teachpower |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 3:06 pm on Apr 30 2010
|
|
|
Member #: 1228 Rank: user - (12) Since: 04/05/10 Posts: 12 From: FL
|
Edited at 03:48:27 pm on 04/30/10
-TeachPower
TeachPower.net
founder
Education
Resource
Library for the
classroom &
boardroom |
Viewed: 29,620 Times | |  |
bs0d |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 12:31 am on May 01 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
I don't see
why you
couldn't. If
you're looking
for a script to
allow users to
upload files,
we have an
article on Uploading
Image Files
with
PHP.
You could use
this script as
a baseline and
just use
different
extensions.
Once you're up
and running,
you'll just
have to test
your scripts
time and time
again. Many
programmers say
they spend more
time coding for
potential
errors than the
true intent of
the script.
This is because
anything can
trip up your
scripts. Define
your parameters
and box
everything
basically so
you know what
you're going
to be storing
in the
database. Also
it seems no
matter what,
some issues
develop that
you may not
have thought
of.
|
Viewed: 29,611 Times | |  |
teachpower |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 9:51 pm on May 28 2010
|
|
|
Member #: 1228 Rank: user - (12) Since: 04/05/10 Posts: 12 From: FL
|
bsod... been
having a hard
time setting up
the database
and fields.
When I tried to
create a table
within a
table... or
better said a
nested table...
I am at a loss.
I was reading
online that
nested tables
are not able to
be created in
mySQL? Is that
true? If not
then how can I
make it so that
when a member
uploads files a
table is
created
specific to
him/her that
contains all
the data in
appropriate
fields?
-TeachPower
TeachPower.net
founder
Education
Resource
Library for the
classroom &
boardroom |
Viewed: 29,355 Times | |  |
bs0d |
Subject: "re: Linking
Upload Code
With Member..."
Posted: @ 2:51 pm on May 29 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
You could just
create a field
that says image
name. When the
member uploads
the file, store
the image name
in the members
table. Store
all user images
in the same
folder. Then
you can display
the members
image along
with the other
data very
easily.
|
Viewed: 29,335 Times | |  |
Viewing Page: 1 of 1 |