WEB Need some php help...

Discussion in 'OT Technology' started by MSupply, Apr 29, 2008.

  1. MSupply

    MSupply New Member

    Joined:
    Aug 16, 2004
    Messages:
    488
    Likes Received:
    0
    I need some help with using my current php script setup. I basically need to restrict certain pages on my site until form data has been sent to them. The site needs to go in sequence from one page to the next. Ive briefly read into sessions variables but havent quite figured out how to go about using them. I think i can set a session ID on one page and then check for that ID on the next, but i am not sure.
     
  2. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    i posted a very similar thread awhile back
     
  3. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    let me find it for you
     
  4. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
  5. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    Wirelessly posted via wap.offtopic.com (lolphone: Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3)

    Yeah. That will do it. Set a session VAR when data has been posted and then verify if the session VAR exists on the page you are restricting.
     
    Last edited: Apr 29, 2008
  6. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    oh shit i should of read your post :duh:

    I linked you to something totally different :rofl:
     
  7. MSupply

    MSupply New Member

    Joined:
    Aug 16, 2004
    Messages:
    488
    Likes Received:
    0
    Ok im starting to get the concept at least, but I am a complete php noob really. I had a friend help me with the current php parts of my site, but he has been gone for awhile and I can't figure this out. This is a project i have been working on for an entrepreneurship class. Check this out for now.

    There are two php scripts, order.php and confirm.php
    I need to restrict confirm.php because it sends me a php form mail.

    www.maintenancesupplyinc.com

    basically, some folks like to load up order.php and send it to me blank, but i need some way to redirect their ass if they send it empty.

    It seems to me like I could somehow redirect them based on the total order dollar amount. Like if their total order amount = 0, then i redirect them to the starting page. I am not sure how to do this though.

    I know the commands to set a session variable, but what variable do i use and how do i check to see if it exists? Sorry I am such a noob, but I have only been doing html coding and the various related tasks for a few months now, it has been a lot to process so quickly
     
  8. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    You don't need session variables to do that. You simply just check the input of the variables that are being posted. If you want to do it by total order amount, you can accomplish something like this:

    Code:
    <?php
      if (isset($_POST['name_of_form_control']) && $_POST['name_of_form_control'] == 0)) {
        header("Location: order.php");
      }
    ?>
    
    Personally, I would have all the data on the page post to itself and write some type of error handling to force users to input all the data.
     
  9. Logik

    Logik Livin la vida broka

    Joined:
    Jun 30, 2000
    Messages:
    20,667
    Likes Received:
    1
    Location:
    The Steel City
    ask our privacy expert on his up-and-coming Fortune 500 Privacy Consulting Website
     
  10. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    :bowrofl:
     
  11. MSupply

    MSupply New Member

    Joined:
    Aug 16, 2004
    Messages:
    488
    Likes Received:
    0
    I suppose this is an inside joke eh?

    I think i will just find out how to redirect the user if their dollar total is equal to zero. Back to google i go...
     
  12. MSupply

    MSupply New Member

    Joined:
    Aug 16, 2004
    Messages:
    488
    Likes Received:
    0
    Damn, I took a week off and I still can't seem to get this thing to work. It either redirects no matter what or doesnt do anything at all. Bleh!
     
  13. MSupply

    MSupply New Member

    Joined:
    Aug 16, 2004
    Messages:
    488
    Likes Received:
    0
    Ok, so i think ill use the sessions this time. I have found all of the code instructions and a few examples, but nothing that is specific to what i want. I know i need to set a variable and check for the variable, but...

    Where do i set the first variable and how?
    What variable do i use?
    How do i check for it?

    Go through the link in my other post to see how my site works. I just dont want people to be able to send an empty order to me from order.php
     
  14. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,923
    Likes Received:
    11
    Location:
    Los Angeles
    I just told you how to do it...
     
  15. MSupply

    MSupply New Member

    Joined:
    Aug 16, 2004
    Messages:
    488
    Likes Received:
    0
    Yeah i saw that, ive tried to use your statement but like i said, it either redirects no matter what or doesnt do anything. Keep in mind im pretty mucha php noob :)
     
  16. noon

    noon get high and teach me how to listen

    Joined:
    May 4, 2002
    Messages:
    3,384
    Likes Received:
    0
    Location:
    Lawrence, KS
    Wirelessly posted via wap.offtopic.com (BB 8830: BlackBerry8830/4.2.2 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/104)

    Msg me on aim: n00n

    I'll do it for you, easy
     

Share This Page