Jump to content

A script to change content for a variable


zbrahead

Recommended Posts

[code]<?php
#Set Variables to content for tables depending on $page variable.
if($page = home )
    {$headid1 = "Welcome to our home-page This is your gateway to the rest of the site";
    $msgid1 = "Welcome to Era-Games Homepage, we hope you find many things to do here,our demos our currently locked down because of the people exploiting this generous service";
    $headid2 = "An Apology";
    $msgid2 = "We apologize for the adverts on this screen and as soon as possible we are working to remove these.";
    $headbelow1 = "";
    $msgbelow1 = "";
    $headbelow2 = "";
    $msgbelow2 = "";}
else
if($page = about )
    {$headid1 = "Welcome to the about us page";
    $msgid1 = "";
    $headid2 = "";
    $headbelow1 = "";
    $msgbelow1 = "";
    $headbelow2 = "";
    $msgbelow2 = "";}
else
if( $page = forum )
    { header( "location:http://eragames2.byethost7.com/forum/"); exit();
    }
else
if( $page = news )
    { header( "location:http://eragames2.byethost7.com/news/"); exit();
    }
else
if( $page = contact )
    {$headid1 = "Welcome to the Contact Us page";
    $msgid1 = "";
    $msgid2 = ""
    $headid2 = "";
    $headbelow1 = "";
    $msgbelow1 = "";
    $headbelow2 = "";
    $msgbelow2 = "";}
?> [/code]

$page is ascertained by an extensionj onto the url in ?page=home etc.

please help!!!!
Link to comment
https://forums.phpfreaks.com/topic/8075-a-script-to-change-content-for-a-variable/
Share on other sites

The comparison operator is the double equal sign "==", you have a single equal sign in all of your "if" statements. Change it to a double equal.

You're also assuming that register_globals is enabled. You should use $_GET['page'] instead.

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.