Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Secure Dynamic Pages, Another good php tutorial.
maddog39
post Feb 24 2005, 02:04 AM
Post #1


Super Member
*********

Group: Members
Posts: 208
Joined: 27-January 05
From: LI, New York
Member No.: 3,448



Hello all,

Recently a friend of mine gave me this code to make your site completley dynamic and secure at the same time. Here is what you have to do.

Open a new page in your text editor and paste in this code.
CODE

<?php
error_reporting (E_ALL ^ E_NOTICE);
if(!$page){ $page = $HTTP_GET_VARS['page']; }

if($page=="" or $page=="main"){
include("main.php");
}
if($page=""){
  die("You cannot access this page directly...");
}
?>

Then save the file as index.php.

After that upload the file onto your server and make your main content page 'main.php' but dont put any template graphics or things like that. Just leaave it as plain text and links, things like that.

Also make all your pages end with the extenstion '.php' and you can access them by
'http://yourname.com/index.php?page=index&page=somepage'
Also the pages are now secure because if you dont put anything after the '=' sign it will think you are trying to access the page directly so thats where the 'die();' message comes in and blocks anything from going into the files. wink.gif This will ensure that hackers cant get to things that easily. So enjoy and protect your site against evil dooers. laugh.gif wink.gif biggrin.gif
Go to the top of the page
 
+Quote Post
ill
post Feb 24 2005, 02:34 AM
Post #2


Super Member
*********

Group: Members
Posts: 386
Joined: 10-August 04
From: United States
Member No.: 761



actually, you must know that the page=NAMEHERE must be the same as NAMEHERE.php So actually, it's not secure!

Thats just simple PHP Navigation! smile.gif I use it on my site... This is the PHP version of Frames, it uses the include php function!
Go to the top of the page
 
+Quote Post
maddog39
post Feb 24 2005, 02:58 AM
Post #3


Super Member
*********

Group: Members
Posts: 208
Joined: 27-January 05
From: LI, New York
Member No.: 3,448



No I think you use the more simple:
CODE

$Page = $_GET['id'];
@include ($Page . ".php");
Go to the top of the page
 
+Quote Post
ill
post Feb 24 2005, 03:56 AM
Post #4


Super Member
*********

Group: Members
Posts: 386
Joined: 10-August 04
From: United States
Member No.: 761



True, however, that isn't secure, it's just a run around. I guess it confuses the people who don't have a clue, but they wouldn't be hackers, now would they? tongue.gif
Go to the top of the page
 
+Quote Post
maddog39
post Feb 24 2005, 08:13 PM
Post #5


Super Member
*********

Group: Members
Posts: 208
Joined: 27-January 05
From: LI, New York
Member No.: 3,448



Well the way to fix that problem is to make another php snippet and put it into every single page but I cant figure out what that would be. I have been trying all different things and I cant figure it out. sad.gif There must be some simple solution that I just not thinking of. wink.gif biggrin.gif
Go to the top of the page
 
+Quote Post
ill
post Feb 24 2005, 08:18 PM
Post #6


Super Member
*********

Group: Members
Posts: 386
Joined: 10-August 04
From: United States
Member No.: 761



The HED pe site is really good. http://www.hedrocks.com You cant right click, or view the source.. I wanna get their "no view source" script! lol
Go to the top of the page
 
+Quote Post
serverph
post Feb 24 2005, 10:03 PM
Post #7


Ancient Enigma
Group Icon

Group: [MODERATOR]
Posts: 1,741
Joined: 11-July 04
From: under the stars
Member No.: 76



QUOTE(ill @ Feb 25 2005, 04:18 AM)
The HED pe site is really good. http://www.hedrocks.com You cant right click, or view the source.. I wanna get their "no view source" script! lol
*



you might have just been misled to believe you can't view the source code. tongue.gif if you're seeing blanks, you have to scroll down a bit more. as for the no-right click to view source, it's a simple javascript code from dynamicdrive. how did i know, i viewed their source code! tongue.gif from your browser menu, click view, then view (page) source. smile.gif

heheheü
Go to the top of the page
 
+Quote Post
ill
post Feb 24 2005, 11:01 PM
Post #8


Super Member
*********

Group: Members
Posts: 386
Joined: 10-August 04
From: United States
Member No.: 761



doh, i was too lazy to scroll down, as for the no right click script, i've used it before and personally, it's really annoying! cause i like to be able to easily copy links from my website by right clicking and copy link location

you can also find it at javascriptsource.com i believe!

..as for scrolling down, they're slick.. lol
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Simple Javascript And Password System(6)
  2. Trap17 Dynamic Recent Post/topic Image(17)
  3. Test Your Php Pages W/o Upload/internet(57)
  4. How To: Make A Simple Php Site(21)
  5. Java Script Drop Down Menu With Css(2)
  6. Css And Javascript Combined For Dynamic Layout(9)
  7. Problem With Firefox, Latest Version, Not Loading Pages(4)
  8. Make A Moderately-secure Password System Using Javascript(4)
  9. Ratchet And Clank Future(1)
  10. Secure FTP information and assistance required(1)
  11. Is Mac Filtering Secure?(3)
  12. Protect Pages(20)
  13. How To Convert Static Ip To Dynamic Ip`?(9)
  14. Php--> Content-only Pages(9)
  15. Xml For Dynamic Website Content(3)
  1. Dynamic Php Pages(5)
  2. Pagination(3)
  3. Site Error For Php Pages(6)
  4. Some Pages On My Site Won't Even Load..(6)
  5. Changing A Dynamic Ip(18)
  6. 2 Pages Into One(10)
  7. Dynamic Image / Signature Generator(12)
  8. What Is C++ Server Pages?(1)
  9. Php Pages Problem [resolved](5)
  10. Custom 404 Error Pages(17)
  11. Secure File Transfer For Mainframe Systems(2)