exit;
            } else {
                trigger_error('Vasa lozinka nije mogli biti promjenjena zbog sistemskog errora.');
            }
        } else {
            $pass_errors['current'] = 'Vasa trenutna lozinka je netocna';
        }
    }
}
require './includes/form_functions.inc.php';
?>
<h3>Promijenite vasu lozinku</h3>
<p>Upotrijebite obrazac ispod da promjenite svoju lozinku.</p>
<form action="change_password.php" method="post" accept-charset="utf-8">
	<p><label for="pass1"><strong>Trenutna lozinka</strong></label><br /><?php 
create_form_input('current', 'password', $pass_errors);
?>
</p>
	<p><label for="pass1"><strong>Nova lozinka</strong></label><br /><?php 
create_form_input('pass1', 'password', $pass_errors);
?>
 <small>Mora biti izmedu 6 do 20 karaktera dugacka, sa barem jednim malim slovom, jednim velikim slovom, i jednim brojem.</small></p>
	<p><label for="pass2"><strong>Potvrdite novu lozinku</strong></label><br /><?php 
create_form_input('pass2', 'password', $pass_errors);
?>
</p>
	<input type="submit" name="submit_button" value="Change &rarr;" id="submit_button" class="formbutton" />
</form>

<?php 
include './includes/footer.html';
            $url = 'https://' . BASE_URL . 'reset.php?t=' . $token;
            $body = "This email is in response to a forgotten password reset request at 'Knowledge is Power'. If you did make this request, click the following link to be able to access your account:\n{$url}\nFor security purposes, you have 15 minutes to do this. If you do not click this link within 15 minutes, you'll need to request a password reset again.\nIf you have _not_ forgotten your password, you can safely ignore this message and you will still be able to login with your existing password. ";
            mail($email, 'Password Reset at Knowledge is Power', $body, 'FROM: ' . CONTACT_EMAIL);
            echo '<h1>Reset Your Password</h1><p>You will receive an access code via email. Click the link in that email to gain access to the site. Once you have done that, you may then change your password.</p>';
            include './includes/footer.html';
            exit;
            // Stop the script.
        } else {
            // If it did not run OK.
            trigger_error('Your password could not be changed due to a system error. We apologize for any inconvenience.');
        }
    }
    // End of empty($pass_errors) IF.
}
// End of the main Submit conditional.
// Need the form functions script, which defines create_form_input():
// The file may already have been included by the header.
require_once './includes/form_functions.inc.php';
?>
<h1>Reset Your Password</h1>
<p>Enter your email address below to reset your password.</p> 
<form action="forgot_password.php" method="post" accept-charset="utf-8">
	<?php 
create_form_input('email', 'text', 'Email Address', $pass_errors);
?>
	<input type="submit" name="submit_button" value="Reset &rarr;" id="submit_button" class="btn btn-default" />
</form>

<?php 
// Include the HTML footer:
include './includes/footer.html';
Exemple #3
0
            }
            // End of $rows === 2 ELSE.
        }
        // End of $rows === 0 IF.
    }
    // End of empty($reg_errors) IF.
}
// End of the main form submission conditional.
// Need the form functions script, which defines create_form_input():
// The file may already have been included by the header.
require_once './includes/form_functions.inc.php';
?>
<h1>Register</h1>
<p>Access to the site's content is available to registered users at a cost of $10.00 (US) per year. Use the form below to begin the registration process. <strong>Note: All fields are required.</strong> After completing this form, you'll be presented with the opportunity to securely pay for your yearly subscription via <a href="http://www.paypal.com">PayPal</a>.</p>
<form action="register.php" method="post" accept-charset="utf-8">
<?php 
create_form_input('first_name', 'text', 'First Name', $reg_errors);
create_form_input('last_name', 'text', 'Last Name', $reg_errors);
create_form_input('username', 'text', 'Desired Username', $reg_errors);
echo '<span class="help-block">Only letters and numbers are allowed.</span>';
create_form_input('email', 'email', 'Email Address', $reg_errors);
create_form_input('pass1', 'password', 'Password', $reg_errors);
echo '<span class="help-block">Must be at least 6 characters long, with at least one lowercase letter, one uppercase letter, and one number.</span>';
create_form_input('pass2', 'password', 'Confirm Password', $reg_errors);
?>
	<input type="submit" name="submit_button" value="Next &rarr;" id="submit_button" class="btn btn-default" />
</form>
<br>
<?php 
// Include the HTML footer:
include './includes/footer.html';
        $p = substr(md5(uniqid(rand(), true)), 15, 15);
        $q = "UPDATE users SET pass='******' WHERE id={$uid} LIMIT 1";
        $r = mysqli_query($dbc, $q);
        if (mysqli_affected_rows($dbc) == 1) {
            $body = "Vasa sifra za logiranje na web sucelje za prodaju je privremeno promjenjena '{$p}'. \n\t\t\tMolim da se logirate pomocu te zaporke i ove email adrese. Tada mozete promjeniti vasu sifru\n\t\t\tna nesto poznatije.";
            mail($_POST['email'], 'Vasa privremena lozinka.', $body, 'From: system0@net.hr');
            echo '<h3>Vasa sifra je promjenjena.</h3><p>Primit cete novu, privremenu 
			zaporku emailom. Nakon sto ste se logirali sa novom sifrom, mozete ju promjeniti.</p>';
            include './includes/footer.html';
            exit;
        } else {
            trigger_error('Vasa zaporka se nije mogla promjeniti zbog sistemskog errora.');
        }
    }
}
require './includes/form_functions.inc.php';
?>

    <h3>Promjena vase lozinke</h3>
    <p>Unesite svoju email adresu, pa cemo resetirati vasu lozinku.</p> 
<form action="forgot_password.php" method="post" accept-charset="utf-8">
	<p><label for="email"><strong>Email Adresa</strong></label><br />
	<?php 
create_form_input('email', 'text', $pass_errors);
?>
</p>
	<input type="submit" name="submit_button" value="Reset &rarr;" id="submit_button" class="formbutton" />
</form>

<?php 
include './includes/footer.html';
Exemple #5
0
$r = mysqli_query($dbc, $q);
while ($row = mysqli_fetch_array($r, MYSQLI_NUM)) {
    echo "<option value=\"{$row['0']}\"";
    // Check for stickyness:
    if (isset($_POST['category']) && $_POST['category'] == $row[0]) {
        echo ' selected="selected"';
    }
    echo ">{$row['1']}</option>\n";
}
echo '</select>';
if (array_key_exists('category', $add_page_errors)) {
    echo '<span class="help-block">' . $add_page_errors['category'] . '</span>';
}
echo '</div>';
create_form_input('description', 'textarea', 'Description', $add_page_errors);
create_form_input('content', 'textarea', 'Content', $add_page_errors);
?>
		
		<input type="submit" name="submit_button" value="Add This Page" id="submit_button" class="btn btn-default" />
	
	</fieldset>

</form> 

<script type="text/javascript" src="js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		selector : "#content",
		width : 800,
		height : 400,
Exemple #6
0
<?php

if (!isset($login_errors)) {
    $login_errors = array();
}
require './includes/form_functions.inc.php';
?>
<form action="index.php" method="post" accept-charset="utf-8">
<fieldset>
<legend>Login</legend>
<?php 
if (array_key_exists('login', $login_errors)) {
    echo '<div class="alert alert-danger">' . $login_errors['login'] . '</div>';
}
create_form_input('email', 'email', '', $login_errors, array('placeholder' => 'Email address'));
create_form_input('pass', 'password', '', $login_errors, array('placeholder' => 'Password'));
?>
<button type="submit" class="btn btn-default">Login &rarr;</button>
</fieldset>
</form>
Exemple #7
0
<?php

// This script displays the login form.
// This script is included by footer.html, if the user isn't logged in.
// This script is created in Chapter 4.
// Create an empty error array if it doesn't already exist:
if (!isset($login_errors)) {
    $login_errors = array();
}
// Need the form functions script, which defines create_form_input():
// The file may already have been included (e.g., if this is register.php or forgot_password.php).
require 'include/form_functions.inc.php';
?>
<div class="title">
	<h4>Login</h4>
</div>
<form action="display.php" method="post" accept-charset="utf-8">
<p><?php 
if (array_key_exists('login', $login_errors)) {
    echo '<span class="error">' . $login_errors['login'] . '</span><br />';
}
?>
<label for="email"><strong>Email Address</strong></label><br /><?php 
create_form_input('email', 'text', $login_errors);
?>
<br /><label for="pass"><strong>Password</strong></label><br /><?php 
create_form_input('pass', 'password', $login_errors);
?>
 <a href="forgot_password.php" align="right">Forgot?</a><br /><input type="submit" value="Login &rarr;"></p>
</form>
create_form_input('name', 'text', $add_product_errors);
?>
</div>

		<div class="field"><label for="price"><strong>Price</strong></label><br /><?php 
create_form_input('price', 'text', $add_product_errors);
?>
 <small>Without the dollar sign.</small></div>

		<div class="field"><label for="stock"><strong>Initial Quantity in Stock</strong></label><br /><?php 
create_form_input('stock', 'text', $add_product_errors);
?>
</div>
		
		<div class="field"><label for="description"><strong>Description</strong></label><br /><?php 
create_form_input('description', 'textarea', $add_product_errors);
?>
</div>

		<div class="field"><label for="image"><strong>Image</strong></label><br /><?php 
// Check for an error:
if (array_key_exists('image', $add_product_errors)) {
    echo '<span class="error">' . $add_product_errors['image'] . '</span><br /><input type="file" name="image" class="error" />';
} else {
    // No error.
    echo '<input type="file" name="image" />';
    // If the file exists (from a previous form submission but there were other errors),
    // store the file info in a session and note its existence:
    if (isset($_SESSION['image'])) {
        echo "<br />Currently '{$_SESSION['image']['file_name']}'";
    }
Exemple #9
0
create_form_input('cc_address', 'text', $billing_errors);
?>
</div>
	
	<div class="field"><label for="cc_city"><strong>City </strong></label><br /><?php 
create_form_input('cc_city', 'text', $billing_errors);
?>
</div>
	
	<div class="field"><label for="cc_state"><strong>State </strong></label><br /><?php 
create_form_input('cc_state', 'select', $billing_errors);
?>
</div>
	
	<div class="field"><label for="cc_zip"><strong>Zip Code </strong></label><br /><?php 
create_form_input('cc_zip', 'text', $billing_errors);
?>
</div>
		
	<br clear="all" />
	
<div align="center" id="submit_div"><input type="submit" value="Place Order" class="btn btn-primary btn" /></div></fieldset></form></div>
</div>
      </div>
   </div>
   <div class="left-bot-corner">
   	<div class="right-bot-corner">
      	<div class="border-bot"></div>
      </div>
   </div>
</div>
Exemple #10
0
create_form_input('city', 'text', $shipping_errors);
?>
</div>
	
	<div class="field"><label for="zip"><strong>Zip Code* <span class="required"></span></strong></label><br /><?php 
create_form_input('zip', 'text', $shipping_errors);
?>
</div>
	
	<div class="field"><label for="phone"><strong>Phone Number* <span class="required"></span></strong></label><br /><?php 
create_form_input('phone', 'text', $shipping_errors);
?>
</div>
	
	<div class="field"><label for="state"><strong>State* <span class="required"></span></strong> </label><br /><?php 
create_form_input('state', 'select', $shipping_errors);
?>
</div>
	
	
		<!-- form -->
		<div class="button">
			<div align="center"><input type="submit" value="Proceed" class="btn btn-danger btn-xs" /></div></fieldset></form>
		</div><!-- button -->
	</section><!-- content -->
</div><!-- container -->
</div>
</div>


Exemple #11
0
    unset($_SESSION['pdf']);
}
// End of the submission IF.
// Need the form functions script, which defines create_form_input():
require 'includes/form_functions.inc.php';
?>
<h1>Add a PDF</h1>
<form enctype="multipart/form-data" action="add_pdf.php" method="post" accept-charset="utf-8">

	<input type="hidden" name="MAX_FILE_SIZE" value="5242880">
	
	<fieldset><legend>Fill out the form to add a PDF to the site:</legend>
	
<?php 
create_form_input('title', 'text', 'Title', $add_pdf_errors);
create_form_input('description', 'textarea', 'Description', $add_pdf_errors);
// Add the file input:
echo '<div class="form-group';
// Add classes, if applicable:
if (array_key_exists('pdf', $add_pdf_errors)) {
    echo ' has-error';
} else {
    if (isset($_SESSION['pdf'])) {
        echo ' has-success';
    }
}
echo '"><label for="pdf" class="control-label">PDF</label><input type="file" name="pdf" id="pdf">';
// Check for an error:
if (array_key_exists('pdf', $add_pdf_errors)) {
    echo '<span class="help-block">' . $add_pdf_errors['pdf'] . '</span>';
} else {