PHP Issue

KentonBomb

New Member
Messages
42
Reaction score
0
Points
0
EDITL Oh my god. It was just a bad typo :( Sorry for the waste of space.

I'm having trouble with the following PHP script. It's just a showcase for my programs I make, but one link just is being picky.

PHP:
<html>
<head>
<title>
Welcome to Senton-Bomb's Autoit Page
</title>
<?
if ($_GET["code"] == "favorites")
{
    include("favorite.php");
    exit;
} 
if ($_GET["code"] == "rasvr")
{
    include("rasvr.php");
    exit;
}
if($_GET["code"] == "raclnt")
{
    include("raclnt.php");
    exit;
}
?>
<style>
body {background-color:#000000}
h1.title {color:white}
h6.title {color:white}
a.title {color:white}
</style>

</head>
<body>
<center>
<h1 class=title>
~Welcome to Senton-Bomb's Autoit Page~
</h1><br><br></center>
<h6 class=title>
Welcome to my Autoit Page. I use no fancy formatting on my pages, because I let my code speak for itself. If you want to see that code talking, feel free, by clicking any of the below links.<br><br>
<a href="?code=favorites" class=title>Favortizer (Unfinished)</a><br>
Remote Autoit:
    <a href="?code=rasrvr" class=title>Server</a>
&nbsp;&nbsp;
    <a href="?code=raclnt" class=title>Client</a>
</div>
</body> 
</html>

I know I am using bad coding habits, like using multiply If statements instead of an else if statement, and my terrible CSS :nuts: If you notice, the link to both the "Favoritizer" And the "Remote Autoit Client" are working. The Remote Autoit Server however, simply won't load. I don't have a single idea why.

If you want to see the page:
http://KTech.heliohost.org/senton

I know there is no design to it, I want it to be simplistic. I might add a layout in the future, but right now I just need to debug this.

The rasvr.php source:

PHP:
<?php
 //
 // Include the GeSHi library
 //
 include_once('geshi.php');
 
 //
 // Define some source to highlight, a language to use
 // and the path to the language files
 //
$file = fopen("Server.au3", "r");

 $source = fread($file, filesize("Server.au3"));
 $language = 'autoit';
 //
 // Create a GeSHi object
 //
 $geshi =& new GeSHi($source, $language);
 
 //
 // And echo the result!
 //
 echo $geshi->parse_code();
?>

It used GeShi as a backend, so if you need that included, just ask.

Other information:
The source for rasvr.php is identical to the other two scripts, but the paths are changed from "Server.au3" to "Favorites.au3" and "Client.au3". Au3 is the extension for Autoit Scripts (http://autoitscript.com) which is what I do my coding in (Unless I'm stuck on a linux environment, where I use C++.

I hope I was thorough enough :lol:
 
Last edited:

VPmase

New Member
Messages
914
Reaction score
0
Points
0
For the multiple ifs you should really just use a switch() function.

In your case:

PHP:
$c = "none";
if(isset($_GET["code"]){
$c = strtolower($_GET["code"]);
}
switch($c){
case "favorites": include('favorite.php'); break;

case "rasvr": include('rasvr.php'); break;

case "raclnt": include('raclnt.php'); break;

case "none": echo "none"; break;
}
 
Last edited:
Top