help with blog archives

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

Post Reply
Daisy Cutter
Forum Commoner
Posts: 75
Joined: Sun Aug 01, 2004 9:51 am

help with blog archives

Post by Daisy Cutter »

hello, everyone! 8)
I need some help getting my blog's archives to work.

To see them right now, go to kafene.org/index.php?url=blog

The index of the blog works, but I can't get the archives to parse into the index page.

What I need to do is something like

if ($url=="*archive*") {
include "*archivename*.php"; }

If anyone needs specific code, feel free to ask.

the code I use to include each page in the index is:

Code: Select all

<?php
if ($url == copyright){
	include "lic.php"; }
elseif ($url == atkafene) {
	include "atkaf.php"; }
elseif ($url == contact) {
	include "contact.php"; }
elseif ($url=="propaganda") {
	include "prop.php"; }
elseif ($url=="todo") {
	include "todo.php"; }
elseif ($url=="blog") {
	include "blog.php"; }
elseif ($url=="main") {
	include "main.php"; }
elseif ($url=="") {
	include "main.php"; }
else {
	echo "That is not a valid location!"; }
?>
you can see the format of the archives at the page.

I hope someone can help! Thanks.
ukalpa
Forum Newbie
Posts: 1
Joined: Sun Aug 15, 2004 8:41 pm

Post by ukalpa »

feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


use session.

Code: Select all

<?php
session_start();

if (isset($_REQUEST['url']) && $_REQUEST['url'] != '')
{
     $_SESSION['url'] = $_REQUEST['url'];
}
else
{
     $url = $_SESSION['url'];
}


switch($_SESSION['url'])
{
   case 'main':
      include('main.php');
      break;
   case 'one':
      include('one.php');
      break;
   default:
      ....
}

?>

feyd | Please use

Code: Select all

tags when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Daisy Cutter
Forum Commoner
Posts: 75
Joined: Sun Aug 01, 2004 9:51 am

Post by Daisy Cutter »

hmm... I dont really see how that would work.

Could you elaborate?

what i've done is allow certain URLs to be opened depending on what the $url variable is, rather than open all that it is defined as, to prefent spoofing.

I need to make it so that if a url is like or includes "blog_archive/* " then it will get the requested URL.

EDIT:
right now it works at the cost of much security... anyone could do index.php?url=phpexploit and do somehting bad...

on second thought since i said that im going to change that.

you see doing index.php?url=http://kafene.org/blog_archive/blog_arc ... _03_01.php is handy, but also a risk.

if there's a work around to secure this, or a way to make it so url=http://kafene.org/blog_archive* works, someone please notify me.
Post Reply