Can you see anything wrong with this code, or can it be optimised?
Code from index.php, to include the file
if(empty($_GET['t'])) {
$folder = "apps/";
}else {
$folder = str_replace("/", "", $_GET['t']) . "/";
}
if(empty($_GET['app'])) {
include('apps/home.php');
} else {
if(file_exists($folder.$app.".php")) {
include($folder.$app.".php");
} else {
include("/home/radonsys/public_html/global/error/404.php");
}
}
My problem? one page, which posts to itself doesnt find it's page and returns to that 404 page.
If you want, I can include the form code for that page?
Code from bugs.php
<form method="post" action="">
<div>Title</div>
<div><input name="title" type="text" class="bginput" value="" size="59" tabindex="1" /></div>
<br />
<div><label class="smallfont">Application
<select name="app" style="display:block; width:200px" tabindex="2">
<option value="Admin CP" >AdminCP</option>
<option value="Add User" >Add User</option>
<option value="Bugzilla" >Bugzilla</option>
<option value="Portal" >Portal</option>
<option value="To Do" >To Do</option>
<option value="Internal Messages" >Internal Messages</option>
<option value="User CP" >UserCP</option>
<option value="Change Password" >Change Password</option>
<option value="Change Email" >Change Email</option>
<option value="General">General</option>
</select>
</label></div><br />
<div>Bug Description</div>
<textarea name="content" style="width:7%">
</textarea><br />
<div><label class="smallfont">Priority
<select name="priority" style="display:block; width:200px" tabindex="2">
<option value="0" selected="selected">Unknown</option>
<option value="1" >1 - Highest</option>
<option value="2" >2</option>
<option value="3" >3</option>
<option value="4" >4</option>
<option value="5" >5 - Medium</option>
<option value="6" >6</option>
<option value="7" >7</option>
<option value="8" >8</option>
<option value="9" >9</option>
<option value="10" >10 - Lowest</option>
</select></label></div><br />
<input type="submit" value="Save" />
</form>
Clarification
The above script is in index.php, which calls on a page, e.g, ?app=bugs includes bugs.php in the apps folder.
Stuff on the bugs.php script uses POST to itself to send the data, however, post data never reaches the page itself since we're stuck with the error page, 404.php