Jul 20, 2008

Here's A Nice And Interesting Way To Make Comments - In your php files

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Here's A Nice And Interesting Way To Make Comments - In your php files

Dooga
We all know that when we make websites, sometimes, we just don't want a code to be there... for now. What I'm saying is, for example:

Your name is Bob. Yes it's Bob. Bob made a website and added lots of content. He gets a lot of traffic. He signs up for Google Adsense! Yay! He is happy. He makes thousands of dollars a month. He is famous.

And that is the exact reason why your enemy, Angela, is trying to make your google adsense account bad.

Guess what? Angela is your sister. Yes she is your sister.

What does that mean? She uses the same IP address as you. We all know, that google will penalize anyone for clicking on their own ads, so if Angela clicked on your ads in your home, you're pretty much bankrupt.... there goes another 5 digit number income.

Bob Finds out!!!! AHHH! He needs to remove the Google Ads so that his sister doesn't invite friends over to have a "who can click the fastest" game. So Bob uses the HTML commenting skills he has learned in HTML Land, called "using <!-- and -->" and hides the Google ads, so that he can put it back later without trouble, when he finishes his plan to blackmail his sister! Problem solved! Yay!...

The next day he is banned from Google.

Lets step back for a few seconds. What did he do wrong?

Oh yes, he forgot that Angela was the one who taught him HTML and also knows some tricks herself.

Viewing the source, Angela retrieved the publisher ID from the comment tags, and even if the webpage doesn't display the ad, she will still be able to see the code. She goes to freewebs or geocities, creates a small website with only the Google Adsense code, and invites her friends Jack and Jill, over for the "I bet I can click faster than you because I play piano" game. Now the only thing that Bob can say is "wtf" over and over to Google until he finally loses his searching priveledges too.

What is the solution?

Use php to comment out the code you want to keep. Yes it's that simple. Here's an example:

Before
CODE
<!-- <a href="my-secret-webpage-with-all-my-passwords.html">Google.com</a> -->


After
CODE
<?php /*<a href="my-secret-webpage-with-all-my-passwords.html">Google.com</a>*/ ?>


What is this useful?

You can conviniently keep all the stuff you want to temporarily removed on your page, so you don't forget it! I do that all the time when I test out some new features that I might add to my site, and for example, when I'm trying to find conflicts between scripts. I also use this method to hide registration forms when I disable registration on my site.

NOTE: For all those who think that you can't register for a "commented" web form when you have <!-- --> protecting the script, you are wrong. First of all, a hacker can use a remote file and copy and paste this script, including the form destination (which would have been hidden), and still register for your site, possibly bypassing some "htmlspecialchar('');" or javascript restrictions you have put, allowing a hacker to inject mysql tables, creating new accounts and changing or corrupting information etc.

Even if you have a domain restriction to prevent remote registrations, simple software such as Ad Muncher can easily remove the HTML comments (<!-- -->) with the "Replace HTML" feature. This means, that anyone can change the way your website displays things on their computer, allowing the possibility of executing any HTML (not php) scripts on your domain. Also, changing the referer is very easy, so a javascript or even a .htaccess file won't be able to protect ANY php file from detecting unauthorized domains.

That's why, it's best to comment out a file with php, hiding it from view of ALL public viewers, and STILL have the capability to recall that code with a simple edit!

Bob has learnt a lesson, will you?

 

 

 


Reply

Albus Dumbledore
tis a verry useful trick this is..ill probably never have google ads on my site so i wont need to worry about it, but poor bob, i wonder did he ever get his privledges back from google?

Reply

jlhaslip
And the file extension for the file must be ".php, .php3, or .phtml" for this to work I would imagine. If this is tried on a regular ".html" file, would the line be output onto your display?

Reply

snlildude87
QUOTE(jlhaslip @ Jan 22 2006, 02:15 AM)
And the file extension for the file must be ".php, .php3, or .phtml" for this to work I would imagine.  If this is tried on a regular ".html" file, would the line be output onto your display?
*



Actually, the extension doesn't really have to be .php, .php3, or .phtml. It can still be .htm or .html. Just add this line to your .htaccess file:

CODE
AddType application/x-httpd-php .html .htm


Now your .htm or .html files will execute as php.

Dooga, did you really have to make a story for that? tongue.gif

Reply

webmaster_2006
Nice trick! I will remember this, if I sign up for Google Adsense. Why? Because I have a sister who knows basic HTML and may try the same stunt that Bob's sister did. Great example! It will save many Bob's around the world.

Reply

Dooga
Hey I didn't know that you could use
CODE
AddType application/x-httpd-php .html .htm
to make .html files into php files... hehe I can finally hide my programming language too smile.gif

Reply

kelvinismyname
hey thanks this is just what i am looking for...........protects my adsense better now thanlks dude tongue.gif

Reply

Albus Dumbledore
now, let me understand this...cuz i have gotten confused a little, what i was taught is that in order for any php scripts to work the page you are putting it on has to be a .php file...but from reading this i have gotten a bit confused, so the file does not have to be .php ?? it could still be a .html file and the php script would still work? for example a PHP include code
CODE
<?php include("menus/left.html"); ?>

such as that would still work on a .html file?

Reply

Spectre
Ugh. Excuse my impatience, but it... gets to me... when the same questions come up time and time again.

You can add PHP code to any file with any extension - jpeg, gif, exe, html, php - whatever. But unless the webserver knows to pass the file along to the PHP engine, the code isn't going to be processed, and will simply be sent as output. The AddType handler instructs Apache to treat the specified file extensions as the specified file type (in this case, application/x-httpd-php - ie. give this to the PHP engine). You can also use ForceType in conjunction with the Files directive, and probably a number of other options.

CODE
<Files script.jpg>
ForceType application/x-httpd-php
</Files>

Reply

Yarrgh
QUOTE(snlildude87 @ Jan 21 2006, 10:47 PM) *

Dooga, did you really have to make a story for that? tongue.gif



I enjoyed the story. Usually when you tell people straight out why to do it and how to do it, they don't seem to grasp the consept like other people may. At least reading it in a story form makes it interesting instead of feeling you're reading it out of a manual. wacko.gif


Oh, and thanks for telling me how to make .html and .htm files run php. I have forgotten how to do this. smile.gif

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : heres, nice, interesting, make, comments, php, files

  1. Make An Online Game To Earn Money
    Mainly for students (2)
  2. Nice...
    Nice... (1)
    This Is A Very Nice Host, Good Job On Creating It /smile.gif" style="vertical-align:middle"
    emoid=":)" border="0" alt="smile.gif" />....
  3. Animal Orientation Behavior
    some interesting facts... (0)
    There are two main types of animal orientation behavior, that is, animal movement caused by sensory
    input. The first of these is taxis, which is when an animal moves directionally in response to a
    stimulus. For example, a female tick has a photosensitive body surface. When she senses light, she
    moves to the end of a branch or twig to wait for a mammal to feed off of. This movement toward the
    light can be considered taxis. The second type of orientation behavior is kinesis. In kinesis, the
    stimulus causes a random change in the animal’s speed or direction, but the a....
  4. Timer
    is it possible in vb 6.0 to make a while statement which executes ever (3)
    Is it possible in vb 6.0 to make a while statement which executes every 10 minutes? Any ideas?....
  5. Best Way To Make Money From Your Website?
    (5)
    I'd like to start a website that offers a free service, yet in order to keep this service going
    I will need a small income...any ideas? I know about adsense and whatnot but I would like something
    more.....
  6. Some Of The Biggest Questions In Life.
    Things that make you go hmmmm... (2)
    NUMBER ONE! The current world record for a 100m dash is 9.72 seconds right?? But it's been
    broken before and it's more than likely that at some point it will be broken. So what is the
    highest that the 100m dash record will ever go. Technically there is no maximum that the record can
    get to right? I mean you can always go a bit faster. But there also must be a limit to how fast
    people can travel right? Everyone says you cant go faster than the speed of light, as we know the
    speed of light equals 299 792 458 m / s right? So the maximum time that you can do it ....
  7. How To Make A View New Post Script?
    (5)
    Ok so i'm still working on the forum software i posted about a while back, but I have no idea
    how to do this. I want to make a view new post script, as this is one of the main things that my
    forum software dose not have that all other forums have. so does any body have an idea on how i
    would do this? Thanks.....
  8. Best Way To Transfer Files
    I just bought a laptop (6)
    Hi there guys, I just bought a brand new Dell Inspiron laptop for $729.99. It has a
    processing speed of 2.0ghz, 3GB RAM, and a 250gb hard drive. I'm really satisfied, especially
    with the wireless internet and the fact that I can carry my computer around with me, allowing you to
    use your computer in comfortable spots -- outside in the shade, on the train, or even in your bed
    where I'm using it write now as I type. If you didn't already guess, this is my first
    laptop. But I do have some issues. Does anyone happen to know an easy way to transfer some ....
  9. 1350 Great Free Logos (jpg + Psd)
    With both jpg and original psd files to edit (6)
    1350 Great Free Logos (With both jpg and psd files)
    http://rapidshare.com/files/126291346/1346...Great.Logos.zip This is a great collection of
    logos, they are already made logos which you can use like that or just use to create other logos, do
    what you want, they are free, they came from free websites that give this logos for free and lot
    more, but i just took the good ones mainly. There is also a small collection of 100 logos inside
    the compressed file, which you can use to insert those graphics in your logo/design/web design
    projects, do what you want with them ....
  10. Make Money Online Blog
    (1)
    Hi, I need people to help me to review or give comments about my blog: bloggingdotprofits.com
    One area lacking is content, how about other factors? Thanks in advance. /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />....
  11. Make Money Using Youtube And Adsense
    Make money (10)
    Well if you hace a adsense account and a youtube account and you have more than 200 subscribers, get
    lots of views in your videos then you can start putting ads onyour videos and everytime some click
    on that ad you get money. I think this is a good way to earn money but you need to have alot of
    requirements. And the response takes for ever i sent them a Email to become a youtube parnert (that
    is what is call) and they told me no 2 weeks later!!! Want to become a youtube parnert
    here is the link... http://www.youtube.com/partners And you get more feature....
  12. Converting Audio Files In Vista
    how do you do it? (7)
    Ok, so I have some .wav files that I'd like converted into .mp3. I knew how to do it in XP, but
    I can't find windows audio converter in Vista....does vista even have that, or is it under a new
    name? Also, is it possible to convert video files, like .flv into .avi?....
  13. How To Make Your Own Counter Strike Source Dedicated Server!
    (2)
    Ok, so you want to host your own CSS Server on your computer eh? Well you will not need a lot of
    things, and it is very simple. All you will need is time. /biggrin.gif"
    style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /> I did this tutorial
    myself, from my experience when I made my own CSS Server. This is just a simple tutorial! It
    ONLY covers the basics of making a CSS server! Lets Get Started! /laugh.gif"
    style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" /> 1. Download the HLDS
    Update Tool from here . 2. On....
  14. Ispring Pro - Review
    A nice add-on for Microsoft Powerpoint (1)
    This is a nice add-on for Microsoft Powerpoint that generates Flash (.swf) files from Powerpoint
    presentations. I find that this can be a very useful tool for educational purposes and let me make
    my Powerpoints more creative than just using the viewer. I could incorporate my Powerpoints into a
    blog or a webpage and be able to view it on any web browser with Flash. The only problem is that
    it's interface is inside of Powerpoint. This means I must use Powerpoint in order to generate
    the Flash files. I would much rather use OpenOffice.org Impress, but I can still make t....
  15. Post Your Favorite Easy To Make Meal.
    add ingredients and instructions (16)
    Heres mine =) TATER TOT HOTDISH Ingredients. A bag of tator tots. 2 cans of cream of mushroom
    soup (any cream soup can be substituted for optional flavor) 2 lb. of ground beef 1 can of corn (or
    any other desired vegetable(s)) Instructions. Cook the hamburger and strain the fat. Spread the
    hamburger into a baking dish then pour the soup and can of vegetables over. Stir until mixed well.
    Cover the mixture with tator tots and Bake for the amount of time it says for the tator tots to get
    done and add 5 minutes. (or until mixture is boiling and tator tots are crisped.)....
  16. Runescape Private Server
    How to make your own private server and make runescape cash with it :) (51)
    First off you need a source: You can download one of these. QUOTE Cheezscape 80 -
    http://www.megaupload.com/?d=W8NCP0YC Cheezscape Pk - http://www.megaupload.com/?d=SOK1SPVR
    Project 16 V.6 Edit 8 - http://rapidshare.com/files/10028200...DIT_8.rar.html Project 16 v3 -
    http://www.megaupload.com/?d=ZFYG6T8B Project 16 Blitz -
    http://d.turboupload.com/d/1544978/P16_Blitz.rar.html Project16 V.6 Full Source -
    http://files.filefront.com//;5486316;;/ Project16 V.6 Full Source -
    http://www.megaupload.com/?d=IAO4H58V Project16 V.6 Full Source - http://rapidshar....
  17. How To Disable "show Hidden Files And Folders" In Folder Option
    (11)
    How to disable "Show hidden files and folders" in Folder Option As you know, you can hide files
    or folders in Microsoft Windows ( to hide a file or folder , right click on file or folder >select
    properties and then select Hide file) But if you open Folder Option and check "Show hidden files
    and folders " you can see hidden files. to disable "Show hidden files and folders" feature follow
    below steps : 1- Click start > Run > type regedit to run Windows Registry Editor. 2- Go to following
    address: QUOTE HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/Current Versio....
  18. Can I Make Dynamic Menu In Php
    is it posible to make dynamic menu in php without javascript (7)
    As there are many java script by which we can have event based interaction like,message on mouse
    over etc,that we can create dynamic menu in javascripts to make navigation bar ,but is it possible
    in php to have this acomplished without javascripts,i am new to php,is it possible?. Thanks....
  19. How Do I Make My Own Private Online Server Please Help Me Out.thank You For Your Time.
    (22)
    can someone tell me how to make my very own online private server.Please help me out.This is really
    pissing me off since no one will help me out.Thank you for your time.....
  20. Informix To Sql Server (or How To Open .unl Files)
    how to import .unl files into SQL Server 2000 without Informix softwar (2)
    Does anyone know how to import .unl files into SQLServer 2000? My boss gave me this task to migrate
    an old database into SQLServer. I don't have informix installed since the files were sent to me
    via email. All files have .unl extension and I don't have a clue how to view them. I've
    tried opening them using excel but it can't be read. Does anyone know how to do this? Or at
    least know how to open/view the file using excel or any other program that could be easily migrated
    to sqlserver? Please, I need to migrate the files as soon as possible. Thanks....
  21. How Do I Make Gold Fast In Runescape/
    (116)
    OK i have been playin for liken 4 years and i still can't get alot of gp. the mosti have had in
    that time is like 10k and i have googled cheat codes and all that stuff and nothing works so any
    ideas are welcome.....
  22. How Do I Make A Live Chat Using Php?
    (15)
    i wish to make a live chat room for my website there is need for a certain group to discuss online
    the problem is how do i design and execute one? i wish to use php but if there are better languges i
    would still want to know what do i need to know and what do i need?....
  23. How To Make Your Pc Work Faster
    get your pc working unbelievably fast in 5 minutes !! (16)
    Here you can find useful tips you can do to make your pc work faster in a few minutes , just follow
    these tips and you will definitely have a much faster and more reliable PC! QUOTE 1.
    Wallpapers: They slow your whole system down, so if you're willing to compromise, have a basic
    plain one instead! 2. Minimizing: If you want to use several programs at the same time then
    minimize those you are not using. This helps reduce the overload on RAM. 3. Boot Faster: The
    'starting Windows 9x , xp' message on startup can delay your booting for a couple ....
  24. Make Your Own Mmorpg
    Gaming Engine (37)
    check out the konfuze.com website, they are a great community. they are always in development but
    this program allows you to create your own mmorpg. it gives you a server and client package so if
    you turn the server on and have the client avalable for downlaod on your website, they can connect
    to your server and play your MMORPG Go check thier site out site link expired. check posts below
    for alternatives. ....
  25. Here's Some Jokes To Make You Laugh A Little.
    Jokes Jokes Jokes... (5)
    Moved over to Jokes section from Creativity forum. hey here's a couple of jokes for you. you
    could post some jokes too just for fun.. Joke #1 A man's wife asks him to go to the store to buy
    some cigarettes. So he walks down to the store only to find it closed. So he goes into a nearby bar
    to use the vending machine. At the bar he sees a beautiful woman and starts talking to her. They
    have a couple of beers and one thing leads to another and they end up in her apartment. After
    they've had their fun, he realizes its 3AM and says, "Oh no, its so late, my wif....
  26. Templates
    download Nice Template (10)
    I Fint this Template for u /biggrin.gif' border='0' style='vertical-align:middle'
    alt='biggrin.gif' /> http://xinfo.3dmaster.net.ru/templates/Tem...6471-SPK100.rar
    http://xinfo.3dmaster.net.ru/templates/Tem...6417-SPK100.rar
    http://xinfo.3dmaster.net.ru/templates/Tem...6221-SPK100.rar
    http://xinfo.3dmaster.net.ru/templates/Tem...6370-SPK100.rar
    http://xinfo.3dmaster.net.ru/templates/Tem...6419-SPK100.rar
    http://xinfo.3dmaster.net.ru/templates/Tem...6446-SPK100.rar
    http://xinfo.3dmaster.net.ru/templates/Tem...6207-SPK100.rar hihi I Find th....
  27. Name 3 Things That Make You Real Mad
    (78)
    Hi Here are my three to get this started: 1) I hate when I see humans mistreating animals for no
    reason. 2) I hate dumb people, I mean I really do. When confronted with someone that is plain dumb
    I get irrate. /mad.gif' border='0' style='vertical-align:middle' alt='mad.gif' /> 3)
    Disrespect. When someone talks to you like your are a piece of chewed gum on the pavement. I also
    hate it when I see someone else being the victim of this. Like a customer in a restaurent being rude
    to a waiter/waitress just because he can. So what gets your blood boiling? /wink.gi....
  28. Could Someone Make A Php Script For Me?
    Script to manage clans and players (3)
    Does someone know a script where you can 1. Add clans to a roster 2. Edit clans on a roster 3. Add
    players too a clan 4. Edit players 5. Schedule matches 6. Add clan Leaders to manage their own clan
    + members 7. Add members to edit their own information And maybe some sort of scoreboard integrated
    where you can put Wins, Draws and loses and that automaticly puts best clans on the top? If there
    isnt such a script could someone create 1 for me? (its for a league ^^)....
  29. Converting Video Files From One Format To Another
    help plz :) (6)
    hey i have learnt this nice way to open mov files in imageready and insert them in sigs,graphics and
    other stuff its really cool,this only works with .mov files and i really need to know if sumone here
    can do that,i need to change a wmv file into a .mov file so i cant add the movie to a sig,i have
    tried many video format conversion programs but they dont accept the mov format,the mov format is a
    quicktime video format,so anyone here know how to change a video file into a quicktime mov video
    format? thnx in advance....
  30. Key Logger.
    How To Make (34)
    Hi Pe /cool.gif' border='0' style='vertical-align:middle' alt='cool.gif' /> ple ,
    Can Any One Tell me how to build a Keylogger on Visual Bais 6.0 that no one
    could see on the End Task Menu....

    1. Looking for heres, nice, interesting, make, comments, php, files

Searching Video's for heres, nice, interesting, make, comments, php, files
Similar
Make An
Online Game
To Earn
Money -
Mainly for
students
Nice... -
Nice...
Animal
Orientation
Behavior -
some
interesting
facts...
Timer - is
it possible
in vb 6.0 to
make a while
statement
which
executes
ever
Best Way To
Make Money
From Your
Website?
Some Of The
Biggest
Questions In
Life. -
Things that
make you go
hmmmm...
How To Make
A View New
Post Script?
Best Way To
Transfer
Files - I
just bought
a laptop
1350 Great
Free Logos
(jpg + Psd)
- With both
jpg and
original psd
files to
edit
Make Money
Online Blog
Make Money
Using
Youtube And
Adsense -
Make money
Converting
Audio Files
In Vista -
how do you
do it?
How To Make
Your Own
Counter
Strike
Source
Dedicated
Server!
Ispring Pro
- Review - A
nice add-on
for
Microsoft
Powerpoint
Post Your
Favorite
Easy To Make
Meal. - add
ingredients
and
instructions
Runescape
Private
Server - How
to make your
own private
server and
make
runescape
cash with it
:)
How To
Disable
"show
Hidden Files
And
Folders"
; In Folder
Option
Can I Make
Dynamic Menu
In Php - is
it posible
to make
dynamic menu
in php
without
javascript
How Do I
Make My Own
Private
Online
Server
Please Help
Me Out.thank
You For Your
Time.
Informix To
Sql Server
(or How To
Open .unl
Files) - how
to import
.unl files
into SQL
Server 2000
without
Informix
softwar
How Do I
Make Gold
Fast In
Runescape/
How Do I
Make A Live
Chat Using
Php?
How To Make
Your Pc Work
Faster - get
your pc
working
unbelievably
fast in 5
minutes
!!
Make Your
Own Mmorpg -
Gaming
Engine
Here's
Some Jokes
To Make You
Laugh A
Little. -
Jokes Jokes
Jokes...
Templates -
download
Nice
Template
Name 3
Things That
Make You
Real Mad
Could
Someone Make
A Php Script
For Me? -
Script to
manage clans
and players
Converting
Video Files
From One
Format To
Another -
help plz :)
Key Logger.
- How To
Make
advertisement



Here's A Nice And Interesting Way To Make Comments - In your php files



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE