Jump to content

[SOLVED] Whats wrong this code


mme

Recommended Posts

Whats wrong with this code I get the error:

Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /home/mamihoo/public_html/test/check.php on line 3

 

<?php
include("settings.php");
if $disable = "true" {printf("The Website you are trying to reach is currently unavailible"); exit;}
if $update = "true" {printf("The Website you are trying to reach is currently being updated"); exit;}
if $disbale = "false"
{
if $update = "false" {
header( 'Location: pass.html' ) ;}}
?>

Link to comment
Share on other sites

As wildteen88 said, try this:

 

<?php

include("settings.php");

if ($disable = "true")

  {printf("The Website you are trying to reach is currently unavailible"); exit;}

if ($update = "true")

  {printf("The Website you are trying to reach is currently being updated"); exit;}

if ($disbale = "false")

  {

  if ($update = "false")

      {header( 'Location: pass.html' ) ;}

  }

?>

Link to comment
Share on other sites

<?php

include("settings.php");

if ($disable = "true") {printf("The Website you are trying to reach is currently unavailible"); exit;}

if ($update = "true") {printf("The Website you are trying to reach is currently being updated"); exit;}

if ($disbale = "false")

  {

  elseif ($update = "false")

      {header( 'Location: pass.html' ) ;}

  }

?>

 

Try this. I'm still kinda new to php but I think that might work. ;D

Link to comment
Share on other sites

Ignore my last comment, try this.

 

<?php
//include("settings.php");
$update = false;
$disable = false;
if ($update == "true") {printf("The Website you are trying to reach is currently being updated"); exit;}
if ($disable == "true") 
{
printf("The Website you are trying to reach is currently unavailible"); exit;
}
else
{
header('Location: pass.html');
}
?>

Link to comment
Share on other sites

I do now, I would try use something similar to this method:

 

<?php
//include("settings.php");
// $status can be ready, updating or disabled
$status = "ready";
switch($status)
{
// View Website
case "ready" :
header('Location: pass.html');
break;

// Website is been updated
case "updating" :
print "This website is being updated.";
break;

// Website is disabled
case "disabled" :
print "This website is disabled.";
break;
}
?>

Link to comment
Share on other sites

Sorry I just thought of something. what if the variable status is something that is not in the switch statment command how can I make it display a something instead of a blank page?

 

eg;

 

status = "hhfiudh"

 

currently it displays a blank page

how would I make it display something?

Link to comment
Share on other sites

Ok thanks however now when i went to put my html code around the php codes so it displays in a certain part of the page it gave me the error

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/mysite/httpdocs/index.php:21) in /var/www/vhosts/mysite/httpdocs/index.php on line 72

Link to comment
Share on other sites

Ok thanks however now when i went to put my html code around the php codes so it displays in a certain part of the page it gave me the error

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/mysite/httpdocs/index.php:21) in /var/www/vhosts/mysite/httpdocs/index.php on line 72

 

The header function must be called before any HTML on the page.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.