Skip to main content

Ensure your page is not opened in a frame

If you want to make sure your website is not opened in a frame from some other website, put this JavaScript in the <head> of your html page:

<script type="text/javascript">
if (top.location != self.location) { top.location.href = self.location.href; }
</script>


Stop direct links to web pages
Want to stop someone from entering your site unless they come in the "front door"?  Or want to keep a frame page from being loaded outside of the frameset?  This script example will not let you load page2 unless you have already loaded page1 in the same browser session.

Note that if someone loads page1 they can then go directly to page2 anytime in the SAME browser session.  But if they close the browser, then next time they must again enter through the "front door".

page1.php has this script:

<?php
session_start
();$_SESSION['valid'] = "yes";
echo 
"Page 1";?>
page2.php has this script:

<?php
session_start
();
if (
$_SESSION['valid'] != "yes") { header("Location: page1.php"); }
echo 
"Page 2";?> 


Adding individual "members only" pages
By combining some of the Tips & Scripts on this page it is possible to make a simple "members only" section on your website.   When a user logs in they are automatically sent to their page, and can not get to anyone else's page.

Use the "setting up password protection" tip to set up a password protected directory.   Let's call that directory members.   Under that members directory have a subdirectory for each member.   For example members/joe and members/jane.

Then in that password protected directory members, use the "Passing user authentication information to PHP" to identify the user and route them to the directory with their name.   So you have a page members/index.php which would contain a script something like this:

- - Start Script Here - -
<?php
$directory 
$_SERVER['REMOTE_USER'];  // directory name is the user nameif (file_exists($directory)) {
  
header("Location: " $directory "/");   // go to the user directory} else {
  
header("Location: http://yourdomain/error.htm");  // not found}?>

- - End Script Here - -

Then you need to secure each individual members subdirectory so no authenticated member can get to another member's subdirectory.   You can do this with another .htaccess file which you put in each member's subdirectory.   But there is no need for another identity verification.   Simply put these three lines in a .htaccess file in each member's subdirectory (this example being for joe):

RewriteEngine On
RewriteCond %{REMOTE_USER} !^joe
RewriteRule .$ http://yourdomain.com/error.htm [L]


In this example, if anyone other than joe tries to access anything in that subdirectory they will get the error page.

In summary:

  1. A member always goes to page domain.com/members.   If the member is not logged in they will get the login prompt and then be sent to their page.   If the member has already logged in, they will just be sent to their page.
  2. Using this method you must put each member name in the htpasswd file for authentication, use that name as a directory name, and put that name in the htaccess file for that directory.   So it is not maintenance free - but it is very secure, easy and "light weight".   Note that all this is case sensitive, Joe is not the same as joe.   The .htpasswd member name must match the dirctory name which must match the name used in the .htaccess for that directory.
Load a random image
This example will randomly load image1.jpg through image99.jpg.   Just place this JavaScript where you want the image.

<script type="text/javascript">
nRandom = Math.ceil(Math.random() * 99);
document.write ('<img src="image' + nRandom + '.jpg">');
</script>

Comments

Popular posts from this blog

links

0.  https://michael67654.qowap.com/64523001/new-pos-technique-to-perk-up-your-company 1.  https://johnnydinqr.blog2learn.com/52856602/new-pos-system-to-perk-up-your-company 2.  http://edwinsqgcu.onesmablog.com/New-POS-Process-to-Perk-Up-Your-company-43309737 3.  http://chloe69246.bloguetechno.com/New-POS-Process-to-Perk-Up-Your-Business-39814721 4.  http://jacob87541.pointblog.net/New-POS-Technique-to-Perk-Up-Your-online-business-43741223 5.  http://arlette53302.thezenweb.com/New-POS-System-to-Perk-Up-Your-online-business-41464611 6.  http://devinpixna.tinyblogging.com/New-POS-Program-to-Perk-Up-Your-online-business-46354577 7.  https://rylanevsom.blog5.net/46759651/new-pos-program-to-perk-up-your-small-business 8.  https://mariowoesh.affiliatblogger.com/56515206/new-pos-system-to-perk-up-your-organization 9.  https://liam66429.diowebhost.com/60164326/new-pos-procedure-to-perk-up-your-company 10.  https://henry19219.fitnell.com/4557...

Raisonnement, la résolution de problèmes

Les chercheurs ont d'abord développé des algorithmes mimétiques raisonnement humain étapes que les gens utilisent pour résoudre le casse-tête ou faire méthode d'exclusion logique. [2] Dans les années 1980 et 1990 fin, l'étude de la grippe aviaire a développé des méthodes de traitement de l'information incertaine ou incomplète, en utilisant des concepts de probabilité et de l'économie. [3] Pour ces problèmes, les algorithmes requis matériel assez puissant pour effectuer des calculs de géant - à subir « combinaisons d'explosion »: la quantité de mémoire et le temps de calcul peut devenir invisible prendre si la résolution d'un problème difficile. La plus haute priorité est l'algorithme de recherche pour résoudre le problème.  Les gens utilisent généralement les jugements rapides et intuitifs plutôt que pas de déduction que les chercheurs en IA d'origine peuvent simuler. [5] Amnesty International a progressé en utilisant la résolution de problèmes « c...

Tracking and Securing Downloads

If you want to report or track downloads from your website, try this script.   This script will send you an email every time you have a download.   The email will tell you what file was downloaded and who did the download.   You could change this script to keep counts (store them in flat file or MySQL) if you desire. The variable $directory is the directory where the download files are located.   If you want the script in the same directory as the files then use "./" as the directory (you must always have the slash). In your html page, use the following structure as your download link (where name.txt is the file name to download): <a href="download.php?file=name.txt">download</a> Then you use the following script (called download.php): - - Start Script Here - - <?php $emailaddress  =  "email@yourdomain.com" ; $filename  =  $_GET [ 'file' ]; $directory  =  "downloads/" ; $path  =  "$directory$filename" ; putenv (...