예제 #1
0
    $cred_results = $db->query($cred_command);
    $cred_data = $cred_results->fetch_object();
    // If username exists, and password exists, and they match a record in the dB, log in the user.
    if (isset($cred_data->username) && $cred_data->username == $username) {
        if ($cred_data->password == $pw) {
            if (isset($cred_data->admin)) {
                $_SESSION['admin'] = 1;
            }
            $_SESSION['sign_in'] = 1;
            $_SESSION['username'] = $username;
            $url = "http://" . $_SERVER['HTTP_HOST'] . "/cart02/cart.php";
            ob_clean();
            header("Location: " . $url) or die("didn't redirect from login");
        } elseif ($cred_data->username == $username && $cred_data->password != $pw) {
            if ($pass_error == 1) {
                echo '<span class="form_error">The password you entered is not correct</span>';
            }
        }
    }
}
// These if statements call the account update or product update functions when the user has
// submitted the form.
if (isset($_GET['accts']) && $_GET['accts'] == 1) {
    acct_update($_POST);
}
if (isset($_GET['products']) && $_GET['products'] == 1) {
    product_update($_POST);
}
if (isset($_GET['add_prod']) && $_GET['add_prod'] == 1) {
    add_product($_POST);
}
                <br class="clearfix" />

                <div class="acc-row">
                    <span class="acc-info"><label for="darab_szam">Darab szám:</label></span><span class="acc-datam">
                        <input type="text" name="darab_szam"  placeholder="<?php 
echo $data['DARAB_SZAM'];
?>
"/>
                    </span>
                </div>
                <br class="clearfix" />
                	<input type="hidden" name="termek_id" value="<?php 
echo $data['TERMEK_ID'];
?>
" />
                    <input type="submit" value="Felvétel" class="pull-center" name="modosit" />
                </form>

                <?php 
require_once '../php/products.php';
if (isset($_POST['modosit'])) {
    product_update();
}
?>
            </div>

            <div id="side2" class="sidebars pull-right">

            </div>
            <?php 
include "../footer.php";