harux10m
New Member
- Messages
- 5
- Reaction score
- 0
- Points
- 1
Hello!
I used to have an old website where my links were used like this:
[domainname]/site/?id=about
[domainname]/site/?id=contact
instead of:
[domainname]/site/about.php
[domainname]/site/contact.php
using the following code:
So to explain, I had several $code's, which some of my pages were using ?id= while others were using ?guide=, etc.
And when the link that was ?id=about or ?id=contact was not valid, it would send users to the 404 page, but if it existed, it would go to the direct page (ie. about.php).
However, I also set it to where if someone accessed the folder directly ([domainname]/site), it would send to the index.html page which redirects to the mainpage.
But since I am on a new server now and using the same script, it's causing me errors by stating:
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: error in /home/harux10m/public_html/site/scripts/php/getCode.php on line 2
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: guide in /home/harux10m/public_html/site/scripts/php/getCode.php on line 3
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: id in /home/harux10m/public_html/site/scripts/php/getCode.php on line 4
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: msg in /home/harux10m/public_html/site/scripts/php/getCode.php on line 5
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: mybid in /home/harux10m/public_html/site/scripts/php/getCode.php on line 6
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: x in /home/harux10m/public_html/site/scripts/php/getCode.php on line 7
I googled and it says I need to do an isset function now, but is there a way to alter the coding I have above to match it up?
Please let me know if you're confused or something.
But thanks in advance if anyone can assist!
PS [ The code works as usual, but I keep getting an error_log file generated. ]
I used to have an old website where my links were used like this:
[domainname]/site/?id=about
[domainname]/site/?id=contact
instead of:
[domainname]/site/about.php
[domainname]/site/contact.php
using the following code:
PHP:
<?php
$code = $_GET['error'] or
$code = $_GET['guide'] or
$code = $_GET['id'] or
$code = $_GET['msg'] or
$code = $_GET['mybid'] or
$code = $_GET['x'];
if (!empty($code)) {
$code .= '.php';
if (!file_exists($code)) {
include($_SERVER['DOCUMENT_ROOT'] . "/site/404.php");
}
else {
include($code);
}
}
else {
include($_SERVER['DOCUMENT_ROOT'] . "/site/scripts/html/index.html");
}
?>
So to explain, I had several $code's, which some of my pages were using ?id= while others were using ?guide=, etc.
And when the link that was ?id=about or ?id=contact was not valid, it would send users to the 404 page, but if it existed, it would go to the direct page (ie. about.php).
However, I also set it to where if someone accessed the folder directly ([domainname]/site), it would send to the index.html page which redirects to the mainpage.
But since I am on a new server now and using the same script, it's causing me errors by stating:
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: error in /home/harux10m/public_html/site/scripts/php/getCode.php on line 2
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: guide in /home/harux10m/public_html/site/scripts/php/getCode.php on line 3
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: id in /home/harux10m/public_html/site/scripts/php/getCode.php on line 4
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: msg in /home/harux10m/public_html/site/scripts/php/getCode.php on line 5
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: mybid in /home/harux10m/public_html/site/scripts/php/getCode.php on line 6
[01-Sep-2014 02:45:37 America/New_York] PHP Notice: Undefined index: x in /home/harux10m/public_html/site/scripts/php/getCode.php on line 7
I googled and it says I need to do an isset function now, but is there a way to alter the coding I have above to match it up?
Please let me know if you're confused or something.
But thanks in advance if anyone can assist!
PS [ The code works as usual, but I keep getting an error_log file generated. ]
Last edited: