Your HostICan Community  


Go Back   Your HostICan Community > Programming & Design > HTML / Design

HTML / Design Are you a designer? Or just trying to become one? Great! You'll be able to talk about layouts, and HTML code to help your fellow designers, so everyone can work together to master the tricks of the trade. (Maybe even some JavaScript too!)

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-08-2009, 01:14 PM
PIRANIA PIRANIA is offline
Junior Member
 
Join Date: Jan 2009
Location: small town
Posts: 3
Default hide css files from hosting web folders

Hey when I open my website with full path to my css file can see it.
Code:
http://www.mydomain.com/css/style.css
In browser are shown my css file. How to hide this file?
Reply With Quote
  #2  
Old 05-08-2009, 01:42 PM
index's Avatar
index index is offline
Moderator
 
Join Date: Aug 2008
Location: Italy
Posts: 201
Default Re: hide css files from hosting web folders

In the folder with the css files do file ndex.php with the following content:
PHP Code:
<?php session_start(); $_SESSION['csskey'] = "hello"?> <html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> Hello World </body> </html>
Then make a style.php file with this content:
PHP Code:
<?php session_start(); header("Content-type: text/css"); if ($_SESSION["csskey"] != "hello") { die("Protected"); } $_SESSION["csskey"] = "somethingelse"?> body { background-color: #000; color: #fff; }
Finally make a .htaccess file:
Code:
RewriteEngine on
RewriteRule style.css style.php
Reply With Quote
  #3  
Old 05-09-2009, 01:27 AM
PIRANIA PIRANIA is offline
Junior Member
 
Join Date: Jan 2009
Location: small town
Posts: 3
Default Re: hide css files from hosting web folders

Is it possible to hide my css file without using of .htaccess file? So much .htaccess file I will be confused.
Reply With Quote
  #4  
Old 05-09-2009, 02:03 AM
Vron's Avatar
Vron Vron is offline
Member
 
Join Date: Jan 2009
Posts: 83
Default Re: hide css files from hosting web folders

In the page where are includes a CSS file, write this on top:
PHP Code:
<?php
session_start
();
$_SESSION['samplekey'] = "authorization";
?>
Then rename the CSS file from .css to .php and edit this file. Add these lines in the top:
PHP Code:
<?php
session_start
();
if (
$_SESSION["samplekey"] != "authorization")
{
die(
"restricted file");
}
$_SESSION["samplekey"] = "noauthorization";
?>
Next in index.php file you should use include thus:
PHP Code:
<style type="text/css">
@
import "style.php";
</
style
Reply With Quote
  #5  
Old 05-18-2009, 09:52 PM
nkkiegem123 nkkiegem123 is offline
Senior Member
 
Join Date: May 2009
Posts: 116
Default Re: hide css files from hosting web folders

thanks for this share..i also have the same problem..
Reply With Quote
  #6  
Old 08-19-2009, 08:48 PM
dark17 dark17 is offline
Junior Member
 
Join Date: Aug 2009
Posts: 1
Default Re: hide css files from hosting web folders

Unfortunately, both of these techniques don't hide the CSS files from appearing or to be traced down, e.g. using the FireBug firefox addon.

In another place,
Hide your CSS Source - PHP Code Snippet

I think this perhaps works effective, I tested it partially, due to my lack of php_myadmin.

It requires to create a mysql table, like this

table -> style

But I don't know how to create this MySql table and what is `style', is it a table in the 'table' database?

what are the arguments to be filled? I'm using the XAMPP for php/mysql.

Thank you
Reply With Quote
  #7  
Old 08-22-2009, 11:18 PM
johnnytwo johnnytwo is offline
Junior Member
 
Join Date: Aug 2009
Posts: 3
Default Re: hide css files from hosting web folders

Vron I tried that and its not working for me any ideas?
Reply With Quote
Reply

Tags
css, files, folders, hide, hosting, web

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 03:08 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Copyright © 2003 - 2008 HostICan. All Rights Reserved.