php errors when logged out because of session user_id - php

I'm making a product details page, and on the product details page I'm having if functions to see if the $_SESSION user_id is the same as the $product user_id to echo something or not for example. When no user is logged in, I get alot of errors that it can't find the $session user_id. How can I solve this problem so when there is no user logged in it does the same as if the session user_id is wrong to the product user_id?
for example:
<?php if ( $_SESSION['user_id'] != $product["user_id"]): ?>
<h3>Email van de eigenaar:</h4>
<?php echo $userarray['email'];?>
<?php endif; ?>
</div>
So if the session user_id is wrong to the product user_id i want the same thing to happen when there is no $_SESSION user_id found which is echoing this: <?php echo $userarray['email'];?>
This is my whole details page:
<?php include_once ('templates/header.php'); ?>
<div class="all-content">
<div class="row">
<div class="col-lg-12 bg-warning" style="font-size:25px">
<!-- Maak variables voor gele balkje ingelogt of niet -->
<?php $overditcadeau = '<center>Over dit cadeau</center>'; ?>
<?php $mijncadeau = '<center>Mijn cadeau</center>'; ?>
<?php if ($_SESSION['user_id'] != $product["user_id"]) {
echo $overditcadeau;
} else {
echo $mijncadeau;
} ?>
</div>
</div>
<div class="container">
<br><br>
<?php $userarray = $this->db->get_Where('users', array('user_id'=>$product["user_id"]))->row_array(); ?>
<!-- Als het cadeau niet van de ingelogde gebruiker is laat email van de eigenaar van het cadeau zien -->
<?php if ( $_SESSION['user_id'] != $product["user_id"]): ?>
<h3>Email van de eigenaar:</h4>
<?php echo $userarray['email'];?>
<?php endif; ?>
</div>
<div class="container">
<div class="row">
<div class="overditcadeau" >
<div class="overditcadeau_foto">
<img src="<?php echo base_url(); ?>upload/<?php echo $product['product_foto']; ?>" id="cadeaufoto_overditcadeau">
</div>
<div class="overditcadeau_tekst1">
<h1> <div class="product_naam"> <?php echo $product['product_naam']; ?> </div> </h1>
<h3>Over dit cadeau</h3>
<div class="product_beschrijving"><?php echo $product['product_beschrijving']; ?> </div>
</div>
<div class="overditcadeau_tekst2">
<!--Als het cadeau niet van de ingelogde gebruiker is laat een button zien dat heet cadeau aanvragen -->
<div class="cadeau_aanvragen">
<?php if ( $_SESSION['user_id'] != $product["user_id"]): ?>
<button type="button" class="btn btn-default">Ik wil dit cadeau!</button>
<button onclick="myFunction()">Ik wil dit cadeau!</button>
<script>
function myFunction() {
alert("Uw cadeau aanvraag is geaccepteerd, Klik hier om een bericht naar de eigenaar van het cadeau te sturen.");
}
</script>
<?php endif; ?>
</div>
<!--Als het cadeau van de ingelogde gebruiker is laat een button zien dat heet cadeau bewerken-->
<div class="cadeau_bewerken">
<?php if ( $_SESSION['user_id'] == $product["user_id"]): ?>
<a class="btn btn-primary" href="<?php echo base_url() ?>/KdGwController/details_bewerken/<?php echo $product['product_id']; ?>"> Cadeau bewerken </a>
<?php endif; ?>
</div>
<br>
<div class="cadeau_verwijderen">
<?php if ( $_SESSION['user_id'] == $product["user_id"]): ?>
<a class="btn btn-primary" href="<?php echo base_url() ?>/Delete_ctrl/delete_product_id/<?php echo $product['product_id']; ?>"> Cadeau verwijderen </a>
<?php endif; ?>
</div>
<!--Als het cadeau van de ingelogde gebruiker is laat aantal geïnteresseerden zien-->
<div class="aantal_geinteresseerden">
<?php if ( $_SESSION['user_id'] == $product["user_id"]): ?>
<h4>Aantal geïnteresseerden:</h4>
<?php endif; ?>
</div>
<?php if ( $_SESSION['user_id'] != $product["user_id"]): ?>
<div class="aangeboden_door"> Aangeboden door:
<tr>
<td>
<a href="<?php echo base_url() . 'User/userdetails/'.$product['user_id']?>">
<?php echo $userarray['voornaam'];?>
</a>
</td>
</tr>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<div class="container">
<footer>
<p>© kadokado 2017, Inc.</p>
</footer>
<hr>
</div>
</div>
<div class="clearfix"></div>
<?php include_once ('templates/footer.php'); ?>

Use isset() to check variable is set or not.
Like below:-
if (isset($_SESSION['user_id']) && isset($product["user_id"]) && $_SESSION['user_id'] != $product["user_id"]) {
Note:- Do same for other variables too used on the page.
So the whole code need to be like below:-
<?php include_once ('templates/header.php'); ?>
<div class="all-content">
<div class="row">
<div class="col-lg-12 bg-warning" style="font-size:25px">
<!-- Maak variables voor gele balkje ingelogt of niet -->
<?php $overditcadeau = '<center>Over dit cadeau</center>'; ?>
<?php $mijncadeau = '<center>Mijn cadeau</center>'; ?>
<?php if (isset($_SESSION['user_id']) && isset($product["user_id"]) && $_SESSION['user_id'] != $product["user_id"]) {
echo $overditcadeau;
} else {
echo $mijncadeau;
} ?>
</div>
</div>
<div class="container">
<br><br>
<?php $userarray = $this->db->get_Where('users', array('user_id'=>$product["user_id"]))->row_array(); ?>
<!-- Als het cadeau niet van de ingelogde gebruiker is laat email van de eigenaar van het cadeau zien -->
<?php if (isset($_SESSION['user_id']) && isset($product["user_id"]) && $_SESSION['user_id'] != $product["user_id"]): ?>
<h3>Email van de eigenaar:</h4>
<?php echo $userarray['email'];?>
<?php endif; ?>
</div>
<div class="container">
<div class="row">
<div class="overditcadeau" >
<div class="overditcadeau_foto">
<img src="<?php echo base_url(); ?>upload/<?php echo $product['product_foto']; ?>" id="cadeaufoto_overditcadeau">
</div>
<div class="overditcadeau_tekst1">
<h1> <div class="product_naam"> <?php echo $product['product_naam']; ?> </div> </h1>
<h3>Over dit cadeau</h3>
<div class="product_beschrijving"><?php echo $product['product_beschrijving']; ?> </div>
</div>
<div class="overditcadeau_tekst2">
<!--Als het cadeau niet van de ingelogde gebruiker is laat een button zien dat heet cadeau aanvragen -->
<div class="cadeau_aanvragen">
<?php if (isset($_SESSION['user_id']) && isset($product["user_id"]) && $_SESSION['user_id'] != $product["user_id"]): ?>
<button type="button" class="btn btn-default">Ik wil dit cadeau!</button>
<button onclick="myFunction()">Ik wil dit cadeau!</button>
<script>
function myFunction() {
alert("Uw cadeau aanvraag is geaccepteerd, Klik hier om een bericht naar de eigenaar van het cadeau te sturen.");
}
</script>
<?php endif; ?>
</div>
<!--Als het cadeau van de ingelogde gebruiker is laat een button zien dat heet cadeau bewerken-->
<div class="cadeau_bewerken">
<?php if (isset($_SESSION['user_id']) && isset($product["user_id"]) && $_SESSION['user_id'] == $product["user_id"]): ?>
<a class="btn btn-primary" href="<?php echo base_url() ?>/KdGwController/details_bewerken/<?php echo $product['product_id']; ?>"> Cadeau bewerken </a>
<?php endif; ?>
</div>
<br>
<div class="cadeau_verwijderen">
<?php if (isset($_SESSION['user_id']) && isset($product["user_id"]) && $_SESSION['user_id'] == $product["user_id"]): ?>
<a class="btn btn-primary" href="<?php echo base_url() ?>/Delete_ctrl/delete_product_id/<?php echo $product['product_id']; ?>"> Cadeau verwijderen </a>
<?php endif; ?>
</div>
<!--Als het cadeau van de ingelogde gebruiker is laat aantal geïnteresseerden zien-->
<div class="aantal_geinteresseerden">
<?php if (isset($_SESSION['user_id']) && isset($product["user_id"]) && $_SESSION['user_id'] == $product["user_id"]): ?>
<h4>Aantal geïnteresseerden:</h4>
<?php endif; ?>
</div>
<?php if ( $_SESSION['user_id'] != $product["user_id"]): ?>
<div class="aangeboden_door"> Aangeboden door:
<tr>
<td>
<a href="<?php echo base_url() . 'User/userdetails/'.$product['user_id']?>">
<?php echo $userarray['voornaam'];?>
</a>
</td>
</tr>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<div class="container">
<footer>
<p>© kadokado 2017, Inc.</p>
</footer>
<hr>
</div>
</div>
<div class="clearfix"></div>
<?php include_once ('templates/footer.php'); ?>

Only way is to check if $_SESSION['user_id'] is set everywhere you are using this.
As a quick fix (if you have a lot of references to $_SESSION['user_id']), you can put to your second line:
if (empty($_SESSION['user_id'])) $_SESSION['user_id'] = -1;

Related

Include function to mail php smtp

I want send email to user with all elements it payed.
I tried the next:
First create a function called listItemsBought
function listItemsBought() {
$counter=0;
foreach ($_SESSION["shopping_cart"] as $product) { ++$counter; ?>
<div class="card overflow-hidden">
<div class="ribbon ribbon-top-right text-danger"><span class="bg-danger"><?php echo $product["PreuProducte2"]; ?> €</span></div>
<div class="card-body item-user">
<div class="profile-pic mb-0">
<div class="d-md-flex">
<img src="imatges/projectes/<?php echo $product["NomProducte2"]; ?>/Logo/<?php echo $product["IMGProducte2"]; ?>" class="w-150 h-150 br-2" alt="user">
<div class="ml-4">
<h4 class="mt-1 mb-1 font-weight-bold"><?php echo $product["NomProducte2"]; ?><small class="text-muted text-small fs-13 ml-2">para <?php echo $product["CategoriaProducte2"]; ?></small></h4>
<span class="text-gray"><?php echo $product["Descrip2"]; ?></span><br>
<span class="text-muted">version: 1.6</span><br>
<div class="rating-stars d-inline-flex mb-2 mr-3">
<input type="number" readonly="readonly" class="rating-value star" name="rating-stars-value" value="4">
<div class="rating-stars-container mr-2">
<div class="rating-star sm is--active">
<i class="fa fa-star"></i>
</div>
<div class="rating-star sm is--active">
<i class="fa fa-star"></i>
</div>
<div class="rating-star sm is--active">
<i class="fa fa-star"></i>
</div>
<div class="rating-star sm is--active">
<i class="fa fa-star"></i>
</div>
<div class="rating-star sm">
<i class="fa fa-star"></i>
</div>
</div> 4.0
</div>
<h6 class="mb-0">$ 250.00 Buy <i class="ti-medall fs-16 mr-2"></i>Add To wishlist</h6>
</div>
</div>
</div>
</div>
</div>
<?php
}
}
Then, I send Email to client via SMTP:
$output="
<table style=\"padding:15px 15px;background:#f4f4f4;width:100%;font-family:arial\" cellpadding=\"0\" cellspacing=\"0\">
<link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.8.1/css/all.css\" integrity=\"sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf\" crossorigin=\"anonymous\">
<tbody>
<tr>
<td>
<table style=\"max-width:540px;min-width:320px\" align=\"center\" cellspacing=\"0\">
<tbody>
<tr>
<td style=\"background:#fff;border:1px solid #d8d8d8;padding:30px 30px\" align=\"center\">
<table align=\"center\">
<tbody>
<tr>
<td style=\"border-bottom:1px solid #d8d8d8;color:#666;text-align:center;padding-bottom:30px\">
<table style=\"margin:auto\" align=\"center\">
<tbody>
<tr>
<td style=\"color:#005f84;font-size:22px;font-weight:bold;text-align:center;font-family:arial\">
ITEMS BOUGHTED
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style=\"color:#666;padding:15px;padding-bottom:0;font-size:14px;line-height:20px;font-family:arial;text-align:left\">
<div style=\"font-style:normal;padding-bottom:15px;font-family:arial;line-height:20px;text-align:left\">
<p> Hola <span style=\"font-weight:bold;color:#4296ce;font-size:16px\">$NomYCognom</span> <br>
<br>
You have completed payment on our website www.example.com </p>
<br>
<hr>
<br>
<b>You bought:<br></b>
$ItemsBoughted
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style=\"background:#f9f9f9;border:1px solid #d8d8d8;border-top:none;padding:15px 10px\" align=\"center\">
<table style=\"width:100%;max-width:650px\" align=\"center\">
<tbody>
<tr>
<td style=\"font-size:14px;line-height:20px;text-align:center;max-width:650px\">
<a style=\"text-decoration:none;color:#69696c\" target=\"_blank\">
<span style=\"color:#00ce00;font-weight:bold;max-width:180px\">BEST REGARDS:</span>
Payment System from <b>Example.com</b>
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table style=\"max-width:650px\" align=\"center\">
<tbody>
<tr>
<td style=\"color:#b4b4b4;font-size:11px;padding-top:10px;line-height:15px;font-family:arial\">
<span> </span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
";
// Indicamos que el Contenido del mensaje está en la variable $output
$body = $output;
// Indicamos que el Asunto del mensaje es "ESRP - Reinici de contrasenya"
$subject = "Example - Payed Completed";
// Indicamos que debe enviar este correo a la dirección del usuario
$email_to1 = "$Email";
// El Email del remitente que envia el mensaje es "noreply#esrp.net"
$fromserver = "noreply#example.com";
// Requiere este archivo para enviar este mensaje
require("assets/enviarCorreos/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
// --------------------------------------------------------------------------------------------------- //
// Introducimos las credenciales de nuestro servidor SMTP
// --------------------------------------------------------------------------------------------------- //
$mail->SMTPSecure = 'tls'; // Tipo de Conexión
$mail->Host = " "; // Host del servidor SMTP
$mail->SMTPAuth = true; // ¿El servidor SMTP requiere identificación? (true/false)
$mail->Username = " "; // Nombre usuario del servidor SMTP (normalmente es un Email)
$mail->Password = " "; // Contraseña usuario del servidor SMTP
$mail->Port = 587; // Puerto del servidor SMTP
$mail->IsHTML(true); // El formato del mensaje a enviar, ¿es HTML?
$mail->From = "no-reply#example.com"; // El Email del remitente que envia el mensaje es "noreply#esrp.net"
$mail->FromName = "Example"; // El Nombre del remitente que envia el mensaje es "esrp"
$mail->Sender = $fromserver;
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($email_to1);
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}
// Si no ocurre ningún error, se pone un Alert al usuario con el siguiente mensaje:
else{
// echo "Enviado";
}
I want show in variable $ItemsBoughted the results from function listItemsBought() where have list of items bought by client.
How I can do that?
In your first function create text string with all the html you need and return it.
function listItemsBought() {
$counter=0;
$html = ''; //edit made
foreach ($_SESSION["shopping_cart"] as $product)
{
++$counter;
$PreuProducte2 = $product['PreuProducte2'];
$NomProducte2 = $product['NomProducte2'];
$IMGProducte2 = $product['IMGProducte2'];
$product['NomProducte2'];
$CategoriaProducte2 = $product['CategoriaProducte2'];
$Descrip2 = $product['Descrip2'];
$html .= <<<EOD
<div class='card overflow-hidden'>
<div class='ribbon ribbon-top-right text-danger'><span class='bg-danger'>$PreuProducte2 €</span></div>
<div class='card-body item-user'>
<div class='profile-pic mb-0'>
<div class='d-md-flex'>
<img src='imatges/projectes/$NomProducte2/Logo/$IMGProducte2' class='w-150 h-150 br-2' alt='user'>
<div class='ml-4'>
<a href='userprofile.html' class='text-dark'><h4 class='mt-1 mb-1 font-weight-bold'>$NomProducte2<small class='text-muted text-small fs-13 ml-2'>para $CategoriaProducte2</small></h4></a>
<span class='text-gray'>$Descrip2</span><br>
<span class='text-muted'>version: 1.6</span><br>
<div class='rating-stars d-inline-flex mb-2 mr-3'>
<input type='number' readonly='readonly' class='rating-value star' name='rating-stars-value' value='4'>
<div class='rating-stars-container mr-2'>
<div class='rating-star sm is--active'>
<i class='fa fa-star'></i>
</div>
<div class='rating-star sm is--active'>
<i class='fa fa-star'></i>
</div>
<div class='rating-star sm is--active'>
<i class='fa fa-star'></i>
</div>
<div class='rating-star sm is--active'>
<i class='fa fa-star'></i>
</div>
<div class='rating-star sm'>
<i class='fa fa-star'></i>
</div>
</div> 4.0
</div>
<h6 class='mb-0'><a href='payments.html' class='btn btn-green font-weight-bold fs-14 mr-3'>$ 250.00 Buy</a> <a href='cart.html' class='btn btn-default font-weight-semibold text-green fs-14'><i class='ti-medall fs-16 mr-2'></i>Add To wishlist</a></h6>
</div>
</div>
</div>
</div>
</div>
EOD;
}
return $html;
}
Then in your second file just concatenate the function becasue it will return a string:
$output = " <sample html>" . listItemsBought() . "</sample html>

Getting database output correct way in block

I want to make a kind of forum with php (pdo) now I can get the data out of the database like you can see with the 2 items in the picture down below (de 2 dots with text) now I want the <H5> tagg to be the things on the dots but I have no clue how to do that.
What I want
<div class="col-md-6">
<div class="well dash-box">
<h2><span class="glyphicon glyphicon-stats" aria-hidden="true"></span> Inspiratie</h2>
<h5>Tips en inspiratie om jou en je business een boost te geven, dit kan van groot belang zijn.</h5>
</div>
</div>
<div class="col-md-6">
<div class="well dash-box">
<h2><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span> 12</h2>
<h5> hoi</h5>
<?php
$toppics = $app->get_topics();
$i = 4;
foreach ($toppics as $topic) {
echo '<li>' . $topic['onderwerp'] . '</li>';
}
?>
</div>
</div>
It takes the column "onderwerp" out of the database and I want those to be the <H5>tags

I need to take the e-mail from the login screen to come with me to go to the account page using session

So when a customer fills in their e-mail I would like to take that e-mail and use it to display their account information and orders. (Some stuff is in dutch, if you need something translated let me know). BTW first time posting let me know
<?php
session_start();
include("functies.php");
include("header.php");
?>
<link rel="stylesheet" href="styling.css" type="text/css"/>
<div align="center">
<?php logo() ?>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-offset-4 col-md-3">
<div class="form-login">
<form action="homepagina.php" method="post">
<div align="center"><h4>Welkom terug!</h4></div>
<p align ="left">E-mailadres*</p>
<input name="email" type="text" class="form-control input-sm chat-input" placeholder="Email" required>
</br>
<p align="left">Wachtwoord*</p>
<input type="password" class="form-control input-sm chat-input" placeholder="Wachtwoord" required>
</br>
<div class="wrapper">
<span class="group-btn">
Inloggen <i class="fa fa-sign-in"></i>
<br><br>Nog geen account? Maak er een aan
</span>
</div>
</form>
</div>
</div>
</div>
</div>
<?php
$_SESSION['email']=$_POST;
?>
**Next up the accountpage. **
<?php
session_start();
include("functieshomepagina.php");
include("header.php");
include("dbconnect.php");
$klantenmail = $_SESSION['email'];
var_dump($_SESSION);
$customer_ID_query = mysqli_query($conn, "SELECT id FROM customers WHERE customer_email = '$klantenmail' ");
$customer_ID=[];
while($row = mysqli_fetch_array($customer_ID_query)){
$customer_ID[] = $row;
}
//functie voor de account informatie van een specifieke klant voor de accountpagina
$klantenquery = mysqli_query($conn, "SELECT id, first_name, middle_name, last_name, customer_email FROM customers WHERE id = '{$customer_ID[0][0]}'");
$klanten=[];
while($row = mysqli_fetch_array($klantenquery)){
$klanten[] = $row;
}
//functie voor de account informatie van een specifieke klant voor de bestelling op de accountpagina
$bestellingquery = mysqli_query($conn, "SELECT id, date_placed, date_paid, total_price, customers_id FROM orders WHERE customers_id = '{$customer_ID[0][0]}'");
$bestelling=[];
while($row = mysqli_fetch_array($bestellingquery)){
$bestelling[] = $row;
}
?>
<div align="center">
<?php logo();?>
</div>
<div class="container-fluid well span6">
<div class="row-fluid">
<div class="span2" >
<img width ='200' src="http://localhost/Avatar_man.png" class="img-circle">
</div>
<div class="span8">
<h3><?php echo $klanten[0][1] ." ".$klanten[0][2] . " ".$klanten[0][3]?></h3>
<h6>Email: <?php echo $klanten[0][4] ?></h6>
<h6>Klanten nummer: <?php echo $klanten[0][0]?></h6>
<h6></h6>
</div>
</div>
</div>
<!--Begin van Bestellingen tabel-->
<link rel="stylesheet" href="styling.css" type="text/css"/>
<div class="container">
<div align="center">
<h2>Bestellingen</h2>
</div>
<table class="table table-hover table-bordered">
<thead class="thead-success">
<tr>
<th>Order ID</th>
<th>Datum plaatsen van bestelling</th>
<th>Datum van betaling</th>
<th>Totaal prijs</th>
</tr>
</thead>
<tbody>
<?php
foreach ($bestelling as $key => $value) {
?>
<tr>
<td><?php echo $value[0]?></td>
<td><?php echo $value[1]?></td>
<td><?php echo $value[2]?></td>
<td><?php echo "€ " . number_format($value[3],2)?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
Include("footer.php")
?>
**So when the customer enters their email I'd like to take that email using session to put it in at the accountpage. Ive seen several methods but it doesn't seem to be working. Any help would be appreciated. **
At the end of your HTML form you have:
$_SESSION['email']=$_POST
It needs to be:
$_SESSION['email']=$_POST['email']
and you need to move that line of code into homepagina.php in order for it to capture the session variable. Or you're trying to capture a variable that hasn't been submitted.
You need to reference the name of the input that you want to grab using POST.

I'm in need of assistance with this if/else statement

I'm doing a contact page for my site, the text is in Portuguese because I'm Brazilian, but my problem is the following: when I send parameters with ?resp=true it always enters in the first condition and I'm not able to figure out what is going wrong.
Why is the first condition met when the parameter is ?resp=true ? , here is the code that I currently have problems on:
<?php if (isset($_GET["resp"]) && $_GET["resp"] == false) { ?>
<div class="row row-centered" style="padding-top: 10px;">
<div class="alert alert-success">
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<strong style="text-align: center;">Sua mensagem foi enviada com sucesso.</strong>
</div>
</div>
<?php } elseif(isset($_GET["resp"]) && $_GET["resp"] == true) { ?>
<div class="row row-centered" style="padding-top: 10px;">
<div class='alert alert-danger'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<strong style="text-align: center;">Desculpe, parece que o servidor de email não esta respondendo. Por favor, tente novamente mais tarde!</strong>
</div>
</div>
<?php } ?>
All values recieved via the POST or GET methods (ie. in the REQUEST) are automatically seen as strings. So trying to check:
<?php
if($_GET['resp'] == true) {}
?>
will return false, and thus not enter the loop. What you want is to check the string value (instead of the boolean)
<?php
if($_GET['resp'] == 'true') {)
?>
You are actually trying to compare a string value to a boolean value. Since all that comes from form submit is in form of string only. So i have replaced boolean true and false with 'true' and 'false'
Try this code:
<?php if (isset($_GET["resp"]) && $_GET["resp"] == 'false') { ?>
<div class="row row-centered" style="padding-top: 10px;">
<div class="alert alert-success">
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<strong style="text-align: center;">Sua mensagem foi enviada com sucesso.</strong>
</div>
</div>
<?php } elseif(isset($_GET["resp"]) && $_GET["resp"] == 'true') { ?>
<div class="row row-centered" style="padding-top: 10px;">
<div class='alert alert-danger'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<strong style="text-align: center;">Desculpe, parece que o servidor de email não esta respondendo. Por favor, tente novamente mais tarde!</strong>
</div>
</div>
<?php } ?>

Wordpress: stylesheet.css only works on home page

I'm currently working on a custom built wordpress template for a customer. I've finished the homepage (http://www.spotutrecht.com/) and was about to add a new page (http://www.spotutrecht.com/spot-map/).
Now I have the following issue: The style.css only succesfully applies the styles to my homepage, but not to the "spot-map" page. I've referenced the stylesheet in the header.php and it a functioning link to the stylesheet apears in the head tag. I've clicked on it and it shows my stylesheet. Still, it does not apply the styles to my "spot-map" page.
I'm still new to template building, so maybe (and I hope) I am doing something very obvious wrong, but I can't figure out what it is.
My header.php:
<?php
/**
* The header for our theme.
*
* This is the template that displays all of the <head> section and everything up until <div id="content">
*
* #link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* #package Spot_Utrecht
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<!-- Bootstrap core CSS -->
<link href="<?php bloginfo('stylesheet_directory'); ?>/assets/css/bootstrap.min.css" rel="stylesheet">
<!-- Font Awesome Icons -->
<link href="<?php bloginfo('stylesheet_directory'); ?>/assets/css/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<!-- Google Fonts -->
<link href='http://fonts.googleapis.com/css?family=Raleway:400,500,600,700' rel='stylesheet' type='text/css'>
<!-- Stylehsheet.css -->
<link href="<?php echo get_template_directory_uri(); ?>/style.css" rel="stylesheet">
<?php wp_head(); ?>
<!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body <?php body_class(); ?>>
<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#content"><?php esc_html_e( 'Skip to content', 'spotutrecht' ); ?></a>
<div class="page-wrap">
<!-- HEADER
================================================== -->
<header class="site-header" role="banner">
<!-- NAVBAR
================================================== -->
<div class="navbar-wrapper">
<div class="navbar navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="social-buttons">
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
</div>
</div>
<?php
wp_nav_menu( array(
'theme_location' => 'primary',
'container' => 'nav',
'container_class' => 'navbar-collapse collapse',
'menu_class' => 'nav navbar-nav navbar-right'
) );
?>
</div><!-- container -->
</div>
</div>
</header>
My spot-map/crowdfunding page
<?php
/*
Template Name: Crowdfunding
*/
get_header(); ?>
<section id="spotbanner-otherpages">
<article>
<div class="container">
<div class="row">
<div class="col-sm-3">
</div>
<div class="col-sm-6 logo_container">
<img src="<?php bloginfo('stylesheet_directory') ?>/assets/img/spot_square.png" alt="SPOT Logo">
</div>
<div class="col-sm-3">
</div>
</div>
</div>
</article>
</section>
<section class="frontpage white">
<article>
<div class="container">
<div class="row">
<div class="col-sm-2">
</div>
<div class="col-sm-8">
<h1>SPOT kaart van Utrecht in de maak door Rood Gras</h1>
<p class="lead">Samen met Utrechtse illustrator Rob van Barneveld is SPOT bezig om een alternatieve kaart van Utrecht te ontwerpen. Hierbij wordt de toerist tips gegeven voor koffiezaken en die anders wellicht onontdekt zouden blijven. En hierbij hebben ze jullie hulp hard nodig!</p>
<p>Het idee ontstond doordat de Utrechters vinden dat hun stad meer te bieden heeft dan de gebruikelijke toeristische hotspots. Utrecht barst van de leuke kleine zaakjes en met een getekende kaart hopen ze hiervoor meer reclame te kunnen maken. </p>
<p>Het uiteindelijke doel is een reeks plattegronden samen te stellen met behulp van diverse lokale vormgevers, elk met een eigen thema. De kaarten wordt uiteindelijk in gelimiteerde oplage gezeefdrukt op A0-formaat en als poster geprint met RISO op A3-formaat bij Kapitaal. Ook wordt er samen gewerkt met hostels en zal de plattegrond in kaartvorm worden verkocht om de bekendheid te vergroten</p>
<h2>Wie is Rob van Barneveld?</h2>
<p>Rob van Barneveld is een Utrechtse illustrator met kenmerkende stijl die werkt onder de naam Rood Gras. Momenteel bekend van zijn kopjes en strips, maar binnenkort van de plattegrond! Hij werkt voor o.a. De Correspondent en VPRO en heeft een succesvolle webshop. </p>
<h2>Waarom deze plattegrond?</h2>
<p>Met deze plattegrond brengt SPOT je op andere plekken. SPOT kan op deze manier in de behoeftes van de toeristen en nieuwe utrechters voorzien. Velen worden op dit moment naar de standaard plekken gestuurd, maar ‘act like a local’ en ga van de gebaande paden af. SPOT vindt het belangrijk dat Utrecht niet alleen herkend en bekend wordt door haar grachten en domtoren maar ook herkend en bekend wordt door haar initiatieven, koffie, kroegen en etc en te voorzien in een beleving. Door deze overzichtelijke plattegrond brengt SPOT de mensen daar. Daarnaast wordt het ook nog eens een super souvenir van de stad Utrecht. </p>
<h2>Waarom het thema koffie?</h2>
<p>Het aantal koffiezaken in Utrecht is in 10 jaar geëxplodeerd en stuk voor stuk zijn ze razend populair. Maar wat maakt ze onderscheidend? En hoe komen toeristen er terecht? Rob van Barneveld maakt (in opdracht) kopjes en ander servies met een grappige afbeelding; een plattegrond over koffie sluit hier natuurlijk perfect bij aan! </p>
<h2>Waarom financieel bijdragen?</h2>
<p>Momenteel is deze crowdfundingpagina erzodat mensen geld kunnen bijdragen om het project te realiseren. Afhankelijk van het bedrag dat in wordt gelegd kunnen verschillende bedankjes worden verkregen. Waarom zou je dit doen? Omdat je zo lokale vormgevers steunt, je nieuwe Utrechters en bezoekers helpt te ontdekken wat deze stad zo ontzettend tof maakt en je er een bijzondere beloning voor terug krijgt. En vooral: omdat wij jou dan ontzettend dankbaar zullen zijn!</p>
<h2>Maar wat is die beloning dan?</h2>
<p>Wanneer je een bepaald bedrag doneert, krijg je daar het volgende voor terug:
<table class="crowdfunding">
<tr><td class="price">€10</td> <td class="reward">een plattegrond</td></tr>
<tr><td class="price">€25</td> <td class="reward">een Rood Gras ansichtkaartenset en een plattegrond</td></tr>
<tr><td class="price">€50</td> <td class="reward">een Rood Gras koffiekopje en een plattegrond</td></tr>
<tr><td class="price">€100</td> <td class="reward">een Rood Gras gepersonaliseerd koffiekopje en een RISO poster</td></tr>
<tr><td class="price">€150</td> <td class="reward">een Rood Gras ansichtkaartenset, twee koffiekopjes en een RISO poster</td></tr>
<tr><td class="price">€175+</td> <td class="reward">een zeefdruk van de plattegrond</td></tr>
</table>
</p>
</div>
<div class="col-sm-2">
</div>
</div>
</div>
</article>
</section>
<section class="frontpage blue">
<article>
<div class="container">
<div class="row">
<div class="col-sm-2">
</div>
<div class="col-sm-8">
<div class="icon-container">
<i class="fa fa-clock-o" name="Clock Icon"></i>
</div>
<h1>Opening Hours</h1>
<p class="center">
Wednesday: 10:00 - 18:00 <br>
Thursday: 10:00 - 18:00 <br>
Friday: 10:00 - 18:00 <br>
Saturday: 11:00 - 18:00
</p>
</div>
<div class="col-sm-2">
</div>
</div>
</div>
</article>
</section>
</div><!-- page wrap div -->
<?php get_footer(); ?>
You have missed one closing braces for span.reward class.
span.reward {
margin-left: 10px;
Close that selector and the styles will get applied.

Categories