lundi 16 novembre 2015

Welcome, Username and Displaying random image from folder

I'm trying to fix up a pre-existing website and add dynamic information. I need to add Welcome, $user with the username coming from session.php and only displaying if they are logged on. Then I need to add images from a /images/banner/ folder to display dynamically, only one at a time.

Here's what I have so far:

<?php session_start();
    require_once ("Includes/simplecms-config.php"); 
    require_once  ("Includes/connectDB.php");
    require_once ('Includes/session.php");
    include("Includes/header.php");         
 ?>


<div id="container">

<?php

$user = $_SESSION['username'];

echo "Welcome $user";

?>

<div id="tagline">Welcome to Sally's diner!</div>
    <div id="banner"><img src="Images/banner/1.jpg" /></div>

</div>

</div> <!-- End of outer-wrapper which opens in header.php -->

<?php 
include ("Includes/footer.php");
?>

  1. I keep getting a syntax error on line 14 which is $user = $_SESSION['username'];

  2. How do I display an image from /Images/banner/ folder where there are more than one images and only display one image at a time.

Thanks in advance for any help,

Vanessa




Aucun commentaire:

Enregistrer un commentaire