first of all before I start excuse my mysql I know it's depreciated and I will update to PDO in the future. So here we go.
Basically I have duplicates of most of my pages, 'index.php', 'index2.php' so on and so forth. Basically right now all the pages without the number '2' are non registered users and once a user logs in they will be redirected to 'index2.php' and so all the number with '2' are registered users pages. So what I basically wanted to do is instead of having duplicate pages am I able to just have 'index.php' and other pages without duplicates? So user logs in will be redirected to 'index.php' but have the same features and 'index2.php'. If that makes any sense haha!
Registration page code:
<?php
session_start();
include ('../includes/config.php');
include ('../includes/header.php');
?>
<!doctype html>
<html>
<body>
<div class="search1">
<h2>Register</h2>
<form action="" method="POST">
<center>
<label>Username:</label>
<input type="text" name="username" required />
<label>Password:</label>
<input type="password" name="password" required />
<label>Email:</label>
<input type="email" name="email" required />
<input type="submit" value="Register" name="submit" class="submit" />
</center>
<br><br><br>
<h2><p>Back</p></h2>
</div>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['username']) && !empty($_POST['password'])) {
$username=$_POST['username'];
$password=$_POST['password'];
$email=$_POST['email'];
$password = strip_tags($password);
$password = md5($password); // md5 is used to encrypt your password to make it more secure.
$con=mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('aha') or die("cannot select DB");
$query=mysql_query("SELECT * FROM login WHERE username='".$username."'");
$numrows=mysql_num_rows($query);
if($numrows==0)
{
$sql="INSERT INTO login(username,password,email) VALUES('$username','$password', '$email')";
$result=mysql_query($sql);
if($result){
echo "<div class='passed'>Account Successfully Created</div>";
} else {
echo "<div class='results'>Failure!</div>";
}
} else {
echo "<div class='results'>Username already exists!</div>";
}
} else {
echo "<div class='results'>All fields are required!</div>";
}
}
?>
</form>
<img src="../images/main.jpg">
</body>
</html>
INDEX1.PHP-CODE:
<?php
session_start();
include ('../includes/config.php');
include ('../includes/header.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Honda |</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--slider-->
<link href="../css/camera.css" rel="stylesheet" type="text/css" media="all" />
<script type='text/javascript' src='../js/jquery.min.js'></script>
<script type='text/javascript' src='../js/jquery.mobile.customized.min.js'></script>
<script type='text/javascript' src='../js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='../js/camera.min.js'></script>
<script>
jQuery(function(){
jQuery('#camera_wrap_1').camera({
thumbnails: true
});
jQuery('#camera_wrap_2').camera({
height: '400px',
loader: 'bar',
pagination: false,
thumbnails: true
});
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li class="active"><span>Home</span></li>
<li><span>About</span></li>
<li class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
</ul>
<div class="search">
<h2>search</h2>
<form action="search.php" method="get">
<input type="text" name="search" value="" placeholder="Enter Your search...">
<input type="submit" name="submit" value="">
</form>
</div>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['username']) && !empty($_POST['password'])) {
$username=$_POST['username'];
$password=$_POST['password'];
$password = strip_tags($password);
$password = md5($password); // md5 is used to encrypt your password to make it more secure.
$query=mysql_query("SELECT * FROM login WHERE username='".$username."' AND password='".$password."'");
$numrows=mysql_num_rows($query);
if($numrows!=0)
{
while($row=mysql_fetch_assoc($query))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
}
if($username == $dbusername && $password == $dbpassword)
{
session_start();
$_SESSION['sess_user']=$username;
/* Redirect browser */
header("Location: member.php");
}
} else {
echo "<div class='results'>Invalid username or password</div>";
}
} else {
echo "All fields are required!";
}
}
?>
<div class="search1">
<h2>login/Register</h2>
<form action="" method="POST">
<label>Username:</label>
<input type="text" id="password" name="username" required />
<label>Password:</label>
<input type="password" id="password" name="password" required />
<input type="submit" value="Login" name="submit" class="submit" />
<br><br>
<center>
<h2><p>Register</p></h2>
</center>
</form>
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start slider -->
<div class="slider_bg">
<div class="wrap">
<div class="wrapper">
<div class="slider">
<!-- #camera_wrap_1 -->
<div class="fluid_container">
<div class="camera_wrap camera_azure_skin" id="camera_wrap_1">
<div data-thumb="../images/thumbs/slider1.jpg" data-src="../images/slider/slider1.jpg">
</div>
<div data-thumb="../images/thumbs/slider2.jpg" data-src="../images/slider/slider2.jpg">
</div>
<div data-thumb="../images/thumbs/slider3.jpg" data-src="../images/slider/slider3.jpg">
</div>
<div data-thumb="../images/thumbs/slider4.jpg" data-src="../images/slider/slider4.jpg">
</div>
</div><!-- #camera_wrap_1 -->
<div class="clear"></div>
</div>
<!-- end #camera_wrap_1 -->
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<!-- start content_right -->
<div class="image group">
<div class="grids_of_2">
<div class="grid images_3_of_1">
<img src="../images/pic1.jpg">
</div>
<div class="grid span_2_of_3">
<h3>How it all started</h3>
<p class="para">Honda Motor Co., Ltd. (本田技研工業株式会社 Honda Giken Kōgyō KK?, IPA: [hoɴda] ( listen); /ˈhɒndə/) is a Japanese public multinational corporation primarily known as a manufacturer of automobiles, motorcycles and power equipment.
Honda has been the world's largest motorcycle manufacturer since 1959,[3][4] as well as the world's largest manufacturer of internal combustion engines measured by volume, producing more than 14 million internal combustion engines each year.[5] Honda became the second-largest Japanese automobile manufacturer in 2001.[6][7] Honda was the eighth largest automobile manufacturer in the world behind General Motors, Volkswagen Group, Toyota, Hyundai Motor Group, Ford, Nissan, and PSA in 2011.[8]
Honda was the first Japanese automobile manufacturer to release a dedicated luxury brand, Acura, in 1986. Aside from their core automobile and motorcycle businesses, Honda also manufactures garden equipment, marine engines, personal watercraft and power generators, amongst others. Since 1986, Honda has been involved with artificial intelligence/robotics research and released their ASIMO robot in 2000. They have also ventured into aerospace with the establishment of GE Honda Aero Engines in 2004 and the Honda HA-420 HondaJet, which began production in 2012. Honda has three joint-ventures in China (Honda China, Dongfeng Honda, and Guangqi Honda).
In 2013, Honda invested about 5.7% (US$ 6.8 billion) of its revenues in research and development.[9] Also in 2013, Honda became the first Japanese automaker to be a net exporter from the United States, exporting 108,705 Honda and Acura models while importing only 88,357</p>
</div>
<div class="clear"></div>
</div>
<div class="grids_of_2 top">
<div class="grid images_3_of_1">
<img src="../images/pic2.jpg">
</div>
<div class="grid span_2_of_3">
<h3>CEO of Honda</h3>
<p class="para">Kawamoto acted quickly to change Honda's corporate culture, rushing through market-driven product development that resulted in recreational vehicles such as the Odyssey[disambiguation needed] and the CR-V, and a refocusing away from some of the numerous sedans and coupes that were popular with Honda's engineers but not with the buying public. The most shocking change to Honda came when Kawamoto ended Honda's successful participation in Formula One after the 1992 season, citing costs in light of the takeover threat from Mitsubishi as well as the desire to create a more environmentally-friendly company image.[21]
Later, 1995 gave rise to the Honda Aircraft Company with the goal of producing jet aircraft under Honda's name</p>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</center>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="copy">
<p class="w3-link">© </p>
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
</body>
</html>
Least but not last! INDEX2.PHP-CODE:
<?php
session_start();
include "../includes/config.php";
include "function.php";
include ('../includes/header.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<style>
#error_box{display:none; position:relative;top:-25px}
</style>
<title>Honda |</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--slider-->
<link href="../css/camera.css" rel="stylesheet" type="text/css" media="all" />
<script type='text/javascript' src='../js/jquery.min.js'></script>
<script type='text/javascript' src='../js/jquery.mobile.customized.min.js'></script>
<script type='text/javascript' src='../js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='../js/camera.min.js'></script>
<script>
jQuery(function(){
jQuery('#camera_wrap_1').camera({
thumbnails: true
});
jQuery('#camera_wrap_2').camera({
height: '400px',
loader: 'bar',
pagination: false,
thumbnails: true
});
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li class="active"><span>Home</span></li>
<li><span>About</span></li>
<li class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
</ul>
<div class="search">
<h2>search</h2>
<form>
<input type="text" value="" placeholder="Enter Your search...">
<input type="submit" value="">
</form>
</div>
<div class="search1">
<form action="" method="POST">
<br>
<h2>Welcome, <?=$_SESSION['sess_user'];?>!</h2><br><br>
<div class="pw">
<h3>Change details</h3>
</div>
<br><br>
<h2>Logout</h2>
</form>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start slider -->
<div class="slider_bg">
<div class="wrap">
<div class="wrapper">
<div class="slider">
<!-- #camera_wrap_1 -->
<div class="fluid_container">
<div class="camera_wrap camera_azure_skin" id="camera_wrap_1">
<div data-thumb="../images/thumbs/slider1.jpg" data-src="../images/slider/slider1.jpg">
</div>
<div data-thumb="../images/thumbs/slider2.jpg" data-src="../images/slider/slider2.jpg">
</div>
<div data-thumb="../images/thumbs/slider3.jpg" data-src="../images/slider/slider3.jpg">
</div>
<div data-thumb="../images/thumbs/slider4.jpg" data-src="../images/slider/slider4.jpg">
</div>
</div><!-- #camera_wrap_1 -->
<div class="clear"></div>
</div>
<!-- end #camera_wrap_1 -->
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<!-- start content_right -->
<div class="image group">
<div class="grids_of_2">
<div class="grid images_3_of_1">
<img src="../images/pic1.jpg">
</div>
<div class="grid span_2_of_3">
<h3>How it all started</h3>
<p class="para">Honda Motor Co., Ltd. (本田技研工業株式会社 Honda Giken Kōgyō KK?, IPA: [hoɴda] ( listen); /ˈhɒndə/) is a Japanese public multinational corporation primarily known as a manufacturer of automobiles, motorcycles and power equipment.
Honda has been the world's largest motorcycle manufacturer since 1959,[3][4] as well as the world's largest manufacturer of internal combustion engines measured by volume, producing more than 14 million internal combustion engines each year.[5] Honda became the second-largest Japanese automobile manufacturer in 2001.[6][7] Honda was the eighth largest automobile manufacturer in the world behind General Motors, Volkswagen Group, Toyota, Hyundai Motor Group, Ford, Nissan, and PSA in 2011.[8]
Honda was the first Japanese automobile manufacturer to release a dedicated luxury brand, Acura, in 1986. Aside from their core automobile and motorcycle businesses, Honda also manufactures garden equipment, marine engines, personal watercraft and power generators, amongst others. Since 1986, Honda has been involved with artificial intelligence/robotics research and released their ASIMO robot in 2000. They have also ventured into aerospace with the establishment of GE Honda Aero Engines in 2004 and the Honda HA-420 HondaJet, which began production in 2012. Honda has three joint-ventures in China (Honda China, Dongfeng Honda, and Guangqi Honda).
In 2013, Honda invested about 5.7% (US$ 6.8 billion) of its revenues in research and development.[9] Also in 2013, Honda became the first Japanese automaker to be a net exporter from the United States, exporting 108,705 Honda and Acura models while importing only 88,357</p>
</div>
<div class="clear"></div>
</div>
<div class="grids_of_2 top">
<div class="grid images_3_of_1">
<img src="../images/pic2.jpg">
</div>
<div class="grid span_2_of_3">
<h3>CEO of Honda</h3>
<p class="para">Kawamoto acted quickly to change Honda's corporate culture, rushing through market-driven product development that resulted in recreational vehicles such as the Odyssey[disambiguation needed] and the CR-V, and a refocusing away from some of the numerous sedans and coupes that were popular with Honda's engineers but not with the buying public. The most shocking change to Honda came when Kawamoto ended Honda's successful participation in Formula One after the 1992 season, citing costs in light of the takeover threat from Mitsubishi as well as the desire to create a more environmentally-friendly company image.[21]
Later, 1995 gave rise to the Honda Aircraft Company with the goal of producing jet aircraft under Honda's name</p>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</center>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="copy">
<p class="w3-link">© </p>
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
</body>
</html>
Any help is greatly appreciated! Thanks!
This is a really poor design, but i hope, you will get the logic.
session_start();
if (!empty($_POST["username"]) && !empty($_POST["password"])) {
//If form has submitted
//Get user from database.
if ($numrows > 0) {
$_SESSION["loggedIn"] = true;
//You can set here more session things, like username, email, etc...
} else {
$_SESSION["loggedIn"] = false;
}
}
if (empty($_SESSION["loggedIn"])) {
//Show content if user is not logged in.
//You can include your file here, when user not logged in
} else {
//Show content if user is logged in.
//You can include your file here
//The best practice, if you are redirect to the user here to another page.
//Do this check in all page, when user needs to be logged in
}
//HTML code comes here.
Related
I am new to php. I have a sign up page that takes in few user details and makes an account. On running the code I get this error:
Parse error: syntax error, unexpected end of file on line 347
I have seen few other posts related to the same issue but I didnt find any of those helpful for my code. I have reviewed the code many times to see what I have done wrong but couldn't find my mistake. Please help with the statement or point where I have gone wrong. Thanks in advance.
My code is below:
sign-up.php
<!DOCTYPE html>
<html>
<head>
<title>My Trip Planner | Sign Up </title>
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Xtreme Travel Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- //for-mobile-apps -->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/styles.css?v=1.6" rel="stylesheet">
<!-- js -->
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/scripts.js?v=1.7"></script>
<!-- //js -->
<!-- start-smoth-scrolling -->
<script type="text/javascript" src="js/move-top.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
});
});
</script>
<script type="text/javascript">
function formValidation()
{
var uid = document.registration.userid;
var passid = document.registration.passid;
var uemail = document.registration.email;
if(userid_validation(uid,5,12))
{
if(passid_validation(passid,7,12))
{
if(ValidateEmail(uemail))
{
}
}
}
return false;
}
function userid_validation(uid,mx,my)
{
var uid_len = uid.value.length;
if (uid_len == 0 || uid_len >= my || uid_len < mx)
{
alert("User Id should not be empty / length be between "+mx+" to "+my);
uid.focus();
return false;
}
return true;
}
function passid_validation(passid,mx,my)
{
var passid_len = passid.value.length;
if (passid_len == 0 ||passid_len >= my || passid_len < mx)
{
alert("Password should not be empty / length be between "+mx+" to "+my);
passid.focus();
return false;
}
return true;
}
function ValidateEmail(uemail)
{
var mailformat = /^\w+([\.-]?\w+)*#\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if(uemail.value.match(mailformat))
{
//alert("You have entered a valid email address!");
return true;
}
else
{
alert("You have entered an invalid email address!");
uemail.focus();
return false;
}
}
</script>
<!-- start-smoth-scrolling -->
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Comfortaa:400,300,700' rel='stylesheet' type='text/css'>
</head>
<?php
session_start();
if(!empty($_POST)) {
class MyDB extends SQLite3
{
function __construct()
{
$this->open('mytrip.db');
}
}
$db = new MyDB();
if(!$db){
echo $db->lastErrorMsg();
} else {
}
$id=null;
$pass=null;
$email=null;
$fname=null;
$lname=null;
$id_exists=false;
if (isset($_POST['uid'])) {
$id = $_POST['uid'];
}
if (isset($_POST['passid'])) {
$pass = $_POST['passid'];
}
if (isset($_POST['uemail'])) {
$email = $_POST['uemail'];
}
if (isset($_POST['first'])) {
$fname = $_POST['first'];
}
if (isset($_POST['last'])) {
$lname = $_POST['last'];
$result= "SELECT COUNT(*) FROM Users WHERE ID = '".$id. "';" ;
$count= $db->querySingle($result);
if ($count > 0)
{
$id_exists = true;
echo "This id is not available. Please enter a valid id. ";
}
else
{
$sql= " INSERT INTO Users (ID, PASSWORD, EMAIL, FNAME, LNAME)
VALUES ('$id','$pass','$email', '$fname', '$lname'); " ;
$ret = $db->query($sql);
$_SESSION['Id'] = $id;
header("location:index.php");
}
$db->close();
}
?>
<body>
<!-- banner -->
<div class="banner1">
<div class="navigation">
<div class="container-fluid">
<nav class="pull">
<ul class="nav">
<li> Home</li>
<li> About</li>
<li>Popular Places<span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span></li>
<ul class="nav-sub">
<li>Place 1</li>
<li>Place 2</li>
<li>Place 3</li>
</ul>
<script>
$( "li a.menu" ).click(function() {
$( "ul.nav-sub" ).slideToggle( 300, function() {
// Animation complete.
});
});
</script>
<li> Events</li>
<li> Mail us</li>
</ul>
</nav>
</div>
</div>
<div class="header-top">
<div class="container">
<div class="head-logo">
<span>M</span>y Trip Planner<i>Feeling Amazing Tour</i>
</div>
<div class="top-nav">
<div class="hero fa-navicon fa-2x nav_slide_button" id="hero">
<img src="images/menu.png" alt="">
</div>
</div>
<div class="clearfix"> </div>
</div>
</div>
</div>
<!-- banner -->
<!-- sign-in -->
<div class="sign-in">
<div class="container">
<div class="in-form">
<h3>Register Here</h3>
<p class="use">Having hands on experience in creating innovative
designs,I do offer design solutions which harness.</p>
<div class="sign-in-form">
<div class="in-form Personal">
<h4>Personal Information</h4>
<form method="post" name='registration' onSubmit="return formValidation();">
<input type="text" placeholder="Firstname*" required=" " name="first">
<input type="text" placeholder="Lastname*" required=" " name="last">
<input type="text" placeholder="Emailaddress*" required=" " name="uemail">
<h4 class="kij">Login Information</h4>
<input type="text" placeholder="Id*" required=" " name="uid">
<input type="password" placeholder="Password*" required=" " name="passid">
<input type="password" placeholder="Confirm Password*" required=" ">
<input type="submit" value="submit">
</form>
</div>
</div>
</div>
</div>
</div>
<!-- //sign-in -->
<!-- footer-top -->
<div class="footer-top">
<div class="container">
<div class="col-md-3 footer-top-grid">
<h3>About <span> My Trip Planner</span></h3>
<p>Lets you plan the finest trips.</p>
</div>
<div class="col-md-3 footer-top-grid">
<h3>THE <span>TAGS</span></h3>
<div class="unorder">
<ul class="tag2">
<li>pool</li>
<li>gym</li>
<li>beach</li>
</ul>
<ul class="tag2">
<li>asian</li>
<li>thai</li>
<li>chinese</li>
<li>american</li>
</ul>
<ul class="tag2">
<li>theme park</li>
<li>wildlife</li>
<li>heritage</li>
</ul>
<ul class="tag2">
<li>shopping malls</li>
<li>local shops</li>
<li>boutiques</li>
</ul>
</div>
</div>
<div class="col-md-3 footer-top-grid">
<h3> User <span> Reviews</span></h3>
<ul class="twi">
<li>Location is close to empire state building and near bus stop. Staff was pleasant on check in.
<span></span></li>
<li>Outstanding food and service. Would return without hesitation.
<span></span></li>
<li>My wife and I love walking around and exploring cities. and New York is one of the few cities in USA you can enjoy doing that. SoHo has a great vibe about it, and we enjoyed walking around, grabbing a quick bite, and doing some shopping.
<span></span></li>
</ul>
</div>
<div class="col-md-3 footer-top-grid">
<h3> Popular <span> Destinations</span></h3>
<div class="flickr-grids">
<div class="flickr-grid">
<img src="images/minar.jpg" alt=" " class="img-responsive" />
</div>
<div class="flickr-grid">
<img src="images/bad.jpg" alt=" " class="img-responsive" />
</div>
<div class="flickr-grid">
<img src="images/kua1.jpg" alt=" " class="img-responsive" />
</div>
<div class="clearfix"> </div>
<div class="flickr-grid">
<img src="images/kua.jpg" alt=" " class="img-responsive" />
</div>
<div class="flickr-grid">
<img src="images/newyork.jpg" alt=" " class="img-responsive" />
</div>
<div class="flickr-grid">
<img src="images/can1.jpg" alt=" " class="img-responsive" />
</div>
<div class="clearfix"> </div>
</div>
</div>
<div class="clearfix"> </div>
</div>
</div>
<!-- //footer-top -->
<!-- footer -->
<div class="footer">
<div class="container">
<div class="footer-left">
<ul>
<li><i>M</i>y Trip Planner<span> |</span></li>
<!-- <li><p>The awesome agency. <span>0800 (123) 4567 // Australia 746 PO</span></p></li> -->
</ul>
</div>
<div class="footer-right">
<p>© 2017 My Trip Planner. All rights reserved | </p>
</div>
<div class="clearfix"> </div>
</div>
</div>
<!-- //footer -->
<!-- here stars scrolling icon -->
<script type="text/javascript">
$(document).ready(function() {
/*
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/
$().UItoTop({ easingType: 'easeOutQuart' });
});
</script>
<!-- //here ends scrolling icon -->
</body>
</html>
you have this error because you miss "}" at line 141:
if (isset($_POST['last'])) {
$lname = $_POST['last'];
Add a closing bracket to line 141, so that the code is:
if (isset($_POST['last'])) {
$lname = $_POST['last'];
}
I tested your code locally and this is what fixed the syntax error.
What IDE or text editor do you use to write your code? I would suggest you something what points out such simple mistakes. For example netbeans for php or php storm, netbeans is free, php storm is not. Both of these editors will show to you your mistakes like this.
Here i am trying to convert my html and css template in wordpress theme and i have four php files (1) index.php, (2) header.php, (3) feature.php and (4) footer.php.
In index.php files i am getting the other three files using function <?php get_header(); ?>, <?php get_feature (); ?>,<?php get_footer (); ?>.
Now on using function <?php get_header(); ?>,<?php get_footer (); ?> in index.php it shows the header and footer section but on including <?php get_feature (); ?> between header and footer it shows error indicating <?php get_feature (); ?>line saying "Fatal error: Call to undefined function get_feature() in C:\xampp\htdocs\Alvin Lemo\wordpress\wp-content\themes\alvinlimo\index.php on line 2" and does not show the feature section and footer section.
Below is what i have done
In index.php
<?php get_header (); ?>
<?php get_feature(); ?> <!--- Error Showing Line -->
<?php get_footer (); ?>
In header.php
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<!--- Basic Page Needs
================================================== -->
<meta charset="utf-8">
<title>Alvin Lemo</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Mobile Specific Metas
================================================== -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Abel" rel="stylesheet">
<!-- Script
================================================== -->
<script src="js/modernizr.js"></script>
<!-- Favicons
================================================== -->
<link rel="shortcut icon" href="favicon.png" >
<?php wp_head (); ?>
</head>
<body>
<div id="myNav" class="overlay">
×
<div class="overlay-content">
<div class="container">
<h2 style="color:white">Please Login To Resere Your Fleet With Us</h2><br />
<form>
<div class="form-group">
<input class="form-control" id="email" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter email"><br /><br />
</div>
<div class="form-group">
<input class="form-control" id="pwd" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter password"><br /><br />
</div>
<div class="checkbox">
</div>
<button type="submit" class="btn btn-default">Rserve</button>
</form>
</div>
</div>
</div>
<div id="myNavv" class="overlay">
×
<div class="overlay-content">
<div class="container">
<h2 style="color:white">Please Register To Reserve Your Fleet </h2><br />
<form>
<div class="form-group">
<input class="form-control" id="email" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter FullName"><br /><br />
</div>
<div class="form-group">
<input class="form-control" id="email" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter email"><br /><br />
</div>
<div class="form-group">
<input class="form-control" id="pwd" style="width:50%;height:40px;color:black;border-radius:4px;font-size:18px" placeholder="Enter password"><br /><br />
</div>
<button type="submit" class="btn btn-default">Register</button>
</form>
</div>
</div>
</div>
<!-- Header
================================================== -->
<header>
<div class="logo">
<a class="smoothscroll" href="#hero"><!--<img alt="" src="images/logo.png">-->
<h2>A.L.S</h2>
</a>
</div>
<nav id="nav-wrap">
<a class="mobile-btn" href="#nav-wrap" title="Show navigation">Show Menu</a>
<a class="mobile-btn" href="#" title="Hide navigation">Hide Menu</a>
<ul id="nav" class="nav">
<li><a class="smoothscroll" href="#features">EVENT TRANSPORTATION</a></li>
<li><a class="smoothscroll" href="#pricing">Services</a></li>
<li><a class="smoothscroll" href="#screenshots">OUR FLEET</a></li>
<li><a class="smoothscroll" href="#testimonials">Testimonials</a></li>
<li><a class="smoothscroll" href="#subscribe">CONTACT</a></li>
</ul> <!-- end #nav -->
</nav> <!-- end #nav-wrap -->
<ul class="header-social">
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-google-plus"></i></li>
</ul>
</header>
<!-- Header End -->
<!-- Homepage Hero
================================================== -->
<section id="hero">
<div class="row">
<div class="twelve columns">
<div class="hero-text">
<br /><br /><br />
<h1 class="responsive-headline">Welcome To Alvin's Limo</h1>
<p>
Little about alivin's limo services.
</p>
</div>
<br />
<div class="buttons">
<a class="button trial" onclick="openNav()">Reserve Fleet</a>
<a class="button learn-more smoothscroll" onclick="openNavv()">Register</a>
</div>
<br /><br /><br /><br /><br /><br /><br />
</div>
</div>
</section>
<!-- Homepage Hero end -->
In feature.php
<!-- Features Section
================================================== -->
<section id='features'>
<div class="row section-head">
<h1>EVENT TRANSPORTATION</h1>
<p>
We Fell Happy To Be Part Of Your Special Ocassion
</p>
</div>
<div class="row feature design">
<div class="six columns right">
<h3> Wedding Transporation</h3>
<p>LMake your "most memorable day" of your life more special by Alvin Wedding Limo Service.
Your weddings transportation will be most beautiful latest model limousine imaginable,
with all the special amenities you desire. Our chauffeurs are always on time, courteous,
and dressed in black suit. Let us take you to the church and from the church to the reception and
from the reception to the airport or any special place in Texas for your honeymoon. You don't need
to worry about coordinating transportation from each destination, we can help arrange your weddings
party pick-ups and drop-offs and everything in between. We do service all the hills country wedding
venues. Feel free to check our wedding reviews - WEDDINGWIRE-THE KNOTT.
</p>
</div>
<div class="six columns feature-media left">
<img src="images/fpt-112704-Wedding-Flowers.jpg" />
</div>
</div>
<div class="row feature responsive">
<div class="six columns left">
<h3>Wine Transportation.</h3>
<p>
Alvin Limousine Services share your passion for wine; that’s why we specialize in hills country
wine tours. We offer a diverse selection of vehicles ranging from sedans, stretch limousines to
transport you affordably in luxury, safety, and style! Leave the driving, directions, stress,
and traffic to us while our Chauffeur whisks you away to your perfect day!
Our impressive customer list is concrete evidence of our ability to outperform our competition,
consistently exceeding our customers’ expectations. We will make your tour the best tour you have
ever known. We have dedicated chauffeur that specialize in wine tours, Brewery and Vodka distillery.
</p>
</div>
<div class="six columns feature-media right">
<img src="images/wine-tours-preferrred-limo.jpg" />
</div>
</div>
<div class="row feature cross-browser">
<div class="six columns right">
<h3>Concert</h3>
<p>
Whether you want to see a Show, Concert, Opera, Symphony or any other fun thing you can think of,
Alvin Limos will provide you personal and reliable chauffeured Limousine.
Reserve luxury town car Sedan or our luxurious stretch limousine for hassle free ride
from navigation, traffic, and struggling the multitude of cars for parking. Roll up with
style to the front door of any events location you desire.
Let the professional Chauffeurs of Alvin Limousine Service take you to your next Concert,
Movie premier, Opera, Symphony or any night out events with comfort and style.
We get you there on time in safely and in style ; Alvin Limo will ensure you have the time of
your life. We are the Leader in providing a full Service Limousine Transportation.
</p>
</div>
<div class="six columns feature-media left">
<img src="images/thenextweb.jpg" />
<!--<img src="images/feature-image-3.png" alt="" />-->
</div>
</div>
<div class="row feature video">
<div class="six columns left">
<h3>ACL/SXSW/Austin 360</h3>
<p>
What you hear is true. With vibrant entertainment and culture, inspiring cuisine and stunning outdoor settings, Austin lets you create a soundtrack all your own. We're home to more than 250 music venues and a vibrant arts scene. So take a look around, and put Live Music Capital of the World® on your playlist. Whether you want to take ride thought Austin or plan a night out with friends and family we will do that in style. Alvin Limousine is a premier transportation when it comes to Austin Texas culture and events. Come one come all and let us drive though the ins and outs of this beautiful happening city.
Alvin Limousine staff are very discrete and confident with all our celebrities and movies stars that we have been transporting for years.
</p>
</div>
<div class="six columns feature-media right">
<img src="images/1ff7f709cd8ef280ec5f2b317f79ba14-2b32e6b5be7f48f4557299fc9db819c3.png" />
</div>
</div>
<div class="row feature cross-browser">
<div class="six columns right">
<h3>Convention Center</h3>
<p>
The Austin Convention Center, a premier facility located in the heart of the capital city’s downtown business district, has emerged as a leader in the convention and meeting industry.
Alvin’s Limousine Services is proud to be part of your success by providing you or your guests with a premier chauffeured services . We can accommodate small or large groups .
- Airport Transportations
- Shuttling your groups through out your meetings
- Advertising your business on our Cars. (Wrap the cars with your Logo or new Product.**Extra Fees apply)
</p>
</div>
<div class="six columns feature-media left">
<img src="images/ARATA_ISOZAKI_RHWL_QNCC_DOHA_QATAR_PAN_060313_0009.jpg" />
</div>
</div>
<div class="row feature responsive">
<div class="six columns left">
<h3>Circuits of America - Formula 1</h3>
<p>
Circuit Of The Americas is a multi-purpose facility that will host the most prestigious racing events in the world, including the Formula 1 United States Grand Prix. It is the first purpose-built Grand Prix facility in the U.S Austin Texas
Circuit of The Americas (COTA) in Austin, Texas, is the home of world championships and a world-class destination for premium sports and entertainment.
Alvin’s Limousine Services is proud to be the leading transportations in Austin Texas, we can provide you or your Guests with many VIP Packages that can suits your needs , from Town car service , SUV’s or Stretch Limousine ,we are your one stop solutions to your transportations for World-Class destination . For International reservations , Please use our 24/7 reservations systems for quick quote and complete reservation confirmed within one hour or you can
Skpe us at : Austinlimo
</p>
</div>
<div class="six columns feature-media right">
<img src="images/bQwIzE.jpg" />
</div>
</div>
<div class="row feature cross-browser">
<div class="six columns right">
<h3>Prom</h3>
<p>
Whether you want to see a Show, Concert, Opera, Symphony or any other fun thing you can think of, Alvin Limos will provide you personal and reliable chauffeured Limousine. Reserve luxury town car Sedan or our luxurious stretch limousine for hassle free ride from navigation, traffic, and struggling the multitude of cars for parking. Roll up with style to the front door of any events location you desire.
Let the professional Chauffeurs of Alvin Limousine Service take you to your next Concert, Movie premier, Opera, Symphony or any night out events with comfort and style.
We get you there on time in safely and in style ; Alvin Limo will ensure you have the time of your life. We are the Leader in providing a full Service Limousine Transportation.
</p>
</div>
<div class="six columns feature-media left">
<img src="images/prom-header.jpg" />
</div>
</div>
</section>
<!-- Features Section end -->
In footer.php
<!-- Footer
================================================== -->
<footer>
<div class="row">
<div class="six columns right-cols">
<div class="row">
<div class="columns">
<h2 class="address">Come Visit</h2>
<p>
7901 Cameron Rd Bldg3 Suite 312, Austin tx 78754<br>
</p>
</div>
<div class="columns last">
<h2 class="contact">Contact Us</h2>
<ul>
<li>512 300 1379</li>
<li>someone#woosite.com</li>
</ul>
</div>
</div>
</div>
<p class="copyright">© 2014 Alvin's Limousine Services | Design by <a>cts-Design Team</a></p>
<div id="go-top">
<a class="smoothscroll" title="Back to Top" href="#hero"><i class="icon-up-open"></i></a>
</div>
</div> <!-- Row End -->
</footer>
<!-- Footer End-->
<?php wp_footer (); ?>
<!-- Java Script
================================================== -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2 /jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-1.10.2.min.js"><\/script>')</script>
<script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js">
</script>
<script src="js/jquery.flexslider.js"></script>
<script src="js/waypoints.js"></script>
<script src="js/jquery.fittext.js"></script>
<script src="js/jquery.fitvids.js"></script>
<script src="js/imagelightbox.js"></script>
<script src="js/jquery.prettyPhoto.js"></script>
<script src="js/main.js">
</script>
</body>
</html>
Functions like get_header() and get_footer() are predefined WordPress functions. To get custom part of template we use
<?php get_template_part( string $slug, string $name = null ) ?>
As stated in documentation, patterns it uses to find files are:
{slug}.php
{slug}-{name}.php
If the theme contains no specified file then no template will be included.
The template is included using require, not require_once, so you may include the same template part multiple times.
Finally, this one should load your feature template:
<?php get_template_part( 'feature' ) ?>
Source: https://developer.wordpress.org/reference/functions/get_template_part/
You try to use an undefined function, that is maybe coming from a third party plugin. get_feature() is not a native WordPress function.
If you want to display the featured image, you can use get_the_post_thumbnail() (more details
Hope it helps
Hi there I'm just trying to figure out how to check if a user is logged in and if so allow them to enter a page but if not simply return to 'index.php'.
What I've basically done is create duplicate pages of such as 'index.php', 'index2.php', 'service.php' and 'service2.php' so on and so forth with minor adjustments such as no 'search bar'.
Is it still possible to do so? I'd like the 'Check to see if logged in' on pages with '2' in them. Such as 'service2.php' or 'about2.php'
I've tried it with this code
(Keep in mind this is just the code not my whole entire page)
if(check_login()) {
echo 'You are in!';
} else {
header('Location: login.php');
exit;
}
function check_login () {
if(isset($_SESSION['login'] && $_SESSION['login'] != '') {
return true;
} else {
false;
}
}
Only used this code on pages that I want it to be displayed
Thanks in advance ! :)
UPDATE EDIT:
<?php
include ('config.php');
include ('function.php');
$_SESSION['login']
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Honda | </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--slider-->
<link href="../css/camera.css" rel="stylesheet" type="text/css" media="all" />
<script type='text/javascript' src='../js/jquery.min.js'></script>
<script type='text/javascript' src='../js/jquery.mobile.customized.min.js'></script>
<script type='text/javascript' src='../js/jquery.easing.1.3.js'></script>
<script type='text/javascript' src='../js/camera.min.js'></script>
<script>
jQuery(function(){
jQuery('#camera_wrap_1').camera({
thumbnails: true
});
jQuery('#camera_wrap_2').camera({
height: '400px',
loader: 'bar',
pagination: false,
thumbnails: true
});
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li class="active"><span>Home</span></li>
<li><span>About</span></li>
<li class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
</ul>
<div class="search">
<h2>search</h2>
<form action="search.php" method="get">
<input type="text" name="search" value="" placeholder="Enter Your search...">
<input type="submit" name="submit" value="">
</form>
</div>
<div class="search1">
<h2>login/Register</h2>
<form action="" method="POST">
<label>Username:</label>
<input type="text" id="password" name="username" required />
<label>Password:</label>
<input type="password" id="password" name="password" required />
<input type="submit" value="Login" name="submit" class="submit" />
<br><br>
<center>
<h2><p>Register</p></h2>
</center>
</form>
</div>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['username']) && !empty($_POST['password'])) {
$username=$_POST['username'];
$password=$_POST['password'];
$password = strip_tags($password);
$password = md5($password); // md5 is used to encrypt your password to make it more secure.
$con=mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('aha') or die("cannot select DB");
$query=mysql_query("SELECT * FROM login WHERE username='".$username."' AND password='".$password."'");
$numrows=mysql_num_rows($query);
if($numrows!=0)
{
while($row=mysql_fetch_assoc($query))
{
$dbusername=$row['username'];
$dbpassword=$row['password'];
}
if($username == $dbusername && $password == $dbpassword)
{
session_start();
$_SESSION['sess_user']=$username;
/* Redirect browser */
header("Location: member.php");
}
} else {
echo "<div class='results'>Invalid username or password</div>";
}
} else {
echo "All fields are required!";
}
}
?>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start slider -->
<div class="slider_bg">
<div class="wrap">
<div class="wrapper">
<div class="slider">
<!-- #camera_wrap_1 -->
<div class="fluid_container">
<div class="camera_wrap camera_azure_skin" id="camera_wrap_1">
<div data-thumb="../images/thumbs/slider1.jpg" data-src="../images/slider/slider1.jpg">
</div>
<div data-thumb="../images/thumbs/slider2.jpg" data-src="../images/slider/slider2.jpg">
</div>
<div data-thumb="../images/thumbs/slider3.jpg" data-src="../images/slider/slider3.jpg">
</div>
<div data-thumb="../images/thumbs/slider4.jpg" data-src="../images/slider/slider4.jpg">
</div>
</div><!-- #camera_wrap_1 -->
<div class="clear"></div>
</div>
<!-- end #camera_wrap_1 -->
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<!-- start content_right -->
<div class="image group">
<div class="grids_of_2">
<div class="grid images_3_of_1">
<img src="../images/pic1.jpg">
</div>
<div class="grid span_2_of_3">
<h3>How it all started</h3>
<p class="para">Honda Motor Co., Ltd. (本田技研工業株式会社 Honda Giken Kōgyō KK?, IPA: [hoɴda] ( listen); /ˈhɒndə/) is a Japanese public multinational corporation primarily known as a manufacturer of automobiles, motorcycles and power equipment.
Honda has been the world's largest motorcycle manufacturer since 1959,[3][4] as well as the world's largest manufacturer of internal combustion engines measured by volume, producing more than 14 million internal combustion engines each year.[5] Honda became the second-largest Japanese automobile manufacturer in 2001.[6][7] Honda was the eighth largest automobile manufacturer in the world behind General Motors, Volkswagen Group, Toyota, Hyundai Motor Group, Ford, Nissan, and PSA in 2011.[8]
Honda was the first Japanese automobile manufacturer to release a dedicated luxury brand, Acura, in 1986. Aside from their core automobile and motorcycle businesses, Honda also manufactures garden equipment, marine engines, personal watercraft and power generators, amongst others. Since 1986, Honda has been involved with artificial intelligence/robotics research and released their ASIMO robot in 2000. They have also ventured into aerospace with the establishment of GE Honda Aero Engines in 2004 and the Honda HA-420 HondaJet, which began production in 2012. Honda has three joint-ventures in China (Honda China, Dongfeng Honda, and Guangqi Honda).
In 2013, Honda invested about 5.7% (US$ 6.8 billion) of its revenues in research and development.[9] Also in 2013, Honda became the first Japanese automaker to be a net exporter from the United States, exporting 108,705 Honda and Acura models while importing only 88,357</p>
</div>
<div class="clear"></div>
</div>
<div class="grids_of_2 top">
<div class="grid images_3_of_1">
<img src="../images/pic2.jpg">
</div>
<div class="grid span_2_of_3">
<h3>CEO of Honda</h3>
<p class="para">Kawamoto acted quickly to change Honda's corporate culture, rushing through market-driven product development that resulted in recreational vehicles such as the Odyssey[disambiguation needed] and the CR-V, and a refocusing away from some of the numerous sedans and coupes that were popular with Honda's engineers but not with the buying public. The most shocking change to Honda came when Kawamoto ended Honda's successful participation in Formula One after the 1992 season, citing costs in light of the takeover threat from Mitsubishi as well as the desire to create a more environmentally-friendly company image.[21]
Later, 1995 gave rise to the Honda Aircraft Company with the goal of producing jet aircraft under Honda's name</p>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</center>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="copy">
<p class="w3-link">© </p>
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
</body>
</html>
You are missing a paranthesis in the isset in the check login function, also the function could be made simpler.
// I'd also put this function in some common file.
function check_login() {
return isset($_SESSION['login']) && $_SESSION['login'] != '';
}
// then in all other files you could include the common file, and do this
if (!check_login()) {
header('Location: login.php');
exit;
}
The best experience in this case will be to put check_login into smth like functions.php and insert this in files where you want to use it:
include "functions.php";
if(!check_login()) {
header('Location: login.php');
exit();
}
You can also try using Apache's native module mod_rewrite to handle large amount of such suffixed files.
I am new to php and sqlite and wanted to make a form that inserts everything there into the database.
This is my contact.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>G6 Mall | Contact</title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
<link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
<link rel="stylesheet" href="css/style.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.5.2.js" ></script>
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/cufon-replace.js"></script>
<script type="text/javascript" src="js/Terminal_Dosis_300.font.js"></script>
<script type="text/javascript" src="js/atooltip.jquery.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<style type="text/css">.bg {behavior:url("js/PIE.htc")}</style>
<![endif]-->
</head>
<body id="page6">
<div class="body1">
<div class="body2">
<div class="body3">
<div class="main">
<!-- header -->
<header>
<div class="wrapper">
<h1></h1>
<form id="search" action="#" method="post">
<div>
<input type="submit" class="submit" value="">
<input class="input" type="text" value="Site Search" onBlur="if(this.value=='') this.value='Site Search'" onFocus="if(this.value =='Site Search' ) this.value=''">
</div>
</form>
<nav>
<ul id="menu">
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>Directory</li>
<li>News</li>
<li id="active" class="end">Contact</li>
</ul>
</nav>
</div>
</header>
<!-- / header-->
<!-- content -->
<section id="content">
<div class="wrapper">
<h2>General Enquiry Form</h2>
<form id="FeedbackForm" action="post.php" method="post">
<div>
<div class="wrapper"> <span>Name:</span>
<input type="text" class="input" name="NAME">
</div>
<div class="wrapper"> <span>Contact:</span>
<input type="text" class="input" name="CONTACT">
</div>
<div class="wrapper"> <span>E-mail:</span>
<input type="text" class="input" name="EMAIL">
</div>
<div class="textarea_box"> <span>Message: (50char)</span>
<textarea name="COMMENT" cols="1" rows="1"></textarea>
</div>
<input type="submit" name="update" value="update">
<!--<span> </span> Clear Send </div>-->
</form>
</div>
</section>
</div>
</div>
</div>
</div>
<div class="body4">
<div class="main">
<section id="content2">
<div class="wrapper">
<div style="text-align: center;">
<h2>Where are we located at? </h2>
<strong>Lot-6 G6 Street, Wollongong, 6666 NSW</strong>
<p><!--spacing between the headers-->
</div>
<div class="line3 wrapper">
<article class="col2">
<h2>G6 Card privileges+ </h2>
<div class="pad"> <span class="col3"> <strong>
Telephone:<br>
Email: </strong> </span>
+614 1234 6666<br>
g6card#g6.com </div>
</article>
<article class="col2">
<h2>Customer Service Centre </h2>
<div class="pad"> <span class="col3"> <strong>
Telephone:<br>
Email: </strong> </span>
+614 1234 5555<br>
custserv#g6.com </div>
</article>
<article class="col2">
<h2>Advertisement & Promotion</h2>
<div class="pad"> <span class="col3"> <strong>
Telephone:<br>
Fax No:<br>
Email: </strong> </span>
+614 1234 7777<br>
+614 1234 1212<br>
adsPromo#g6.com </div>
</article>
<article class="col2">
<h2>Leasing</h2>
<div class="pad"> <span class="col3"> <strong>
Telephone:<br>
Fax No:<br>
Email: </strong> </span>
+614 7728 8878<br>
+614 7726 8869<br>
leasing#g6.com </div>
</article></div>
</div>
</section>
</div>
</div>
<!-- / content -->
<div class="main">
<!-- footer -->
<footer>
<div class="wrapper"> <span class="left"> Copyright © G6. All Rights Reserved<br>
Design by LM-02</a><br>
</span>
<ul id="icons">
Connect with us: <br>
<li><img src="images/icon1.png" alt=""></li>
<li><img src="images/icon4.png" alt=""></li>
</ul>
</div>
<!-- {%FOOTER_LINK} -->
</footer>
<!-- / footer -->
</div>
</body>
</html>
Then i made a post.php and put this code down
<?php
$NAME = sqlite_escape_string($_POST['NAME']);
$CONTACT = sqlite_escape_string($_POST['CONTACT']);
$EMAIL = sqlite_escape_string($_POST['EMAIL']);
$COMMENT = sqlite_escape_string($_POST['COMMENT']);
class MyDB extends SQLite3
{
function __construct()
{
$this->open('final_mall_management_system.db');
}
}
$db = new MyDB();
if(!$db){
echo $db->lastErrorMsg();
} else {
echo "Opened database successfully\n";
}
$sql =<<<EOF
INSERT INTO Enquiry (Name,Contact,Email,Comment)
VALUES ( '$NAME', '$CONTACT', '$EMAIL', '$COMMENT' );
EOF;
$ret = $db->exec($sql);
if(!$ret){
echo $db->lastErrorMsg();
} else {
echo "Records created successfully\n";
}
$db->close();
?>
When I entered the data in the form and click the submit it doesn't work I get this instead
open('final_mall_management_system.db'); } } $db = new MyDB(); if(!$db){ echo $db->lastErrorMsg(); } else { echo "Opened database successfully\n"; } $sql =<<exec($sql); if(!$ret){ echo $db->lastErrorMsg(); } else { echo "Records created successfully\n"; } $db->close(); ?>
I have no idea what I'm doing wrong. Could anyone please help me?
<section id="content">
<div class="wrapper">
<h2>General Enquiry Form</h2>
<form id="FeedbackForm" action="post.php" method="post">
<div>
<div class="wrapper"> <span>Name:</span>
<input type="text" class="input" name="NAME">
</div>
<div class="wrapper"> <span>Contact:</span>
<input type="text" class="input" name="CONTACT">
</div>
<div class="wrapper"> <span>E-mail:</span>
<input type="text" class="input" name="EMAIL">
</div>
<div class="textarea_box"> <span>Message: (50char)</span>
<textarea name="COMMENT" cols="1" rows="1"></textarea>
</div>
<input type="submit" name="update" value="update">
<!--<span> </span> Clear Send </div>-->
</form>
</div>
</section>
Is the main section of the "form" html code from the whole code (content.html) that i showed above.
Change remove EOF thing and use double quotes for your sql, I think that's the problem.
$sql ="INSERT INTO Enquiry (Name,Contact,Email,Comment)
VALUES ( '$NAME', '$CONTACT', '$EMAIL', '$COMMENT' )";
most likely you redefined constructor to SQLite3 class itself.
http://www.php.net/manual/en/language.oop5.decon.php
try changing
function __construct() {
$this->open('final_mall_management_system.db');
}
to
function __construct() {
parent::__construct();
$this->open('final_mall_management_system.db');
}
I started doing my school project and learning bootstrap basics but i have one problem with php code. I dont know how to delete this row in code.
http://imgur.com/LP0U9CK (or see below)
That red box.
As you can see in properties there is " ". When i delete it, row disappear. My index.php :
http://pastebin.com/K9GEF5mb (or see below):
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ryby.sk</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href = "css/bootstrap.min.css" rel = "stylesheet">
<link href = "css/style.css" rel = "stylesheet">
</head>
<body>
<div id="kontajner">
<?php
include("header.php");
?>
<div id="body">
<div class= "container" >
<div class="jumbotron" id="na_stred">
<h1>Vitajte na stránke www.ryby.sk</h1>
<p>Stránka je hlavne zameraná na informácie o sladkovodných rýbach.</p>
</div>
</div>
<div class= "container">
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">
<div class="page-header">
<h2> Akvaristika </h2>
</div>
<p> gvfdgsdfghsf ghhfg hd gdgsdfghsf ghhfg hd gdgsdfghsf ghhfg hd gdgsdfghsf ghhfg hd gdgsdfghsf ghhfg hd gdgsdfghsf ghhfg hd g</p>
<p> Zdroj: lblablalb </p>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
<div class="navbar-inverse navbar-default navbar-bottom footer">
<div class="container">
<p class="navbar-text pull-left">Bezo production</p>
<a href="#contact" class=" navbar-btn btn-primary btn-lg disabled btn-sm pull-right" data-toggle="modal" role="button" >Napíšte nám</a>
</div>
</div>
</div>
</div>
</body>
</html>
Everything is OK, but when I add include("header.php"); than this row appears. Can you help me please? I am solving this problem for one week :(
There are two sources for the whitespace in your code. I have indicated them with XXX, and the one newline is indicated by Y in index.php.
In index.php:
<div id="kontajner">
XXXXXXXXXXXXXXXXXXXXXXXX<?php
include("header.php");
?>Y
XXXXXXXXXXXXXXXXXXXXXXXX<div id="body">
And in header.php:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<div class = "navbar navbar-inverse navbar-static-top">
You should keep in mind though, that whitespace does not matter in HTML.
UPDATE:
As #hanzo2001 points out, it's possible to include code as follows:
<div><?php echo "Hello!"; ?></div>
Or to demonstrate the principle more extremely:
<div><?php
if (1==1)
{
echo "Hello!";
}
?></div>
Both of which will render as:
<div>Hello!</div>