PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
4cpukid
Forum Newbie
Posts: 4 Joined: Wed Jul 20, 2011 6:27 pm
Post
by 4cpukid » Sun Jul 24, 2011 9:03 pm
I have this command that in the URL bar if it reads <<<<>>>>/?view=old - it will view old.php but no matter what the case is all i see is MAIN. I pasted the code below Thanks in advance.
Code: Select all
<?php
// =========================DO NOT ALTER ANYTHING BELOW THIS LINE========================
$view = $_GET['view'];
if ($view=="") { $view = "main"; }
switch($view){
case "main":
@include('news/main.php');
break;
case "new":
$new = file_get_contents('http://cp.cioffitech.com/files/news/new.php');
echo $new;
break;
case "old":
$old = file_get_contents('http://cp.cioffitech.com/files/news/old.php');
echo $old;
break;
case "all":
$all = file_get_contents('http://cp.cioffitech.com/files/news/all.php');
echo $all;
break;
}
?>
Jonah Bron
DevNet Master
Posts: 2764 Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California
Post
by Jonah Bron » Sun Jul 24, 2011 10:17 pm
Is that all the code? Is there anything else that could affect it? Try removing the if clause. Are you sure you entered in the URL query string (?view=old) correctly?
kaydeveloper
Forum Newbie
Posts: 2 Joined: Mon Jul 25, 2011 1:42 am
Post
by kaydeveloper » Mon Jul 25, 2011 1:51 am
I think the code which you have provided is completely perfect but you need to be sure that are you really passing the view=old in the URL?
4cpukid
Forum Newbie
Posts: 4 Joined: Wed Jul 20, 2011 6:27 pm
Post
by 4cpukid » Mon Jul 25, 2011 12:00 pm
Heres the page that uses this file:
Code: Select all
<?php
session_start(); // start session cookies (otherwise won't remember login between pages)
require("../includes/config.php");
require("../includes/Database.singleton.php");
require("../includes/Login.singleton.php");
// create initial singleton database connection and connect
$db = Database::obtain(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
$db->connect();
// create login singleton object
$login = Login::obtain();
// force a user login
$login->hard(2);
?>
<!DOCTYPE html>
<html>
<head>
<title>Access CP - Admin - Home</title>
<style>
#errorbar {
background-color: #770000;
color: #ffffff;
text-align: center;
font-size: 9pt;
margin: auto;
}
</style>
<link rel="stylesheet" href="main.css" type="text/css">
<script src="http://www.cioffitech.com/ct/c/div.js"></script>
</head>
<body>
<div class="f_container">
<div class="f_header">
<?php require('includes/header.inc.php'); ?>
</div>
<div class="f_menu">
<?php require('includes/menu.inc.php'); ?>
</div>
<div class="f_body">
<span align="center" id="errorbar">ATTENTION: We are experiancing some issues with our news feed and the THREE NEW CONTROL BUTTONS at thee bottom of the page are not functioning.</span><br /><br />
<?php
/* News and Updates of the Control Panel are kept and feed through the CioffiTech Server. DO NOT TOUCH THIS LINE OF CODE! */
/* @include('../../sd/cp/files/news.php'); */
/* echo implode(file("http://http://cp.cioffitech.com/files/news.php")); */
$newsfeed = file_get_contents('http://cp.cioffitech.com/files/news.php');
echo $newsfeed;
?>
</div>
<div class="f_footer">
<?php require('includes/footer.inc.php'); ?>
</div>
</div>
</body>
</html>
Jonah Bron
DevNet Master
Posts: 2764 Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California
Post
by Jonah Bron » Mon Jul 25, 2011 8:35 pm
Is it one of the includes? Which one?
4cpukid
Forum Newbie
Posts: 4 Joined: Wed Jul 20, 2011 6:27 pm
Post
by 4cpukid » Mon Jul 25, 2011 8:43 pm
4cpukid wrote: Heres the page that uses this file:
Code: Select all
<?php
session_start(); // start session cookies (otherwise won't remember login between pages)
require("../includes/config.php");
require("../includes/Database.singleton.php");
require("../includes/Login.singleton.php");
// create initial singleton database connection and connect
$db = Database::obtain(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
$db->connect();
// create login singleton object
$login = Login::obtain();
// force a user login
$login->hard(2);
?>
<!DOCTYPE html>
<html>
<head>
<title>Access CP - Admin - Home</title>
<style>
#errorbar {
background-color: #770000;
color: #ffffff;
text-align: center;
font-size: 9pt;
margin: auto;
}
</style>
<link rel="stylesheet" href="main.css" type="text/css">
<script src="http://www.cioffitech.com/ct/c/div.js"></script>
</head>
<body>
<div class="f_container">
<div class="f_header">
<?php require('includes/header.inc.php'); ?>
</div>
<div class="f_menu">
<?php require('includes/menu.inc.php'); ?>
</div>
<div class="f_body">
<span align="center" id="errorbar">ATTENTION: We are experiancing some issues with our news feed and the THREE NEW CONTROL BUTTONS at thee bottom of the page are not functioning.</span><br /><br />
<?php
/* News and Updates of the Control Panel are kept and feed through the CioffiTech Server. DO NOT TOUCH THIS LINE OF CODE! */
/* @include('../../sd/cp/files/news.php'); */
/* echo implode(file("http://http://cp.cioffitech.com/files/news.php")); */
$newsfeed = file_get_contents('http://cp.cioffitech.com/files/news.php');
echo $newsfeed;
?>
</div>
<div class="f_footer">
<?php require('includes/footer.inc.php'); ?>
</div>
</div>
</body>
</html>
------Sorry about that - Its the '$newsfeed'.--------