Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component {
- variables.randomUrls = "";
- public function init() {
- writelog(file="application", text="Misery init");
- }
- public function setRandomUrls(string s) {
- variables.randomUrls = arguments.s;
- }
- public function enactMisery() {
- var rnd = randRange(1,100);
- if(rnd < 40) {
- writeLog(file="application",text="Misery: Delay");
- sleep(1000 * randRange(1,4));
- } else if(rnd < 50) {
- writeLog(file="application",text="Misery: White Screen of Death");
- abort;
- } else if(rnd < 60) {
- writeLog(file="application",text="Misery: Wrong page");
- if(len(variables.randomUrls)) {
- var newurl = listGetAt(variables.randomUrls, randRange(1, listLen(variables.randomUrls)));
- location(url=newurl,addtoken=false);
- }
- } else if(rnd < 65) {
- writeLog(file="application",text="Misery: 403 Header");
- include "403header.cfm";
- } else if(rnd < 70) {
- writeLog(file="application",text="Misery: 404 Header");
- include "404header.cfm";
- } else if(rnd < 80) {
- writeLog(file="application",text="Misery: Kill random form field.");
- var keys = structKeyList(form);
- if(len(keys)) {
- var toKillNum = randRange(1, listLen(keys));
- for(var i=1; i<=toKillNum; i++) {
- var chosen = randRange(1, listLen(keys));
- var chosenKey = listGetAt(keys, chosen);
- writeLog(file="application",text="Misery: Removing form.#chosenkey#");
- structDelete(form, chosenKey);
- keys = listDeleteAt(keys, chosen);
- }
- }
- }
- writelog(file="application", text="Done with Misery");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement