Advertisement
cfjedimaster

Untitled

Apr 9th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. component {
  2.  
  3.     variables.randomUrls = "";
  4.    
  5.     public function init() {
  6.         writelog(file="application", text="Misery init");
  7.     }
  8.  
  9.     public function setRandomUrls(string s) {
  10.         variables.randomUrls = arguments.s;
  11.     }
  12.    
  13.     public function enactMisery() {
  14.         var rnd = randRange(1,100);
  15.         if(rnd < 40) {
  16.             writeLog(file="application",text="Misery: Delay");
  17.             sleep(1000 * randRange(1,4));  
  18.         } else if(rnd < 50) {
  19.             writeLog(file="application",text="Misery: White Screen of Death");
  20.             abort;
  21.         } else if(rnd < 60) {
  22.             writeLog(file="application",text="Misery: Wrong page");
  23.             if(len(variables.randomUrls)) {
  24.                 var newurl = listGetAt(variables.randomUrls, randRange(1, listLen(variables.randomUrls)));
  25.                 location(url=newurl,addtoken=false);   
  26.             }  
  27.         } else if(rnd < 65) {
  28.             writeLog(file="application",text="Misery: 403 Header");
  29.             include "403header.cfm";
  30.         } else if(rnd < 70) {
  31.             writeLog(file="application",text="Misery: 404 Header");
  32.             include "404header.cfm";
  33.         } else if(rnd < 80) {
  34.             writeLog(file="application",text="Misery: Kill random form field.");
  35.             var keys = structKeyList(form);
  36.             if(len(keys)) {
  37.                 var toKillNum = randRange(1, listLen(keys));
  38.                 for(var i=1; i<=toKillNum; i++) {  
  39.                     var chosen = randRange(1, listLen(keys));
  40.                     var chosenKey = listGetAt(keys, chosen);
  41.                     writeLog(file="application",text="Misery: Removing form.#chosenkey#");
  42.                     structDelete(form, chosenKey);
  43.                     keys = listDeleteAt(keys, chosen)
  44.                 }  
  45.             }
  46.         }
  47.  
  48.         writelog(file="application", text="Done with Misery");     
  49.     }
  50.    
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement