Jump to content

phpretard

Members
  • Posts

    821
  • Joined

  • Last visited

    Never

Posts posted by phpretard

  1. I use this structure all the time

     

    <head>
    </head>
    
    <body>
    <div id="main">
    <div id="site_content">
    <?
    
    include 'header.php'; 
    include 'navigation.php'; 
    include "pages/$page.php";  // DIFFERENT PAGES
    include 'footer.php'; 
    
    ?> 
    </div>
    '</div>
    </body>
    </html>
    
    // HERE IS THE NAVIGATION PAGE
    echo"
    <ul id='menu'>
            <li><a href='?page=home'>Home</a></li>
            <li><a href='?page=schedule'>Schedule</a></li>
            <li><a href='?page=pricing'>Pricing</a></li>
            <li><a href='?page=about'>About Us</a></li>
            <li><a href='?page=gallery&loc=gallery'>Gallery</a></li>
            <li><a href='?page=contact'>Contact Us</a></li>
    </ul>";
    
    
    

  2. How do I unset just one part of the array?

     

    unset($_SESSION[$file]['P1040050.jpg']); <--doesn't work

     

    $_SESSION:Array
    (
        [P1040050.jpg] => Array
            (
                [picture] => ALBUMS/Holmes_Adams/P1040050.jpg
                [file] => P1040050.jpg
                [s46] => 4 x 6
                [QU46] => 10
                [s57] => 5 x 7
                [QU57] => 20
                [s810] => 8 x 10
                [QU810] => 30
                [order_photo] => Order This Photo
            )
    
        [P1040052.jpg] => Array
            (
                [picture] => ALBUMS/Holmes_Adams/P1040052.jpg
                [file] => P1040052.jpg
                [s46] => 4 x 6
                [QU46] => 30
                [s57] => 5 x 7
                [QU57] => 20
                [s810] => 8 x 10
                [QU810] => 10
                [order_photo] => Order This Photo
            )
    )

  3. Make a new file and put this code and only this code in it...

     

    Be sure --include '../tracking/db_connx.php';-- is still correct

     

     

    <?php
    session_start();
    
    $errorMessage = '';
    
    if (isset($_POST['Submit'])) {
       
       $username=$_POST['username'];
       $passwd=$_POST['passwd'];
       
       include '../tracking/db_connx.php';
    
       $sql = "SELECT * FROM webusers WHERE username = '$username' AND passwd = '$passwd'" 
       
       or die("error 1");
    
       $result = mysql_query($sql)
                 or die('Query failed. ' . mysql_error());
    
       $count=mysql_num_rows($result);
    
         if($count==1){
    
         echo"Loged In";
    
          
          /* UNCOMMENT THIS LATER
          
          $_SESSION['db_is_logged_in'] == true; 
    
          header('Location:../indexin.php');
          exit;
          
          */
       } else {
       
          $echo = 'Sorry, wrong user id / password';
       }
    
    }
    ?>
    <p>
    <form id="login" name="login" method="POST" action="">
    <input type="text" id="username" name="username" value="User Name" />
    <input type="password" id="passwd" name="passwd" value="Password"/>
    <input type="submit" id="submit" name=Submit value="Log In"/>
    </form>      
    </p>

     

     

     

  4. I gave your submit button a name and used it for the isset

     

    <?php
    session_start();
    
    $errorMessage = '';
    if (isset($_POST['Submit'])) {
       
       $username=$_POST['username'];
       $passwd=$_POST['passwd'];
       
       include '../tracking/db_connx.php';
    
       $sql = "SELECT * FROM webusers WHERE username = '$username' AND passwd = '$passwd'" 
       
       or die("error 1");
    
       $result = mysql_query($sql)
                 or die('Query failed. ' . mysql_error());
    
       if (mysql_num_rows($result) == 1) {
    
         echo"Loged In";
    
          
          /* UNCOMMENT THIS LATER
          
          $_SESSION['db_is_logged_in'] == true; 
    
          header('Location:../indexin.php');
          exit;
          
          */
       } else {
       
          $echo = 'Sorry, wrong user id / password';
       }
    
    }
    ?>
    <p>
    <form id="login" name="login" method="POST" action="">
    <input type="text" id="username" name="username" value="User Name" />
    <input type="password" id="passwd" name="passwd" value="Password"/>
    <input type="submit" id="submit" name=Submit value="Log In"/>
    </form>      
    </p>

  5. I can see where the problem lies but cant find the answer.

     

    Can anyone tell me why I can't see the pictures?

     

    
    echo '<pre>$_SESSION:' . print_r($_SESSION,true) . '</pre>';
    
    The Above Yeilds This In The Browser:
    
    $_SESSION:Array
    (
        [P1040050.jpg] => Array
            (
                [picture] => ALBUMS/Holmes_Adams/P1040050.jpg  //<----PICTURE 1 LOCATION
                [file] => P1040050.jpg
                [s46] => 4 x 6
                [QU46] => 10
                [s57] => 5 x 7
                [QU57] => 20
                [s810] => 8 x 10
                [QU810] => 30
                [order_photo] => Order This Photo
            )
    
        [P1040052.jpg] => Array
            (
                [picture] => ALBUMS/Holmes_Adams/P1040052.jpg  //<------PICTURE 2 LOCATION
                [file] => P1040052.jpg
                [s46] => 4 x 6
                [QU46] => 30
                [s57] => 5 x 7
                [QU57] => 20
                [s810] => 8 x 10
                [QU810] => 10
                [order_photo] => Order This Photo
            )
    
    )
    
    
    
    foreach ($_SESSION as $file => $val){
    
    echo"<img src='" . $_SESSION['picture_id']['picture'] . "'>";
    
    }
    

     

    I was expecting 2 pictures to show up based on the session variables...all I get is an unidentified picture.

     

    I have been reading about this and can't pick up the answer anywhere.

×
×
  • 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.