Form and image submission query.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Beowulf

    #1

    Form and image submission query.

    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
  • Ian.H [dS]

    #2
    Re: Form and image submission query.

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Whilst lounging around on 30 Jun 2003 04:08:36 -0700,
    plittle1970@hot mail.com (Beowulf) amazingly managed to produce the
    following with their Etch-A-Sketch:
    [color=blue]
    > 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.[/color]


    Sounds easy enough =)

    [color=blue]
    >
    > 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.[/color]


    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.

    [color=blue]
    >
    > 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??[/color]


    I assume that the users have their own logins. With this information,
    create a 'profile_pendin g' 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.

    [color=blue]
    >
    > Thanking you in advance..
    >
    > Pete[/color]



    HTH.



    Regards,

    Ian

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

    iQA/AwUBPwBJqGfqtj2 51CDhEQLRLQCgyg NmCoUk6cs3CclzX DLomVyHxNQAoKFD
    ADgOXIJFiGBUFkL PuEmb47JF
    =ZIEP
    -----END PGP SIGNATURE-----

    --
    Ian.H [Design & Development]
    digiServ Network - Web solutions
    www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
    Programming, Web design, development & hosting.

    Comment

    • Ian.H [dS]

      #3
      Re: Form and image submission query.

      -----BEGIN PGP SIGNED MESSAGE-----
      Hash: SHA1

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


      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.extens ion, 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/AwUBPwBLfmfqtj2 51CDhEQJDWACgqp 4dD5kPy7h6NpAhk 7BUXrKceycAoI5J
      wU2ZyjEdu0l3Sv9 5uHveUUYz
      =IG6U
      -----END PGP SIGNATURE-----

      --
      Ian.H [Design & Development]
      digiServ Network - Web solutions
      www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
      Programming, Web design, development & hosting.

      Comment

      • Beowulf

        #4
        Re: Form and image submission query.

        plittle1970@hot mail.com (Beowulf) wrote in message news:<396f98be. 0306300308.1942 5c36@posting.go ogle.com>...[color=blue]
        > 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[/color]


        Anyone??

        Comment

        • lawrence

          #5
          Re: Form and image submission query.

          plittle1970@hot mail.com (Beowulf) wrote in message news:<396f98be. 0307030048.48e5 34ee@posting.go ogle.com>...> >[color=blue][color=green]
          > > 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??[/color][/color]

          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.

          Comment

          • Beowulf

            #6
            Re: Form and image submission query.

            <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!

            Comment

            • lawrence

              #7
              Re: Form and image submission query.

              plittle1970@hot mail.com (Beowulf) wrote in message[color=blue]
              > 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.[/color]

              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

              Comment

              • lawrence

                #8
                Re: Form and image submission query.

                plittle1970@hot mail.com (Beowulf) wrote in message[color=blue]
                > (1) a simple form submission script.. done those in my sleep[/color]

                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.



                [color=blue]
                > (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[/color]

                I agree this is simple.





                [color=blue]
                > (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.[/color]

                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.





                [color=blue]
                > Looked at Post-Nuke.. Overwhelmed! probably does a lot more than I
                > need![/color]

                Is that a bad thing?

                Comment

                • lawrence

                  #9
                  Re: Form and image submission query.

                  plittle1970@hot mail.com (Beowulf) wrote in message news:<396f98be. 0307100332.3708 e5e8@posting.go ogle.com>...[color=blue]
                  > lkrubner@geocit ies.com (lawrence) wrote in message news:<da7e68e8. 0307070840.2a9d 9c5b@posting.go ogle.com>...
                  >[color=green]
                  > > My overall impression is that you're underestimating the work or
                  > > you've more free time than I do. >
                  > >[/color]
                  > 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.[/color]

                  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
                  168体彩幸运飞行艇记录历史全国数据+飞行艇168结果历史记录查询-综合版正规精准计划、飞艇全场实时直播、168官方记录最新现场号码.

                  Comment

                  Working...