Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

hide page and re-direct
Hi

This may not be the best group to post this on but I could not
find newsgroup that is about site design.

I have been asked to put a small site together, on the front
page there will be a log in, the user details are to be held in
a MySQL database which will be accessed by PHP.
If a successful login then the user will be re-directed to 1
of X pages depending on their user account.

The problem is the X pages the client wants them in as
a static page and not done on the fly. I could do a page
with a re-direct in it if they have not logged in, what my
worry is, is 1) these pages may get index by a search engine
and 2) if they are the page would come up and is a user
is quick enough they could click stop before they get re-directed
and see the page.

Is there anyway to hide all the pages content if not logged in even if
a user does view source and then re-direct them back to the home page
but still have a static page that my client can alter?

Thanks in advance

Brian




Report this thread to moderator Post Follow-up to this message
Old Post
Brian
04-14-05 01:55 AM


Re: hide page and re-direct
Brian wrote:
> Hi
>
> This may not be the best group to post this on but I could not
> find newsgroup that is about site design.
>
> I have been asked to put a small site together, on the front
> page there will be a log in, the user details are to be held in
> a MySQL database which will be accessed by PHP.
> If a successful login then the user will be re-directed to 1
> of X pages depending on their user account.
>
> The problem is the X pages the client wants them in as
> a static page and not done on the fly. I could do a page
> with a re-direct in it if they have not logged in, what my
> worry is, is 1) these pages may get index by a search engine
> and 2) if they are the page would come up and is a user
> is quick enough they could click stop before they get re-directed
> and see the page.
>
> Is there anyway to hide all the pages content if not logged in even if
> a user does view source and then re-direct them back to the home page
> but still have a static page that my client can alter?
>
> Thanks in advance
>
> Brian
>
>
>

I don't know an exact answer, but if there isn't one you can..

to keep the robots away <meta name="robots" content="noindex,nofollow">
in the <head>

compress the code onto one line.. i.e. <html><head><meta ...></head>
etc. It's still readable but not as easy. Throw some random gibberish in
there too e.g. /*jfkdsjfdsj*/ if you like.
It's not especially clean but it'd make the code hard to read.

Report this thread to moderator Post Follow-up to this message
Old Post
Chris B
04-14-05 01:55 AM


Re: hide page and re-direct
"Brian" <not@given.com> kirjoitti
viestissä:3%e7e.21223$il.10391@newsfe5-win.ntli.net...
> Hi
>
> This may not be the best group to post this on but I could not
> find newsgroup that is about site design.
>
> I have been asked to put a small site together, on the front
> page there will be a log in, the user details are to be held in
> a MySQL database which will be accessed by PHP.
> If a successful login then the user will be re-directed to 1
> of X pages depending on their user account.
>
> The problem is the X pages the client wants them in as
> a static page and not done on the fly. I could do a page
> with a re-direct in it if they have not logged in, what my
> worry is, is 1) these pages may get index by a search engine
> and 2) if they are the page would come up and is a user
> is quick enough they could click stop before they get re-directed
> and see the page.
>
> Is there anyway to hide all the pages content if not logged in even if
> a user does view source and then re-direct them back to the home page
> but still have a static page that my client can alter?

Would it be possible to call the pages like
gatekeeper.php?p=some_static_page.html
where gatekeeper.php would simply be
<?php
if(/* logged in, insert code */){
$page = "my_secret_directory/".$_REQUEST['p'];
if(file_exists($page))
readfile($page);
else header("HTTP/1.0 404 Not Found");
}
?>
and protect my_secret_directory from public access. Perhaps with
mod_rewrite, the "pagenames" could be transleted into
gatekeeper.php?p="pagename", so nothing would change with the static pages
even.



Report this thread to moderator Post Follow-up to this message
Old Post
Kimmo Laine
04-14-05 01:55 AM


Re: hide page and re-direct
I noticed that Message-ID: <3%e7e.21223$il.10391@newsfe5-win.ntli.net>
from Brian contained the following:

>The problem is the X pages the client wants them in as
>a static page and not done on the fly. I could do a page
>with a re-direct in it if they have not logged in, what my
>worry is, is 1) these pages may get index by a search engine
>and 2) if they are the page would come up and is a user
>is quick enough they could click stop before they get re-directed
>and see the page.

Use sessions.  Set a session variable on the login page and check for
it(or them) on the protected page.  If the session variable is not
present, redirect to the login page.

--
Geoff Berrow  0110001001101100010000000110
 0011011010110110010001101111011001110010
11
 1001100011011011110010111001110101011010
11

Report this thread to moderator Post Follow-up to this message
Old Post
Geoff Berrow
04-14-05 01:55 AM


Re: hide page and re-direct
Thanks Kimmo

Your idea worked out best, I am hold the templates in a
htaccess directory and after the login has been done read
the template in

Many thanks

Brian



<?php
> if(/* logged in, insert code */){
>    $page = "my_secret_directory/".$_REQUEST['p'];
>    if(file_exists($page))
>        readfile($page);
>    else header("HTTP/1.0 404 Not Found");
> }
> ?>



Report this thread to moderator Post Follow-up to this message
Old Post
Brian
04-19-05 08:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Language archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:13 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.