By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 938 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Form and image submission query.

P: n/a
Hi Guru's,

I have a query regarding using PHP to maintain a user profiles list. I
want to be able to have a form where users can fill in their profile
info (Name, hobbies etc) and attach an image, which will upload the
record to a mySql db so users can then either view all profiles or
query.. I.e. show all males in UK, all femails over 35 etc.

Now, I'm not asking for How to do this but more what would be the best
way? I've looked at form PHP scripts, File upload PHP scripts, User
management PHP scripts, Database Scripts.. and on and on and on!
Nothing I've seen so far does exactly what I'm looking for and I don't
know exactly what I need to do to write (or attempt to write) one
myself.

Also, how best should I deal with validation? i.e. I'd like to have a
submission "holding bay" where I can check submissions before I add
them to the profiles list (To make sure there's no rude or obscene
entries). Can any of you give me any pointers, ideas or code snippets
that will aid me in my quest??

Thanking you in advance..

Pete
Jul 16 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on 30 Jun 2003 04:08:36 -0700,
pl*********@hotmail.com (Beowulf) amazingly managed to produce the
following with their Etch-A-Sketch:
Hi Guru's,

I have a query regarding using PHP to maintain a user profiles
list. I want to be able to have a form where users can fill in
their profile info (Name, hobbies etc) and attach an image, which
will upload the record to a mySql db so users can then either view
all profiles or query.. I.e. show all males in UK, all femails over
35 etc.

Sounds easy enough =)


Now, I'm not asking for How to do this but more what would be the
best way? I've looked at form PHP scripts, File upload PHP scripts,
User management PHP scripts, Database Scripts.. and on and on and
on!
Nothing I've seen so far does exactly what I'm looking for and I
don't know exactly what I need to do to write (or attempt to write)
one
myself.

I've just finished another script to do this (as of 2 days ago).. a
brief theory:
My authentication uses SESSIONs (see below). This has a 'userid'
integer and username stored which I use for accessing the database
entries etc. If the user edits their profile, it uses a standard form
with upload abilities to a defined directory outside of the webroot
(so people cant go just browsing through the images etc). To store
this image, I do some checking of the image file with
'getimagesize()' to determine image type, then check to see if that
filename with either '.png' or '.jpg' exists in the "gallery"
directory (only 2 filetypes I accept) and append that to the username
stored in the SESSION var. If a filename already exists, it attempts
to remove the file and then copies the new image there and then
attempts to UPDATE the users database entry according to their
UserID.

I also have a 'Delete Portrait' check box that if checked, will NULL
the portrait filename form the database and attempt to remove the
filename from the gallery directory too.


Also, how best should I deal with validation? i.e. I'd like to have
a submission "holding bay" where I can check submissions before I
add them to the profiles list (To make sure there's no rude or
obscene entries). Can any of you give me any pointers, ideas or
code snippets that will aid me in my quest??

I assume that the users have their own logins. With this information,
create a 'profile_pending' table. Upload the image and use 'uniqid()'
rather than the SESSION['username'] filename. Store this uniqid
filename in the profile_pending table with the username from the
SESSION var. You could then either access the profile_pending table
manually, or write a small page to list all entries in there with
links to the uniqid filename image for you to check. Have a link for
'Accept Image' which would then transfer / update details to the main
users table saying "yup, this image is ok to use" then DELETE the
entry from the profile_pending table so to keep that as empty as
possible.


Thanking you in advance..

Pete


HTH.

Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPwBJqGfqtj251CDhEQLRLQCgygNmCoUk6cs3CclzXDLomV yHxNQAoKFD
ADgOXIJFiGBUFkLPuEmb47JF
=ZIEP
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #2

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Mon, 30 Jun 2003 14:31:13 GMT, "Ian.H [dS]"
<ia*@WINDOZEdigiserv.net> amazingly managed to produce the following
with their Etch-A-Sketch:
then copies the new image there and then
attempts to UPDATE the users database entry according to their
UserID.

Oops, forgot to mention:

If you're displaying back to the user whether their profile has been
updated or not, you'll need to do a manual (true / false) check as to
whether the file has been uploaded ok. If you fail to do this, as the
uploaded filename is always the users username.extension, MySQL will
return a msg of "database not updated" as the actual data within
hasn't changed (just a new image has been uploaded). With the manual
checking, you can then still report according to this back to the
user whether the image has successfully been uploaded / changed or
not =)

Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPwBLfmfqtj251CDhEQJDWACgqp4dD5kPy7h6NpAhk7BUXr KceycAoI5J
wU2ZyjEdu0l3Sv95uHveUUYz
=IG6U
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #3

P: n/a
pl*********@hotmail.com (Beowulf) wrote in message news:<39**************************@posting.google. com>...
Hi Guru's,

I have a query regarding using PHP to maintain a user profiles list. I
want to be able to have a form where users can fill in their profile
info (Name, hobbies etc) and attach an image, which will upload the
record to a mySql db so users can then either view all profiles or
query.. I.e. show all males in UK, all femails over 35 etc.

Now, I'm not asking for How to do this but more what would be the best
way? I've looked at form PHP scripts, File upload PHP scripts, User
management PHP scripts, Database Scripts.. and on and on and on!
Nothing I've seen so far does exactly what I'm looking for and I don't
know exactly what I need to do to write (or attempt to write) one
myself.

Also, how best should I deal with validation? i.e. I'd like to have a
submission "holding bay" where I can check submissions before I add
them to the profiles list (To make sure there's no rude or obscene
entries). Can any of you give me any pointers, ideas or code snippets
that will aid me in my quest??

Thanking you in advance..

Pete

Anyone??
Jul 16 '05 #4

P: n/a
pl*********@hotmail.com (Beowulf) wrote in message news:<39**************************@posting.google. com>...> >
Also, how best should I deal with validation? i.e. I'd like to have a
submission "holding bay" where I can check submissions before I add
them to the profiles list (To make sure there's no rude or obscene
entries). Can any of you give me any pointers, ideas or code snippets
that will aid me in my quest??


You're asking for a content management system. You want a system that
brings together a lot of other features: files, users, user info, some
system admin checking, etc. What you're asking for is fairly big.

There are a lot of CMS's out there. Many of them are open source. A
few them are pretty good. www.php.net used to have list of all the
ones done in PHP. Maybe the list is still there. You could ask over at
evilwalrus.com, they'd tell you.

Some possible ideas:

You might be able to get PostNuke to do what you want. If not, try
Pmachine. If not that, you might be able to tweak Phorum to do what
you want, but that is more of a stretch. I'd also recommend my own
CMS, but only when version 2.0 comes out, and that is a month away:
www.publicDomainSoftware.org.
Jul 16 '05 #5

P: n/a
<Lawrence and Chris wrote in two very helpful messages>

"I'm not sure what kind of answer you're looking for exactly - and
that's probably why you haven't had any responses..."

Sorry about that.. I don't have enough knowledge to know what I want
and therefore I do not know what to ask for. I figured that I'd
probably have to do some editing to get what I require but I don't
know exactly what path to go down. I'm not looking for a step by step
guide to put the ring into Mount Doom.. just a vague "Turn left at
Lothlorien, then keep going until you smell smoke and sweaty orcs!"

I've looked at Form processing PHP's , File management PHP's , BLOG
PHP's and I'm lost. I thought there'd be something simple like a form
processing php that would allow a user to fill in details and attach a
file. Then any other behind the scenes stuff could be done with
seperate PHP's. But try as I must, I just can seem to find anything
close (That doesn't mean it's not there.. I'm just being blinkered by
ignorance at the moment!)

"As for your first question, if you're not looking for a how-to, what
are you looking for? What's the sticking point?

If you're asking "How do I learn how to do this", then I'd suggest
taking another look at all those premade scripts you've rejected. Find
the bits that do what you need. Learn exactly what they do and can do,
then combine them in your own way..."

yes.. I should follow that advice. It's not easy though learning yet
another programming/scripting language! Some times it feels like
running just to stand still!

Lawrence added..
"You're asking for a content management system. You want a system that
brings together a lot of other features: files, users, user info, some
system admin checking, etc. What you're asking for is fairly big."

Eek! And I thought it would be something simple.. I think I'm asking
for a Gold plated lear jet but only only want to pay for a paper dart!
As a software engineer myself (yeah, it's hard to believe isn't it!) I
often come accross users who want a system that does EVERYTHING! I've
just realised I've become one of those myself! (Sob). I think I'll
have to break it down into modules .. get a simple(?) form submission/
image upload PHP going first and add other bits on as and when
required.

Thanks for both your help. Sorry for being such a rank newbie!
Jul 16 '05 #6

P: n/a
pl*********@hotmail.com (Beowulf) wrote in message
Eek! And I thought it would be something simple.. I think I'm asking
for a Gold plated lear jet but only only want to pay for a paper dart!
As a software engineer myself (yeah, it's hard to believe isn't it!) I
often come accross users who want a system that does EVERYTHING! I've
just realised I've become one of those myself! (Sob). I think I'll
have to break it down into modules .. get a simple(?) form submission/
image upload PHP going first and add other bits on as and when
required.


I'm wasn't trying to scare you off, I was just pointing out that your
description involved many operations.

Can you write exactly what you want? I mean, in normal English
sentences. Just specify, in detail, the actions you'd like to be able
to do? If you could write a reasonably detailed spec list, I think I
could point you to one of the open source CMS's that might do what you
want.

From what little you've said, I'm guessing that PostNuke will do the
job for you. My own CMS, being smaller than PostNuke, is easier to
learn and, I think, easier to customize. You can see it running
www.monkeyclaus.org. That is the beta version of 2.0 - a little rough,
but coming along. The idea of that site is that every artist
associated with the monkeyclaus studio should have their own weblog.
Let me know if that interests you and I can give you a
username/password so that you can take a tour inside the control
panel.

A question: you're a programmer but you don't know PHP. Why bother
learning PHP? Why not use some language you already know? If you know
Perl, or Python, or Java, or ASP, you can find a CMS in any of those
languages. Why bother with PHP?

-- Lawrence Krubner
Jul 16 '05 #7

P: n/a
pl*********@hotmail.com (Beowulf) wrote in message
(1) a simple form submission script.. done those in my sleep
Simple or complex usually depends on how many different inputs you're
allowing, and how many different types. The most simple form would be
where you have a single textarea box and ask your users to type in
their name, details, address perhaps, personality description, etc. A
complex one would be that allows images, files, and info to be input,
each in its own field.

(2) an Image submission script.. Would be nice if it was linked to
above but I can make it seperate and call it from the form "thank you
for submitting" page
I agree this is simple.

(3) a Page Generation script, that will take a database of submissions
and make a list of profiles with attached images. Obviously I'll need
some sort of MySQL script between 2 and 3 to store the profiles and a
link to the correct image. If I could query on the profile records and
generate a page from that then that would be cool (i.e. all Males,
People in UK, People over 35 etc). Don't think a bog-standard page
content script should be TOO hard to code.
My overall impression is that you're underestimating the work or
you've more free time than I do. How is what you're describing
different from what any professional web-coder does? Each of us is
working on some script that in some way generates bog-standard web
pages. Look at www.alexmarshall.org, for instance. A standard web
page, but there is a lot going on behind the scenes to make it all
work: scripts to upload files, scripts to upload images, scripts to
keep track of all the links on the site, scripts to determine what
should appear on a page, scripts to list the most recent articles,
scripts to list the most popular articles. And that's just a single
user site. More complicated is www.monkeyclaus.org, with 20 users,
each with their own set of permissions. It started out as a simple 40k
script and now its 500k. That is what happens with software: over
time, it grows.

I think starting a cms is a little like starting a rock band: one does
it partly for reasons of personal expression. There are a million cms
out there, many open source, you could easily pick one off the shelf,
for much less time and effort than making your own. But doing your own
gives you the chance to do everything exactly your way.

I think you'll find that writing what you want, even very simply, is
going to take 4 to 6 days of full time coding. Do it if you really
want to do everything your own way. That was my own motivation. But if
you're short on time, use PostNuke, you'll be up and running inside of
3 hours.

Looked at Post-Nuke.. Overwhelmed! probably does a lot more than I
need!


Is that a bad thing?
Jul 16 '05 #8

P: n/a
pl*********@hotmail.com (Beowulf) wrote in message news:<39**************************@posting.google. com>...
lk******@geocities.com (lawrence) wrote in message news:<da**************************@posting.google. com>...
My overall impression is that you're underestimating the work or
you've more free time than I do. >

Sorry , My Quote "Don't think a bog-standard page content script
should be TOO hard to code." Wasn't meant to refer to the WHOLE
project just the small part that generates the actual page. I thought
if I have a list of profile records then basically itterating through
the list in a while not end of list construct and outputting a small
HTML template for each table cell wouldn't have been to complicated.

By Easy I meant going by my limited grasp of PHP I thought it would be
easy COMPARED to the other tasks. What I meant was EASIER. not EASY. I
have a mammoth task ahead of me, compounded by the fact I'm learning
PHP as I go. Not au fait with web technologies. But your advice has
been very usefull and I thank you for giving up some time to help an
obviously un-knowledgable newbie like me find the path! Tell me, Where
you Yoda in a previous life? ;-) Thanks! Will look at Post-Nuke as you
recommend too.


Good luck with PostNuke. If it doesn't do what you want, we'll be
posting a reasonably stable beta of version 2.0 of the monkeyclaus cms
this weekend, and it'll do most of what you want, and if you want to
customize it I'll help you out. On Sunday you can check out
http://www.publicDomainSoftware.org/
Jul 16 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.