Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Posts posted by aebstract

  1. <?php
    if(isset($_SESSION["id"]))
    {
      header("Location: /accounthome/");
      exit();
    }
    
    //Doesn't this happen in the include('connect.php') in index.php?
    mysql_connect("localhost","berryequipment","gU8Kso8Y") or die(mysql_error());
    mysql_select_db("berryequipment_net_db");
    
    if(isset($_POST['submit']))
    {
      if(empty($_POST['password']))
      {
        $error .= 'You must fill in a password <br />';
      }
      if(!strlen($error))
      {
        $result = mysql_query("SELECT * FROM `plants` WHERE `id` = '".mysql_real_escape_string($_POST['dropdown'])."' AND `password` = '".md5($_POST['password'])."'")
          or die("Query error: ".mysql_error());
        if(mysql_num_rows($result) == 0)
        {
          $error .= "The pasword you entered did not match the plant location you chose.";
        }
        else
        {
          $worked = mysql_fetch_array($result);
          $_SESSION["id"] = $worked['id'];
    
          header("Location: /accounthome/");
          exit;
        }
      }
    }
    
    $content .= '<center><table><tr><td><form action="/login/" method="post">Location: </td><td><select name="dropdown">';
    $result = mysql_query("SELECT * FROM `plants` ORDER BY `plantloc` ASC") or DIE(mysql_error());
    while($r = mysql_fetch_array($result))
    {
      $id = $r['id'];
      $plantloc = $r['plantloc'];
      $content .= "<option value=\"{$id}\">{$plantloc}</option>\n";
    }
    $content .= '</select></td></tr><tr><td>
    Password:
    </td><td>
    <input type="password" name="password" size="6" />
    </td></tr><tr><td></td><td>
    <input type="submit" name="submit" value="login" />
    </td></tr></table></center></form>';
    ?>

     

    This is my login script, and now that I am adding a new table in this format:

     

    unique_id | plant | email | password

     

    plant = the unique id for each plant in the "plants" table.

     

    What do I need to do to get my login setup so that this all runs smoothly like it was before the addition of the table. Just some guidance is all I am looking for, thanks.

  2. I have a members area on a website, the login is by a dropdown which pulls all the users from the database. I need a way to have it so that I can have to different passwords for the same user. Also, there is a shopping cart on the site, I need to be able to have a way to tell which user was logged in when they completed checkout. So basically, 2 passwords for same account, both work and do the same thing but gotta track as being two different people.

  3. Are you running a while loop to display your results? My best guess is that if you aren't, then you are just returning the last row of information from the results. Anyone can correct me if I am wrong. Maybe you could post some more of the code?

  4. It won't be that hard to do this with php/mysql though if you wanted it to run smoothly without having to load on every image you click, you'd have to use some javascript. Why are you using tables for anything that isn't tabular data?

  5. Okay, I have quite a few sessions that I want to completely clear upon leaving a specific page. Be it they close the window or click to go to another page. When they leave that page in any way, I want the sessions to be cleared. There is one session I want to keep running, but I'm sure if I have to I could just clear all sessions and reset that one at the same time. How can I go about doing the "upon leaving page" with this?

  6. I don't think I really need a new topic for this, so I'll continue under my already on-going topic.

    Right now I am using this:

     

    RewriteEngine On
    
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([[:alnum:]_]+)/$ /index.php?page=$1 [NC,L]
    RewriteRule ^([[:alnum:]_]+)/([[:alnum:]]+)/$ /index.php?page=$1&var1=$2 [NC,L]
    

     

    Which seems to be working for about everything. Here is the problem I have run in to and can't find a workaround for: Before I switched over to using this, I would have a url like index.php?page=blabla#line60 Which would take you to the "line60" spot on the page, wherever I set that within the page. I can I do something like this, with the clean urls?

  7. Here is my problem I am now facing:

    http://berryequipment.net/order/PH/

    should be something similar to:

    http://berryequipment.net/index.php?page=order&sheet=PH

     

    The variable NAME isn't that important, its set to var1 in the code and I can change the script so it matches up with var1 instead of sheet, but why am I getting a 404 error on http://berryequipment.net/order/PH/ but I don't get one with http://berryequipment.net/order/ ?

     

     

     

     

    EDIT: Changed the 0-9 to A-Z and it is now working. ;)

  8. Personally, I would have photos being in their own table, each photo having its own row and having reference back to a unique id for whatever user that photo belongs to. From there you can pull all the photos from the table depending on what id you're referring to. Make sense?

  9. The form has to run through a script, checking if everything is there, etc etc. If the order they place is valid, then they are allowed to see the confirmation page. Wouldn't this last bit just throw up the print page immediately? Or am I still confused?

  10. I have a confirmation page, which displays all of the information from the users order via $_POST variables. I want it so that the user can click a "printable version" link and it popup in a blank white page with all the information so that they can print it out. Is there any way to get this information to the popup page (from checkout.php to confirmation.php) without setting a session, or is setting a session going to be the only route?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.