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>
Related
I have products page and each product has add to cart and more description button. more description is supposed to display extra description of the product ONLY. However, when it is clicked, it displays the extra description for a second and the page refreshes. I am focusing on the button only, so php can be ignored (unless it is the issue)
Here is the code for one of the products:
<?php
if (isset($_POST['insert']))
{
$xml = new DomDocument("1.0", "UTF-8");
$xml->load('products.xml');
$pimage = 'Images/zucchini.jpg';
$pname = 'Zucchini';
$pquantity = $_POST['p-quantity'];
$pprice = 1.76;
$rootTag = $xml->getElementsByTagName("root")->item(0);
$infoTag = $xml->createElement("info");
$imgTag = $xml->createElement("img", $pimage);
$nameTag = $xml->createElement("name", $pname);
$priceTag = $xml->createElement("price", $pprice);
$quantityTag = $xml->createElement("quantity", $pquantity);
$infoTag->appendChild($imgTag);
$infoTag->appendChild($nameTag);
$infoTag->appendChild($priceTag);
$infoTag->appendChild($quantityTag);
$rootTag->appendChild($infoTag);
$xml->save('products.xml');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="../css/bootstrap-grid.css">
<link rel="stylesheet" href="../css/bootstrap.css">
<link rel="stylesheet" href="../Main-Stylesheet.css">
<link rel="stylesheet" type="text/css" href="../AislesDesign.css">
<link rel="stylesheet" type="text/css" href="ProductPages.css">
<script src="../Refresh.js" async></script>
<script src="../productPages.js" async></script>
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
#more {display: none;}
</style>
</head>
<body>
<!-- header section -->
<nav class="nav_bar">
<a class="nav_logo" href="../index.php">
<img src="../Images/Logo.png">
</a>
<form class="search">
<input class="search_bar" type="search" placeholder="'Product'">
<button class="search_button" type="submit">Search</button>
</form>
<a class="cart_button" href="../ShoppingCart.php">
<div class="cart_circle">
<img src="../Images/cart-logo.png" />
</div>
</a>
</nav>
<div class="row menu h-100 col-12 nopadding sticky-top">
<div class="col-4 row text-center">
<div class="dropdown menuText">
<button class="dropbtn"><img class="dropdown-hamburger"src="../Images/hamburger-icon2.jpg" /><p class="nav-aisles">Aisles</p></button>
<div class="col-3 row dropdown-content">
Chicken
Meat
Pasta
Fruits
Vegetables
</div>
</div>
</div>
<div class="col-4 row menuText h-100">
Home
</div>
<div class="col-4 row menuText h-100">
<a>Locations</a>
</div>
</div>
<form method = "POST" action = "zucchiniProduct.php">
<div class="product-border">
<img class="images" name = "p-img" src="../Images/zucchini.jpg"
alt="Image of zucchini">
<div class="display">
<h3 class="product-name-zucchini" name = "p-name">Zucchini</h3>
<div class="moredescription_contain">
<p class="product-description">1 vegetable (approx. 320g)<span id="dots">...</span><span id="more">. Zucchini is a favourite vegetable for many people as it can be used in variety of dishes, especially during summer. It is very rich in vitamin C, folate and antioxidants and low in calories.</span></p>
</div>
<span class="product-price" name = "p-price"> $1.76</span>
<p class="product-quantity"> Quantity:
<input class="product-quantity-input" type="number" value="1" step="1" name = "p-quantity"></input>
</p>
<input type = "submit" name = "insert" value = "Add to Cart" class="button"></input>
</form>
<button onclick="clickDesc()" id="myBtn" class="button">More Description</button>
</div>
</div>
<script>
function clickDesc() {
var dots = document.getElementById("dots");
var moreText = document.getElementById("more");
var btnText = document.getElementById("myBtn");
if (dots.style.display === "none") {
dots.style.display = "inline";
btnText.innerHTML = "More Description";
moreText.style.display = "none";
} else {
dots.style.display = "none";
btnText.innerHTML = "Read less";
moreText.style.display = "inline";
}
}
</script>
<div class="col-12 row h-100 nopadding footer">
<div class="col-4 row footer-heading nopadding about">
<h2>About Us</h2>
Our Story
Blog
Customers
</div>
<div class="col-4 row footer-heading nopadding contact-form">
<h2>Customer Service</h2>
Contact Us
Terms and Conditions
Find a Store
FAQ
</div>
<div class="col-4 row footer-heading nopadding social-media">
<h2>Social Media</h2>
Instagram
Facebook
YouTube
Twitter
</div>
<div class="col-12 row nopadding">
<div class="col-2 footer-bottom footer">
© 2022 poeatry.com
</div>
<div class="col-5">
</div>
</div>
</div>
<!-- footer section -->
</body>
</html>
The issue is that you opened this div <div class="product-border"> and this div <div class="display"> inside the form tag and then you closed it outside the form tag, which was causing the issue. To fix this issue close these divs properly inside the form tag.
Here's the link to the fixed version of your code.
I'm making some php page : file_header.php, file_footer.php, file_index.php, and I load them all in the browser one by one, and the result is fine (as i want). But, the problem appears when i combine file_header.php and file_footer.php in file_index.php.
Here is the problem : there are two buttons in page file_header.php (these are bootstrap button), and i give my custom style to them, i want the buttons looks slim, so i give margin and padding attribute in the css style, and finally i load file_header.php in the browser normally (result is fine / as i want). But, when i combine file_header.php and file_footer.php in file_index.php these two buttons turns into the original bootstrap button (buttons looks fat).
why did it happen ?
<!-- This is file_header.php -->
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<title>Hello, world!</title>
<style>
.navbar{
background-color: #563d7c
}
.btn{
margin: 5px;
padding: 2px 50px;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<div class="collapse navbar-collapse" id="navbarNav">
<div class="navbar-nav ml-auto">
<button href="#" class="btn btn-outline-light">Login</button>
<button href="#" class="btn btn-outline-light active">Sign Up</button>
</div>
</div>
</div>
</nav>
</body>
</html>
<!-- This is file_footer.php -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<title>Page Title</title>
<style>
footer{
background-color: #f4f4f4;
}
.container{
padding: 20px;
}
</style>
</head>
<body>
<footer>
<div class="container">
<div class="row">
<div class="col d-flex justify-content-center">
<div class="row">
<div class="col">
<h5 class="text-muted">Service</h5>
<div class="row">
<div class="col">
<p>About Us</p>
</div>
</div>
</div>
</div>
</div>
<div class="col d-flex justify-content-center">
<div class="row">
<div class="col">
<h5 class="text-muted">Success Story</h5>
<div class="row">
<div class="col">
<p>Let Me See</p>
</div>
</div>
</div>
</div>
</div>
<div class="col d-flex justify-content-center">
<div class="row">
<div class="col">
<h5 class="text-muted">Help</h5>
<div class="row">
<div class="col">
<p>Terms and Condition</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
</body>
</html>
<!-- This is file_index.php -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<?php include 'file_header.php' ?>
<div>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
</div>
<?php include 'file_footer.php' ?>
</body>
</html>
I expected the style of every buttons element in the page file_index.php is fine (buttons looks slim / as i want).
OR
I expected the style of every page (file_header, file_footer, file_index) doesn't change at all
When you combine the header, main and footer in the index file, you need to make sure that you have everything just once. Meaning, the doctype, the style, the opening body tag, etc.
So, I'd restructure a little bit your code, your 'file_header' should contain all what's in the <head>, I'd create a separate 'file_nav.php' where your navigation code sits, remove all the wrapping content from the 'file_footer' and leave there only the footer code.
Somehow like this:
<!-- This is file_header.php -->
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<title>Hello, world!</title>
<style>
.navbar{
background-color: #563d7c
}
.btn{
margin: 5px;
padding: 2px 50px;
}
footer{
background-color: #f4f4f4;
}
.container{
padding: 20px;
}
</style>
</head>
<!-- This is file_nav.php -->
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<div class="collapse navbar-collapse" id="navbarNav">
<div class="navbar-nav ml-auto">
<button href="#" class="btn btn-outline-light">Login</button>
<button href="#" class="btn btn-outline-light active">Sign Up</button>
</div>
</div>
</div>
</nav>
<!-- This is file_footer.php -->
<footer>
<div class="container">
<div class="row">
<div class="col d-flex justify-content-center">
<div class="row">
<div class="col">
<h5 class="text-muted">Service</h5>
<div class="row">
<div class="col">
<p>About Us</p>
</div>
</div>
</div>
</div>
</div>
<div class="col d-flex justify-content-center">
<div class="row">
<div class="col">
<h5 class="text-muted">Success Story</h5>
<div class="row">
<div class="col">
<p>Let Me See</p>
</div>
</div>
</div>
</div>
</div>
<div class="col d-flex justify-content-center">
<div class="row">
<div class="col">
<h5 class="text-muted">Help</h5>
<div class="row">
<div class="col">
<p>Terms and Condition</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
<!-- This is file_index.php -->
<!doctype html>
<html lang="en">
<?php include 'file_header.php' ?>
<body>
<?php include 'file_nav.php' ?>
<div>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
<h2>My main content is here</h2>
</div>
<?php include 'file_footer.php' ?>
</body>
</html>
Your file_header.php and file_footer.php are entire HTML page structures. They should be partials of just the HTML markup you want to include in the place they are PHP "include"ed.
An example of file_header.php without the doctype, head, html tag, or body:
<style>
.navbar{
background-color: #563d7c
}
.btn{
margin: 5px;
padding: 2px 50px;
}
</style>
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<div class="collapse navbar-collapse" id="navbarNav">
<div class="navbar-nav ml-auto">
<button href="#" class="btn btn-outline-light">Login</button>
<button href="#" class="btn btn-outline-light active">Sign Up</button>
</div>
</div>
</div>
</nav>
The reason your styles are being overridden when file_footer.php is included is because you are again for the second time including the bootstrap CSS in a <link /> tag. Part of the cascading in CSS is that the last declared rule takes priority and so the second inclusion overrides your custom styles.
You should include your bootstrap <link /> tag in your file_index.php head only.
I'm currently having some issues with creating a webpage that's only accessible once a user has logged in.
I've looked through various threads here, but to no avail. Any help with this would be greatly appreciated.
Here's my code:
login.php
<?php
Include('connect.php');
if (isset($_REQUEST['Submit']))
{
if($_REQUEST['user_id']=="" || $_REQUEST['password']=="")
{
echo " Field must be filled";
}
else
{
$sql1= "select * from student where email= '".$_REQUEST['user_id']."' && password ='".$_REQUEST['password']."'";
$result=mysql_query($sql1)
or exit("Sql Error".mysql_error());
$num_rows=mysql_num_rows($result);
if($num_rows>0)
{
session_start($_SESSION['Login']);
Echo "You have logged in successfully";
header("Location: statistics.html");
}
else
{
echo "Wrong username or password.";
}
}
}
?>
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>PHP Login Form</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<div class="container">
<div class="row" style="margin-top:20px">
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
<form name="form_login" method="post" action="login.php" role="form">
<fieldset>
<h2>Please Sign In</h2>
<hr class="colorgraph">
<div class="form-group">
<input name="user_id" type="text" id="user_id" class="form-control input-lg" placeholder="Email Address">
</div>
<div class="form-group">
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="Password">
</div>
<span class="button-checkbox">
<button type="button" class="btn" data-color="info">Remember Me</button><!-- Additional Option -->
<input type="checkbox" name="remember_me" id="remember_me" checked="checked" class="hidden">
<hr class="colorgraph">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6">
<input type="submit" name="Submit" value="Login" class="btn btn-lg btn-success btn-block">
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
</body>
</html>
And statistics.html (Page that should only be accessible when logged in)
<?php
include ("login.php")
session_start();
if(!isset($_SESSION['Login']))
{
header("Location:login.php");
die();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Personal Website</title>
<link rel="stylesheet" href="../../CSS/stylesheetmain.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
</head>
<body>
<!--Navigation Bar-->
<div class="row">
<div class="darkgrey column col-md-8 col-md-offset-2 col-xs-12 col-s-12">
<nav class="navbar navbar-background-color">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"><!--Reference: Bootstrap, 2015. getbootstrap.com. [Online] Available at: http://getbootstrap.com/ [Accessed 01 April 2015]-->
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html"></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="active">Home</li><!--Edits made: Removed active button -->
<li>About Me</li>
<li>Blog</li>
<li>Contact Me</li>
<li>Login</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</div>
</div>
<div class="row">
<div class="navbarbottom column col-md-8 col-md-offset-2 col-xs-12 col-s-12"></div>
</div>
<!--Page Title-->
<div class="row">
<div class="title mediumbluetext col-md-8 col-md-offset-2 col-xs-0 col-s-0">
<center><h1>Statistics</h1></center>
</div>
</div>
<!--Main Body-->
<div class="row">
<!--Left Column Spacer-->
<div class="maintextleftbackground column col-md-2 col-xs-0 col-s-0">
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-52f8f8c0164b330f" async="async"></script>
</div>
<!--Middle Column-->
<div class="maintext80 column col-md-8 col-xs-12 col-s-8 col-s-offset-2"><br>
<div id="main-chart-container"></div>
<div id="breakdown-chart-container"></div>
<div id="embed-api-auth-container"></div>
<div id="view-selector-container"></div>
</div>
<!--Right Column Spacer-->
<div class="maintextrightbackground column col-md-2 col-xs-0 col-s-0">
</div>
</div>
<!--Footer Bar-->
<div class="row">
<div class="darkgrey column col-md-8 col-md-offset-2 col-xs-12 col-s-12">
<nav class="navbar-background-color">
<div class="container-fluid">
<p class="navbar-text navbar-right">SiteMap</p>
</div>
</nav>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
(function(w,d,s,g,js,fs){
g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(f){this.q.push(f);}};
js=d.createElement(s);fs=d.getElementsByTagName(s)[0];
js.src='https://apis.google.com/js/platform.js';
fs.parentNode.insertBefore(js,fs);js.onload=function(){g.load('analytics');};
}(window,document,'script'));
</script>
</body>
</html>
No matter what I try, I can't seem to get the code to work. The files are in the same directory as well.
Any help with this would be greatly appreciated.
A few things wrong here but you're on the right track.
You are VERY susceptible to SQL injection. Please read about it.
Your form uses POST so your PHP should use $_POST and not $_REQUEST
You cannot set a session variable by passing it through to session_start. You need to set the variable like so: $_SESSION['isLoggedIn'] = true.
You are echoing right before you issue a header command. You cannot output anything before redirecting.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have a problem, when I press submit in this form it doesn't do anything.
Its suposed to work because its code from a CMS, its the basic template.
If you need to look at my files i put here my skype to send you team viewer id and pass: javichuskater
You can see the error here: http://javiphp.byethost9.com/
This is the entire code of the index of the CMS:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Get Free Bitcoins and Shatoshis Instantly From Our Faucet Online Gana Bitcoins Gratis Instantaneamente Desde Nuestra Faucet">
<meta name="author" content="BTCS4Free.Com">
<meta name="keywords" content="Ganar dinero, Bitcoins Gratis, Bitcoin, RPG Bitcoin, What is Bitcoin, Free Bitcoin, Bitcoin Faucet, Free Coin, Free Cryptocurrency, Fast Bitcoins, FaucetBox Faucet" />
<style>#l3c3{position:fixed!important;position:absolute;top:2px;top:expression((t=document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)+"px");left:-2px;width:106%;height:104%;background-color:#FFCE85;opacity:.95;filter:alpha(opacity=95);display:block;padding:20% 0}#l3c3 *{text-align:center;margin:0 auto;display:block;filter:none;font:bold 14px Verdana,Arial,sans-serif;text-decoration:none}#l3c3~*{display:none}</style>
<div id="l3c3"><span>Please enable JavaScript!<br>[ BTCS4Free Webmaster ]</span></div><script>window.document.getElementById("l3c3").parentNode.removeChild(window.document.getElementById("l3c3"));(function(l,m){function n(a){a&&l3c3.nextFunction()}var h=l.document,p=["i","s","u"];n.prototype={rand:function(a){return Math.floor(Math.random()*a)},getElementBy:function(a,b){return a?h.getElementById(a):h.getElementsByTagName(b)},getStyle:function(a){var b=h.defaultView;return b&&b.getComputedStyle?b.getComputedStyle(a,null):a.currentStyle},deferExecution:function(a){setTimeout(a,2E3)},insert:function(a,b){var e=h.createElement("span"),d=h.body,c=d.childNodes.length,g=d.style,f=0,k=0;if("l3c3"==b){e.setAttribute("id",b);g.margin=g.padding=0;g.height="100%";for(c=this.rand(c);f<c;f++)1==d.childNodes[f].nodeType&&(k=Math.max(k,parseFloat(this.getStyle(d.childNodes[f]).zIndex)||0));k&&(e.style.zIndex=k+1);c++}e.innerHTML=a;d.insertBefore(e,d.childNodes[c-1])},displayMessage:function(a){var b=this;a="abisuq".charAt(b.rand(5));b.insert("<"+a+'><div class="well text-center" style="width:50%"><b>AD BLOCK DETECTED<br /><br />Please disable it for this site and reload the page.</b><br />BTCS4Free Faucet depends on the revenue from displaying adverts.</div> [ BTCS4Free Webmaster ]'+("</"+a+">"),"l3c3");h.addEventListener&&b.deferExecution(function(){b.getElementBy("l3c3").addEventListener("DOMNodeRemoved",function(){b.displayMessage()},!1)})},i:function(){for(var a="SponsorsAds,adBlock01,ads-300-250,bott_ad2,dlads,ifmSocAd,toptextad,ad,ads,adsense".split(","),b=a.length,e="",d=this,c=0,g="abisuq".charAt(d.rand(5));c<b;c++)d.getElementBy(a[c])||(e+="<"+g+' id="'+a[c]+'"></'+g+">");d.insert(e);d.deferExecution(function(){for(c=0;c<b;c++)if(null==d.getElementBy(a[c]).offsetParent||"none"==d.getStyle(d.getElementBy(a[c])).display)return d.displayMessage("#"+a[c]+"("+c+")");d.nextFunction()})},s:function(){var a={'pagead2.googlesyndic':'google_ad_client','js.adscale.de/getads':'adscale_slot_id','get.mirando.de/miran':'adPlaceId'},b=this,e=b.getElementBy(0,"script"),d=e.length-1,c,g,f,k;h.write=null;for(h.writeln=null;0<=d;--d)if(c=e[d].src.substr(7,20),a[c]!==m){f=h.createElement("script");f.type="text/javascript";f.src=e[d].src;g=a[c];l[g]=m;f.onload=f.onreadystatechange=function(){k=this;l[g]!==m||k.readyState&&"loaded"!==k.readyState&&"complete"!==k.readyState||(l[g]=f.onload=f.onreadystatechange=null,e[0].parentNode.removeChild(f))};e[0].parentNode.insertBefore(f,e[0]);b.deferExecution(function(){if(l[g]===m)return b.displayMessage(f.src);b.nextFunction()});return}b.nextFunction()},u:function(){var a="-ad1.,/ad-choices-,/ads620x60/ad,/adstop728.,/adtest/ad,/custom/ads,/layer-advert-,/public/ads/ad,/pubmatic_,/728x90b/ad".split(","),b=this,e=b.getElementBy(0,"img"),d,c;e[0]!==m&&e[0].src!==m&&(d=new Image,d.onload=function(){c=this;c.onload=null;c.onerror=function(){p=null;b.displayMessage(c.src)};c.src=e[0].src+"#"+a.join("")},d.src=e[0].src);b.deferExecution(function(){b.nextFunction()})},nextFunction:function(){var a=p[0];a!==m&&(p.shift(),this[a]())}};l.l3c3=l3c3=new n;h.addEventListener?l.addEventListener("load",n,!1):l.attachEvent("onload",n)})(window);</script>
<title>BTCS4Free - FreeBitcoins Instantly!</title>
<!-- Bootstrap Core CSS - Uses Bootswatch Flatly Theme: http://bootswatch.com/flatly/ -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/freelancer.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body id="page-top" class="index">
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#page-top">BTCS4Free.Com</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="hidden">
</li>
<li class="page-scroll">
Faucet
</li>
<li class="page-scroll">
About
</li>
<li class="page-scroll">
Contact
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<!-- Header -->
<header>
<div class="container">
<div class="row">
<div class="col-lg-12">
<img class="img-responsive" src="img/profile.png" alt="">
<div class="intro-text">
<span class="name">BTCS4Freep</span>
<hr class="star-light">
<span class="skills">Free BitCoins instantly!</span>
</div>
</div>
</div>
</div>
</header>
<!-- Portfolio Grid Section -->
<section id="faucet">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Faucet</h2>
<hr class="star-primary">
<div id="left">
<ul>
<?php foreach($data["user_pages"] as $page): ?>
<li><?php echo $page["name"]; ?></li>
<?php endforeach; ?>
</ul>
<?php echo $data["custom_left_ad_slot"]; ?>
<p>Possible rewards: <?php echo $data["rewards"]; ?></p>
</div>
<div id="center">
<h1><?php echo $data["name"]; ?></h1>
<h2><?php echo $data["short"]; ?></h2>
<p>Balance: <?php echo $data["balance"]." ".$data["unit"]; ?></p>
<?php if($data["error"]) echo $data["error"]; ?>
<?php switch($data["page"]):
case "disabled": ?>
FAUCET DISABLED. Go to admin page and fill all required data!
<?php break; case "paid":
echo $data["paid"];
break; case "eligible": ?>
<form method="POST" role="form">
<div>
<?php if(!$data["captcha_valid"]): ?>
<p class="alert alert-danger" role="alert">Invalid Captcha!</p>
<?php endif; ?>
</div>
<div>
<label for="address">Your address:</label> <input type="text" name="address" class="form-control" value="<?php echo $data["address"]; ?>">
</div>
<div>
<?php echo $data["captcha"]; ?>
<div class="text-center">
<?php
if (count($data['captcha_info']['available']) > 1) {
foreach ($data['captcha_info']['available'] as $c) {
if ($c == $data['captcha_info']['selected']) {
echo '<b>' .$c. '</b> ';
} else {
echo ''.$c.' ';
}
}
}
?>
</div>
</div>
<div>
<input type="submit" class="btn btn-primary btn-lg" value="Get reward!">
</div>
</form>
<?php break; case "visit_later": ?>
<p>You have to wait <?php echo $data["time_left"]; ?></p>
<?php break; case "user_page": ?>
<?php echo $data["user_page"]["html"]; ?>
<?php break; endswitch; ?>
</div>
<div id="right">
<?php echo $data["custom_right_ad_slot"]; ?>
<?php if($data["referral"]): ?>
<p>
Referral commission: <?php echo $data["referral"]; ?>%<br>
Reflink:<br>
<code><?php echo $data["reflink"]; ?></code>
</p>
<?php endif; ?>
</div>
Thanks for your help and time!
i have checked the link you have provided http://javiphp.byethost9.com/. it fires an ajax call to 'http://javiphp.byethost9.com/mail/contact_me.php' and return the response as 'No arguments Provided!'.
Ajax call is made by this script file <script src="js/contact_me.js"></script>
I think, it is stopping further proccess.
I'm having trouble with a user level system, I want to make different things appear based on if you are logged in or not and nothing I try has worked. I can echo a normal string just fine, but it I use an if statement to check user level I get nothing. I have a database with a sample user, and his user_level field is set to 1. The log in process is successful, here is what I have:
By the way, session_start(); is in the included base.php.
<!DOCTYPE html>
<html>
<?php
include "base.php";
?>
<head>
<title> Scenery Sample Site | Home</title>
<link href='http://fonts.googleapis.com/css?family=Lobster'
rel='stylesheet' type='text/css'>
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/main.css" rel="stylesheet">
</head>
<div class="nav">
<div class="container">
<ul class="pull-left">
<li>Home</li>
<li>About Us</li>
<li>Pricing</li>
<li>Feedback</li>
</ul>
<ul class="pull-right">
<?php
if($_SESSION['user_level'] = 1) {
echo $username;
}
?>
</ul>
</div>
</div>
<div class="jumbotron">
<div class="container">
<h1>Scenery for your favourite<br> destinations!</h1>
<p>Learn more about our products by clicking the link below.</p>
<p>Visit our product page.</p>
</div>
</div>
<div class="we-offer">
<div class="container">
<div class="col-md-4">
<h3>Custom Building Models!</h3>
<p>All of our scenery models are custom made by our developers.</p>
<p><a>More Details Here!</a></p>
</div>
<div class= "col-md-4">
<h3>State of The Art Texturing!</h3>
<p>All of our scenery textures are custom, and of the highest quality. You will have to make sure you're not watching real life.</p>
<p><a>More Details Here!</a></p>
</div>
<div class="col-md-4">
<h3>Moving Jet-ways!</h3>
<p>A lot of competitors remove the functionality of moving jetways that fsx comes with. Well guess what, we don't!</p>
<p><a>More Details Here!</a></p>
</div>
</div>
<div class="container">
<div class="col-md-4">
<div class= "thumbnail">
<img src="http://goo.gl/ZRT5E6">
</div>
</div>
<div class= "col-md-4">
<div class= "thumbnail">
<img src="http://goo.gl/KsocGR">
</div>
</div>
<div class="col-md-4">
<div class= "thumbnail">
<img src="http://goo.gl/3UfG97">
</div>
</div>
</div>
</div>
</html>
You don't check the string, you try to assign it.
Remember: With a single = you assign to a variable, you don't check it.
Your have to do it like this:
if($_SESSION["user_level"] == 1) {
echo "fancy fancy";
}
I'll assume the rest of this, including setting that session value is correct, and say:
You're not using the correct operator. use a double "=".
if($_SESSION['user_level'] == 1) {
echo $username;
}
You are assigning instead of checking, this should help:
<?php
if($_SESSION['user_level'] == 1) {
echo $username;
}
?>