Skip to content
Snippets Groups Projects
Commit 8ef94170 authored by echicken's avatar echicken
Browse files

Make the 'help' feature actually work with the new ecweb.

parent c1fa9159
No related branches found
No related tags found
No related merge requests found
// ASCII Art Captcha for Synchronet 3.16+
// echicken -at- bbs.electronicchicken.com
// (Carried over from ecWeb v2)
load('webInit.ssjs');
function insertCaptcha() {
var d = directory("../web/lib/captchaAnsis/*");
......@@ -10,38 +11,37 @@ function insertCaptcha() {
}
var f = directory(d[randomFont] + "*.a??");
var captchaString = "";
print("<div style='background-color:black;height:100px;float:left;'>");
var out = "<div style='background-color:black;height:100px;float:left;'>";
for(i = 0; i < webIni.captchaLength; i++) {
var randomLetter = Math.floor(Math.random() * (f.length));
var g = new File(f[randomLetter]);
g.open("r");
var h = g.read();
g.close();
h = html_encode(h);
print("<pre style='font-face:monospace;font-family:courier new,courier,fixedsys,monospace;background-color:black;float:left;padding-right:5px;'>" + h + "</pre>");
out += "<pre style='font-face:monospace;font-family:courier new,courier,fixedsys,monospace;background-color:black;float:left;padding-right:5px;'>";
out += html_encode(h);
out += "</pre>";
captchaString = captchaString + file_getname(f[randomLetter]).replace(file_getext(f[randomLetter]), "")
}
print("</div><br style=clear:both;/><br />");
print("<input class='border font' type=text size=" + webIni.captchaLength + " name=letters1> Enter the letters shown above (<a class=link href=./lib/captchaLib.ssjs?font=" + randomFont + " target=_blank>Help</a>)<br /><br />");
print("<input type=hidden name=letters2 value=" + md5_calc(captchaString.toUpperCase(), hex=true) + ">");
}
out += "</div>";
if(http_request.query.hasOwnProperty("font")) {
load('webInit.ssjs');
openPage("Captcha Help");
print("<span class=headingFont>CAPTCHA Help</span><br /><br />");
print("Having trouble reading the CAPTCHA? Compare what you see in the CAPTCHA box to the letters in the alphabet below.<br />(Note: this CAPTCHA uses letters, not numbers, and is not case sensitive.)<br /><br />");
out += "<div id='captchaHelp' style='clear:both;display:none;'><span class=headingFont>CAPTCHA Help</span><br /><br />";
out += "Having trouble reading the CAPTCHA? Compare what you see in the CAPTCHA box to the letters in the alphabet below.<br />(Note: this CAPTCHA uses letters, not numbers, and is not case sensitive.)<br /><br />";
var d = directory("../web/lib/captchaAnsis/*");
if(parseInt(http_request.query.font) < d.length) {
var f = directory(d[parseInt(http_request.query.font)] + "/*");
for(g in f) {
var h = new File(f[g]);
h.open("r");
i = h.read();
h.close();
i = html_encode(i);
print("<pre style='font-face:monospace;font-family:courier new,courier,fixedsys,monospace;background-color:black;height:100px;padding-right:5px;float:left;'>" + i + "</pre>");
}
var f = directory(d[randomFont] + "/*");
for(g in f) {
var h = new File(f[g]);
h.open("r");
i = h.read();
h.close();
i = html_encode(i);
out += "<pre style=\'font-face:monospace;font-family:courier new,courier,fixedsys,monospace;background-color:black;height:100px;padding-right:5px;float:left;\'>" + i + "</pre>";
}
closePage();
}
out += "</div><br style='clear:both;' /><br />";
out += "<input class='border font' type='text' size=" + webIni.captchaLength + " name='letters1'> Enter the letters shown above (<a onclick='toggleVisibility(\"captchaHelp\")'>Help</a>)<br /><br />";
// Low risk, but this should probably be written to a file somewhere instead. -ec
out += "<input type='hidden' name='letters2' value='" + md5_calc(captchaString.toUpperCase(), hex=true) + "' />";
print(out);
return randomFont;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment