Contenteditable div height limit - php

Hey guys I have problems with contenteditable height. With code like this:
function Preview() {
var x = document.getElementById("code").value;
document.getElementById("preview").innerHTML = x;
}
.preview{
text-align: left;
color: white;
margin-left: 10px;
max-height: 300px;
overflow: auto;
}
<section id="main">
<div id="gra">
<input type="hidden" id="current-code" name="current-code" />
<textarea id="code" name="code">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>A Simple PHP File</title>
</head>
<body>
<h1><?php echo "Hello, world!"; ?></h1>
</body>
</html>
</textarea>
<div class="flex">
Preview
Reset
</div>
</div>
<div id="gra">
<div contenteditable="true" class="preview" id="preview">
</div>
</div>
</section>
When I enter code with more I can observe effect like this:
Anyone can help me with limit contenteditable height?

try this code
and also change color: red; instead of color:white because its not see anything on white screen
function Preview() {
var x = document.getElementById("code").value;
document.getElementById("preview").innerHTML = x;
}
function Reset() {
document.getElementById("preview").innerHTML = "";
}
.preview {
text-align: left;
color: red;
margin-left: 10px;
max-height: 300px;
overflow-y: scroll;
border: solid 1px #ddd;
}
<section id="main">
<div id="gra">
<input type="hidden" id="current-code" name="current-code" />
<textarea id="code" name="code">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>A Simple PHP File</title>
</head>
<body>
<h1><?php echo "Hello, world!"; ?>you write php code hear so it will not print on html</h1>
</body>
</html>
</textarea>
<div class="flex">
Preview
Reset
</div>
</div>
<div id="gra">
<div contenteditable="true" class="preview" id="preview">
</div>
</div>
</section>

Related

Password-protect page allowing wrong passwords

I need assistance getting a password-protect page to work for my portfolio site. Currently, the password protect page allows users to go through even if they enter the wrong password. Can anyone assist? I don’t have previous experience with PHP.
Code below. Live site: https://www.starchevsky.com/pwo.php
(should redirect to starchevsky.com/pwo.html)
<?php
$password = "";
if(isset($_POST['submit'])) {
$password = $_POST['password'];
header('location: http://www.starchevsky.com/pwo.html');
if($password != "design6020") {
$error['password'] = "Please re-enter the password.";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Product Designer with 13 years of experience leading projects for clients large and small, including Google, Bank of America, and Chick-fil-A."/>
<title>Tatiana Starchevsky</title>
<link href="https://fonts.googleapis.com/css2?family=Montserrat&family=Prata&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="img/favicon.ico" />
<link rel="stylesheet" href="lib/css/foundation.css" />
<link rel="stylesheet" href="lib/css/style.css" />
<link rel="stylesheet" href="lib/css/app.css" />
<style>
input[type=text] {
border: 2px solid #ccc;
border-radius: 4px;
border-style:solid;
-webkit-appearance: none;
box-shadow: inset 0px 0px 0px 0px red;
}
input[type=button],
input[type=submit] {
background-color: #d50634;
border: none;
color: #fff;
padding: 15px 30px;
text-decoration: none;
margin: 4px 2px;
border-radius: 4px;
cursor: pointer;
}
input:hover[type="submit"]
{
background: #000;
}
</style>
</head>
<body>
<em><?php if($password == "design6020") {
header('location: http://www.starchevsky.com/pwo.html');
?></em>
<!-- PROTECTED INFORMATION GOES HERE -->
<?php } else { ?>
<section id="headernav">
<div class="grid-x">
<div class="cell small-6 name">
Tatiana Starchevsky
</div>
<div class="cell small-6">
<ul class="menu align-right">
<li><a ref="index.html">Projects</a></li>
<li>Contact</li>
</ul>
</div>
</div>
</section>
<section>
<div class="grid-x align-center align-middle">
<div class="large-6 small-6 cell">
<br><br><br><br>
<h3>Password Protected</h3>
<br>
<p>At the client's request, this project is password protected.</p>
<small>Please email me if you need access.</small>
<br><br>
<?php foreach($error as $errors) {
echo "<p style='color: red;'>".$errors."</p>";
}
?>
<form name="login" action="pwo.php" method="post">
<p>
<input type="text" id="password" class="password" name="password" placeholder="Password" value="<?php if(isset($password)) { echo $password; } ?>"> <input type="submit" name="submit" value="Submit">
</p>
<?php } ?>
</form>
</div>
</section>
<script src="js/vendor/jquery.js"></script>
<script src="js/vendor/what-input.js"></script>
<script src="js/vendor/foundation.js"></script>
<script src="js/app.js"></script>
</body>
</html>

Simple HTML and CSS background repeat

My website is http://nickliddell.com/pieres.
As you can see, the background on the header is repeating. I tried adding background-repeat:no-repeat; to all of the divs that is in the header, and it is still repeating.
Here is my header.php
<?php
/**
* The Header for our theme.
*
* #package WordPress
*/
global $cubby_options;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
<?php wp_title('|', true, 'right'); ?>
</title>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<center>
<div class="header">
<div class="top">
<div class="container">
<div class="contact left">
<?php echo cubby_options_array('top_contact_info') ; ?>
</div>
<div class="follow right"> <?php echo cubby_get_social_network(array("skype","facebook",'twitter','google_plus','youtube',"linkedin",'pinterest','rss'));?> </div>
</div>
</div>
<div class="top2">
<div class="container">
<div class="logo left"><a href="<?php echo esc_url(home_url('/')); ?>">
<?php if ( cubby_options_array('logo')!="") { ?>
<img src="<?php echo cubby_options_array('logo'); ?>" alt="<?php bloginfo('name'); ?>" />
<?php }else{ ?>
<span class="site-name">
<?php bloginfo('name'); ?>
</span>
<?php }?>
</a><span class="tagline"><?php echo get_bloginfo( 'description' );?></span></div>
</div>
</div>
<div class="menu_bottom">
<?php do_action('wp_menubar','Home'); ?>
</div>
</div>
</div>
</center>
<!--header-->
Here is my stylesheet:
.top2 {
display:inline-block;
width:100%;
min-height:186px;
background:#cccccc;
padding:20px 0 0;
margin-left: auto;
margin-right: auto;
position: relative;
background-repeat:no-repeat;
}
.container {
width:960px;
margin:0 auto;
background-repeat:no-repeat;
}
.top {
height:20px;
background:#333333;
padding:5px 0;
color:#ccc;
background-repeat:no-repeat;
}
min-height:60px
margin-left:auto;
margin-right:auto;
background-repeat:no-repeat;
}
.top2 .menu_bottom{
display: block;
position: absolute:
width: 100%;
bottom: -20px
}
.header {
}.center-content,.footer {
margin-top:20px;
}
Sorry I'm new to html and css. I was also wondering, how come in the stylesheet it states the classes as having a color as a background, but on the page it shows the image?
All replies are appreciated :)
Well check your code. Because you have this:
.header .top2 {
url("http://www.nickliddell.com/pieres/wp-content/uploads/2014/05/cropped-header1.png") repeat scroll 0 0 rgba(0, 0, 0, 0)
}
Where it says repeat. Change it to:
.header .top2 {
background-image: url("http://www.nickliddell.com/pieres/wp-content/uploads/2014/05/cropped-header1.png");
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
}
Also, if you are new. Do like what I typed in, and it will be easier for you to see the mistake ;)

2 column layout missing content

Im creating my site and require a 2 column layout on my page.
I have this code available for the one column layout.
<HTML>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include_once('header.php'); ?>
<div class="header_02"><center>one column layout</center></div>
<div style="position:relative">
<div>
<div style="position:absolute; left:30; top:30;">
<img src="images/xclo.jpg" width="350" height="215">
</div> </div>
<div style="position:absolute; left:0; top:0;">
<img src="images/frame.png" width="400" height="400">
</div>
</div>
column 2 content goes here.
</div></div>
<?php include_once('footer.php'); ?>
</body>
</HTML>
which displays fine.
however when I change it to this:
<HTML>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include_once('header.php'); ?>
<div class="header_02"><center>2 column layout</center></div>
<div style="position:relative">
<div id="container">
<!-- Start Column 1 -->
<div id="column1">
<div>
<div style="position:absolute; left:30; top:30;">
<img src="images/xclo.jpg" width="350" height="215">
</div> </div>
<div style="position:absolute; left:0; top:0;">
<img src="images/frame.png" width="400" height="400">
</div>
</div>
</div>
<div id="column2">
column 2 content goes here.
</div></div>
<?php include_once('footer.php'); ?>
</body>
</HTML>
with this css code in style.css
#container {
float: left;
width: 98%;
position:relative;
font-size: 22px;
}
#column1, #column2 {
width: 45%;
float: left;
position:relative;
}
#column1 {
overflow:hidden;
}
#column2 {
border-left: 1px solid #000000;
padding-left:30px;
}
it does not display the column 1 content.
my question to you is this:
how can I get this to work?
am I missing something?
please help me.
thank you.
I have simplified your layout a bit, you might be able to build on this:
This is HTML:
<div>
<center>2 column layout</center>
</div>
<div id="container">
<div id="column1">Coumn 1 content</div>
<div id="column2">column 2 content goes here.</div>
</div>
This is CSS:
#container {
font-size: 22px;
}
#column1 {
float: left;
width:50%;
background-color: green;
}
#column2 {
float: left;
width:50%;
background-color:red;
}

Killing off Global Session Variable as a logout button

Hey Stackoverflow users,
Since I was able to get some amazing help before with a problem I was stuck on for longer than I could remember I thought I would come at you with this.
Working with a login system that authenticates the user and kills the session off but currently it's not recognizing the variables assigned to the session. After clicking the logout button everything seems like it's working but when doing a direct connect to the Members Page by typing it into the address bar it loads the page instead of redirecting to the login page.
Members.php
<?PHP
session_start();
if (!isset($_SESSION['username'])) {
header('location:login.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>The Animator BETA</title>
<style>
//CSS Has been removed as it's lengthy and unrelated to the issue.
</style>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#login-trigger').click(function(){
$(this).next('#login-content').slideToggle();
$(this).toggleClass('active');
if ($(this).hasClass('active')) $(this).find('span').html('▲')
else $(this).find('span').html('▼')
})
});
</script>
</head>
<body>
<header class="cf">
<nav style="text-align:center">Logout</nav>
</header>
<h1 style="text-align:center"> The Animator - BETA</h1>
<hr />
<div id="nav" style="text-align:center">
<ul style="text-align:center">
<li><a href= "#" ><strong>Home</strong></a></li>
<strong><li><a href= "industrial.html" >Industrial</a></li>
<li><a href= "educational.html" >Education</a></li>
<li><a href= "independent.html" >Independent</a></li>
<li><a href= "emergent.html" >Emergent</a></li>
<li><a href= "team.html" >Team</a></li>
<li><a href= "project.html" >Project</a></li>
<li><a href= "budget.html" >Budget</a></li>
<li><a href= "profile.html" >Profile</a></li></strong>
</ul>
</div>
<hr />
<div style="padding-left:19%"><input type="text" value="search" />
<input type="button" value="Search!" name="search"/>
</div>
<div> </div>
<div align="center">
<div><img src="logo.png" width="407" height="345" alt="Logo" usemap="sectors" /></div>
</div>
</div>
<map name="sectors">
<area shape="rect" coords="72,40,194,165" alt="Industrial" href="industrial.html">
<area shape="rect" coords="210,38,328,162" alt="Emergent" href="emergent.html">
<area shape="rect" coords="208,178,331,296" alt="Independent" href="independent.html">
<area shape="rect" coords="71,177,194,295" alt="Educational" href="educational.html">
</map>
<div> </div>
<div style="text-align:right"></div>
<div> </div>
<div id="footer"> <hr />
<p><strong><u>About The Animator | Contact | Privacy Policy | FAQ</u></strong><u></u></p>
</div>
</body>
</html>
LOGIN PAGE
<?php
error_reporting(E_ALL);
ini_set('display_errors',"On");
include ('database_connection.php');
if (isset($_POST['formsubmitted'])) {
// Initialize a session:
session_start();
$error = array();//this aaray will store all error messages
if (empty($_POST['e-mail'])) {//if the email supplied is empty
$error[] = 'You forgot to enter your Email ';
} else {
if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*#([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['e-mail'])) {
$Email = $_POST['e-mail'];
} else {
$error[] = 'Your Email Address is invalid ';
}
}
if (empty($_POST['Password'])) {
$error[] = 'Please Enter Your Password ';
} else {
$Password = $_POST['Password'];
}
if (empty($error))//if the array is empty , it means no error found
{
$query_check_credentials = "SELECT * FROM account WHERE (email='$Email' AND passwords='$Password')";
$result_check_credentials = mysqli_query($dbc, $query_check_credentials);
if(!$result_check_credentials){//If the QUery Failed
echo 'Query Failed ';
}
if (#mysqli_num_rows($result_check_credentials) == 1)//if Query is successfull
{ // A match was made.
$_SESSION = mysqli_fetch_array($result_check_credentials, MYSQLI_ASSOC);//Assign the result of this query to SESSION Global Variable
$_SESSION['email'] = $Email;
session_start("username");
header("Location: members.php");
}else
{
$msg_error= 'Either Your Account is inactive or Email address /Password is Incorrect';
}
} else {
echo '<div class="errormsgbox"> <ol>';
foreach ($error as $key => $values) {
echo ' <li>'.$values.'</li>';
}
echo '</ol></div>';
}
if(isset($msg_error)){
echo '<div class="warning">'.$msg_error.' </div>';
}
/// var_dump($error);
mysqli_close($dbc);
} // End of the main Submit conditional.
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login Form</title>
<style type="text/css">
body {
font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
.registration_form {
margin:0 auto;
width:500px;
padding:14px;
}
label {
width: 10em;
float: left;
margin-right: 0.5em;
display: block
}
.submit {
float:right;
}
fieldset {
background:#EBF4FB none repeat scroll 0 0;
border:2px solid #B7DDF2;
width: 500px;
}
legend {
color: #fff;
background: #80D3E2;
border: 1px solid #781351;
padding: 2px 6px
}
.elements {
padding:10px;
}
p {
border-bottom:1px solid #B7DDF2;
color:#666666;
font-size:11px;
margin-bottom:20px;
padding-bottom:10px;
}
a{
color:#0099FF;
font-weight:bold;
}
/* Box Style */
.success, .warning, .errormsgbox, .validation {
border: 1px solid;
margin: 0 auto;
padding:10px 5px 10px 60px;
background-repeat: no-repeat;
background-position: 10px center;
font-weight:bold;
width:450px;
}
.success {
color: #4F8A10;
background-color: #DFF2BF;
background-image:url('images/success.png');
}
.warning {
color: #9F6000;
background-color: #FEEFB3;
background-image: url('images/warning.png');
}
.errormsgbox {
color: #D8000C;
background-color: #FFBABA;
background-image: url('images/error.png');
}
.validation {
color: #D63301;
background-color: #FFCCBA;
background-image: url('images/error.png');
}
</style>
</head>
<body>
<form action="login.php" method="post" class="registration_form">
<fieldset>
<legend>Login Form </legend>
<p>Enter Your username and Password Below </p>
<div class="elements">
<label for="name">Email :</label>
<input type="text" id="e-mail" name="e-mail" size="25" />
</div>
<div class="elements">
<label for="Password">Password:</label>
<input type="password" id="Password" name="Password" size="25" />
</div>
<div class="submit">
<input type="hidden" name="formsubmitted" value="TRUE" />
<input type="submit" value="Login" />
</div>
</fieldset>
</form>
<button onclick="window.location='theanimator.html';">Go Back!</button>
</body>
</html>
LOGOUT
<?php
unset($_SESSION['email']);
header('Location: login.php');
exit;
?>
your logout page has to be this:
<?php
//start the session
session_start();
//this will destroy the session that is started
session_destroy();
header('Location: login.php');
exit;
?>
The problem was, you didn't destroy the session so the session exist when you go back to page.
Also you where looking checking on $_SESSION['username'] but you unset $_SESSION['email'] that is never going to work.

Page layout issues with PHP , HTML, and CSS

For some reason my CSS is not formatting my div tags into the correct spots on the page. It works on all my other pages but this one has a lot more PHP in it than normal and I am wondering if that is the problem.
Page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
require("protect/serverInfo.php");
$myusername=$_POST[Email];
$mypassword=$_POST[Password];
$result = mysql_query("SELECT * FROM Customers WHERE Email='$myusername' AND Password=$mypassword");
$count=mysql_num_rows($result);
if($count==1){
while($row = mysql_fetch_array($result)){
?>
<div class="wrapper">
<div class="customerHead">';
<h1>
<?php echo $row['Customer'] ?>
</h1>
</div>
<div class="customerInfoMain">
Company: <?php echo $row['Company'] ?><br />
State: <?php echo $row['State'] ?>
</div>
<div class="customerCards">';
<img src="<?php echo $row['imagePathFront'] ?>" width="400px" height="303px" align="center" alt="" />
<img src="<?php echo $row['imagePathBack'] ?>" width="400px" height="303px" align="center" alt="" />
</div>
<div class="customerComments">';
<h5>Changes Made:</h5><br /> <?php echo $row['Comments'] ?>
</div>
</div>
<?php
}
}
else {
echo "Wrong Username or Password";
}
?>
</body>
</html
>
CSS
.customerCards{
top: 150px;
position: relative;
width: 425px;
border: 3px;
border-style:solid;
border-color: black;
background-color: silver;
z-index:1;
}
.customerInfoMain{
top: 200px;
position: relative;
width: 200px;
left: 520px;
border: 3px;
border-style:solid;
border-color: black;
background-color: silver;
z-index:2;
}
.customerComments{
position: relative;
width: 200px;
left: 580px;
border: 3px;
border-style:solid;
border-color: black;
background-color: silver;
z-index:2;
}
.wrapper{
position: absolute;
left: 50%;
width: 900px;
margin-left: -475px;
}
Source after page load
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
Wrong Username or Password
</body>
</html>
its because your wrapper just starting if there is user..
But what happend if you put your wrapper around the PHP, like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="wrapper">
<?php
require("protect/serverInfo.php");
$myusername=$_POST[Email];
$mypassword=$_POST[Password];
$result = mysql_query("SELECT * FROM Customers WHERE Email='$myusername' AND Password=$mypassword");
$count=mysql_num_rows($result);
if($count==1){
while($row = mysql_fetch_array($result)){
?>
<div class="customerHead">';
<h1>
<?php echo $row['Customer'] ?>
</h1>
</div>
<div class="customerInfoMain">
Company: <?php echo $row['Company'] ?><br />
State: <?php echo $row['State'] ?>
</div>
<div class="customerCards">';
<img src="<?php echo $row['imagePathFront'] ?>" width="400px" height="303px" align="center" alt="" />
<img src="<?php echo $row['imagePathBack'] ?>" width="400px" height="303px" align="center" alt="" />
</div>
<div class="customerComments">';
<h5>Changes Made:</h5><br /> <?php echo $row['Comments'] ?>
</div>
<?php
}
}
else {
echo "Wrong Username or Password";
}
?>
</div>
</body>
</html>
"Then you should have a little bit of the CSS action?"
Split the code by purpose functionality and calculations are not meant to be in the same place, html should be rendered last. Keeping on working like this will bring you a lot of trouble. Things should be done like this:
loginProcess.php contains:
if(isset($_SESSION["user"]) {
$row = $_SESSION["user"];
}
include("loginPage.php");
?>
and this is longinPage.php (you can include either of them in which on you want). Either include loginPage.php at the end of loginProcess.php or include loginProcess.php at the begining of loginPage.php
so loginPage.php contains
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns="http://www.w3.org/1999/xhtml">
< head>
< meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
< title>Untitled 1
< link href="stylesheet.css" rel="stylesheet" type="text/css" />
< /head>
< body>
if(isset($_SESSION['user'])) {
< div class="wrapper">
< div class="customerHead">';
<h1><!---you know the row from before---/>
<?php echo $row['Customer'] ?>
</h1>
</div>
<div class="customerInfoMain">
Company: <?php echo $row['Company'] ?><br />
State: <?php echo $row['State'] ?>
</div>
<div class="customerCards">';
<img src="<?php echo $row['imagePathFront'] ?>" width="400px" height="303px" align="center" alt="" />
< a href ="something/<?php echo $row['imagePathBack'] ?>" target="_blank">
< img src="" width="400px" height="303px" align="center" alt="" />
</div>
<div class="customerComments">';
<h5>Changes Made:</h5><br /> <?php echo $row['Comments'] ?>
</div>
</div>
<?php
}
}
else {?>
<form action="/loginProcess.php" (or loginPage.php if loginPage includes the loginProcess) method="POST">
<input type="text" name="Email" value=""/>
<input type="password" name="Password" value=""/>
<input type="submit" value="login"/>
</form>
<?php}?>
?>
first the login form will be shown and the user will input his credentials, those credentials will be checked and if they are ok the SESSION['user'] is set (remeber you need a session start for that) now as long as the session persists you will not need to request for login all the time. Anyway, if you do not want for some reason to fully separate Database Concerns/Process Concerns/Viewing Concerns, at leas you must separate the Process from the Viewing(Keeping Database concerns in the processing area). Checkout some frameworks online or try to find a way to write code with a little more care, otherwise you will keep on having useless problems that waste your time.

Categories