• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP] Pages

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
So i use a switch page system.

Files i have :

  • Index.php - it has basic html tags, include('core.php'); and <?PHP echo $panel_content; ?>
  • core.php - switch function + sql conn etc.

Core.php
PHP:
switch($_REQUEST['subtopic']) {

        case "character":
                $topic = "Character Equipment";
                $subtopic = "character";
                include("pages/showcharacter.php");
        break;
       
     
}

So if i type index.php?subtopic=character

It displays me the include("pages/showcharacter.php"); as a normal site not in the place where i want to show it from (index.php) <?PHP echo $panel_content; ?>. The showcharacter.php has for example that code
PHP:
 $panel_content =  '<td style="text-align: center; width: 32px; height: 32px;">cap '.$result['cap'].'</td>';


Thanks if you can help
 
I'd do that using echos, like:

Code:
<html>
<head></head>
<body>
<?PHP include($_GET['page'].'.php'); ?>
</body>
</html>

Then in page code:
Code:
echo 'blabla';

OFC. my example is RFI vulnerable but it's just example, you will have to do some small protection against it.
 
Its sad but really i cant figure it out how to. I want like ?page= :(. All would be "filtered" through the index.php . Could you try to write me a more detailed code?
 
PHP:
<?php 

if(!isset($_GET['page'])){ 

include "start.php "; 


}elseif(@$_GET['page'] == 'start'){  

include "start.php"; //You have to do this (^) again.


}elseif(@$_GET['page'] == 'links'){ // Another site you can change.


include "links.php"; 


}else{ 

include "error.php"; //If wrong link, display error.php


} 

?>

Just an example.
 
Or:
Code:
if(!$_GET['page']) Header('Location: ?page=start');

switch($_GET['page']) {
	case 'start': include 'pages/start.php'; break;
	case 'login': include 'pages/login.php'; break;
	default:
		die 'Stop cheat ;p';
	break;
}

xPxP
 
Or:
Code:
if(!$_GET['page']) Header('Location: ?page=start');

switch($_GET['page']) {
	case 'start': include 'pages/start.php'; break;
	case 'login': include 'pages/login.php'; break;
	default:
		die 'Stop cheat ;p';
	break;
}

xPxP

aaaaa ok = / I'm noob. ;ssss xP
 
PHP:
$page = (isset($_GET['page']))?str_replace('.', '', $_GET['page']):'start';
if(!file_exists('pages/'.$page.'.php') ) $page = 'start';
include 'pages/'.$page.'.php';
 
Kavvson,

Go learn more about PHP or even CakePHP, CodeIgniter, Zend, ... it doesn't matter
So, perhaps you should stop doing those bad codes. This is not a criticism ;P
 
I know. But i need a nice ebook. Have one?:D PM


Btw Am I correct.. The script will include full pages. I wanted to have something like an additional page that would load in the main frame :/ Not a full page since it will waste much code and it will be heavy.
 
PHP:
if ($_REQUEST['system']/*&system*/ == 'character'/*=character*/)
{
var
}
&system=character
 
PHP:
$page = (isset($_GET['page']))?str_replace('.', '', $_GET['page']):'start';
if(!file_exists('pages/'.$page.'.php') ) $page = 'start';
include 'pages/'.$page.'.php';

Nerd! :D
 
@Nostradamus
Actually, I can't understand how people use XX minutes to create a blog script with all functions etc with CakePHP, I sure never managed it.

@Kavvon:
Learn Django (all python platforms) or Tornado (Linux only tho).

Django pros:
- You got a model design. You don't need to know a singel line of SQL or write complex XML systems! Django auto make and sync database based on the source.
- Your script can auto validate fields based on how the model works.
- Administration system can be auto made based on the model. And you and apply uber simple systems on top of that.

http://docs.djangoproject.com/en/dev/intro/tutorial01/
 
@Nostradamus
Actually, I can't understand how people use XX minutes to create a blog script with all functions etc with CakePHP, I sure never managed it.

@Kavvon:
Learn Django (all python platforms) or Tornado (Linux only tho).

Django pros:
- You got a model design. You don't need to know a singel line of SQL or write complex XML systems! Django auto make and sync database based on the source.
- Your script can auto validate fields based on how the model works.
- Administration system can be auto made based on the model. And you and apply uber simple systems on top of that.

Django | Writing your first Django app, part 1 | Django documentation

Sorry i guess i cant learn pyt if i cant well php ;|
 
@stian
Django, Rails and CakePHP got the same "philosophy".
Also, Ruby on Rails "getting started" guide is to make a blog too :p
Actually, i only work with CakePHP (well, i am still learning, i am reading about it 2 weeks only) because it is very similar to Rails.

About Django, i like it too, but well, Rails rules more :D
 
Back
Top