Jump to content

Archived

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

zbrahead

A script to change content for a variable

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!!!!

Share this post


Link to post
Share on other sites
a few errors in the code.
$msgid2 = ""
when it shows up for the second time you forgot to close it with the colon ; symbol, that might fix your problem.

Share this post


Link to post
Share on other sites
And if that wasn't it then tell us what the problem is.

- what is not doing that it should do?
- what is it doing that it shouldn't do?

Don't just post code and say it doesn't work if you expect help.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.