ORIGINAL POST FOR MORE INFORMATION!!!
What the hack is:
This hack allows you to put "page-specific" data on a page that utilizes CuteNews :blink:. Let me elaborate:
Do you want to display something like an introduction to your site on your main page and then your CuteNews data below it? In a normal scenario, your main site (for our purposes it will be called 'index.php', would look something like this:
<html>
<body>
Hello World! Welcome to my website, index.php!
This is a really dumb intro, so to put you out of your misery,
here is some news:
<?php include("cutenewsdirectory/show_news.php"); ?>
Thanks for reading my news! Bye!
</body>
</html>
When you actually looked at that page in a browser, it would look something like:
index.php wrote:Hello World! Welcome to my website, index.php! This is a really dumb intro, so to put you out of your misery, here is some news:
Babies overtake Germany
This just in. It looks as though Germany has been over-run by a group of wild babies. They appear to be showing no mercy, eating anything and everything in their path - leaving a trail of death and fecal matter in their wake.
Read More - Comments (1337)
-------------------
Missy Elliott is officially the coolest person in the world
God just declared Missy Elliott to be the coolest person in the world. He was too tied up to comment - he muttered something about babies and Germany before shuffling off, but he made it very clear that Missy Elliott was the coolest person in the world.
Read More - Comments (666)
Thanks for reading my news! Bye!
So far so good, right? Right! Until you click 'Read More'. Let's click on it:
index.php?subaction=showfull&id=1103068371&archive=&start_from=&ucat=& wrote:Hello World! Welcome to my website, index.php! This is a really dumb intro, so to put you out of your misery, here is some news:
Babies overtake Germany
This just in. It looks as though Germany has been over-run by a group of wild babies. They appear to be showing no mercy, eating anything and everything in their path - leaving a trail of death and fecal matter in their wake. I suppose I should say more since this is the 'full article'. Apparently the babies are heading towards the ocean where they have hired terrorists to build them small aircrafts so that they can traverse the globe, causing havoc everywhere. They plan on utilizing chemical warfare from their aircrafts, dropping toxic material including dirty diapers, breastmilk, and urine. Counties all around the world are trying to group all nannies so they can try to get these brutal babies under control. Authorities are saying to flee if any babies flying aircrafts are near. More updates to come.
comments:
#1337 - Poster #1 is an idiot.
[posters #2-#1336]
#1 - Wow babies are teh l33t babbzorrz, but whie dunt tey dr0p teh crunk juice!1!11!1
post your comment:
Name: |_________|
Website/Email: |___________|
Comment: |_______________| Remember Me? |/|
[Submit] [Clear]
Thanks for reading my news! Bye!
As you can see - before the article starts, it says: "Hello World! Welcome to my website, index.php! This is a really dumb intro, so to put you out of your misery, here is some news:" when that should only be displayed on the main page, 'index.php'.
So that is what this hack does. It lets you put something only on the main page.
How Does it Work?
You add this script to the main page, wherever you want to include the page-specific content. What the script does is request the visitor's URL from the server, and then it checks whether the url is the main page or not. If it is the main page then it displays the page-specific data. If it is not the right page, then it just displays the news.
Okay, sounds good, but now I need the code.
Well, if you insist:
<?PHP
$urssss = $_SERVER["REQUEST_URI"]; /* This code requests the current URL of the visitor from the server and stores it in the variable $urssss.
Feel free to change variable names. */
if($urssss == "/" or $urssss== "/index.php") /* This code checks to see if the visitor is on the main
page. If they are on the main page then it executes
the following code: */
{
echo "This is the page-specific content. This can include HTML, so feel free to. [b]Welcome to my website![/b] [i]Blah blah blah blah blah[/i]";
} ?>
So you paste that code wherever you want the page-specific content.
Let's apply that code to our example.
Hey, I was thinking the same thing! Okay, our original example webpage would look like this with the hack in operation:
<html>
<body>
<?PHP
$urssss = $_SERVER["REQUEST_URI"]; /* This code requests the current URL of the visitor from the server and stores it in the variable $urssss.
Feel free to change variable names. */
if($urssss == "/" or $urssss== "/index.php") /* This code checks to see if the visitor is on the main
page. If they are on the main page then it executes
the following code: */
{
echo "Hello World! Welcome to my website, index.php!
This is a really dumb intro, so to put you out of your misery,
here is some news:";
} ?>
<?php include("cutenewsdirectory/show_news.php"); ?>
if($urssss == "/" or $urssss== "/index.php") /* This code checks to see if the visitor is on the main
page. If they are on the main page then it executes
the following code: */
{
echo " Thanks for reading my news! Bye!";
} ?>
</body>
</html>
And that would make the text only appear on your home page, assuming your home page is index.php. If it is not, then change the if statement to be:
if($urssss == "/" or $urssss== "/whateveryourpageiscalled.php")
Is there anywhere that I can see this hack being implemented?
Why, yes! I didn't make it for no reason. I am using it on my website, EmoOnline.com:
If you go to the main page and look, you will see that I have an introduction, saying what the site is about.
Then go to this example article and you will notice that there is no introduction in front of the article.
This hack could have a million different uses, so don't hesitate to use it.
If you have any questions, PM me.
EmoOnline