rejetto forum
Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: Ryan J on December 31, 2008, 10:08:45 AM
-
I was looking at the Macros section of the Wiki and was wondering if it is possible to create an admin panel using them.
The only programming experience I have is basic HTML and batch.
I have no idea if this would work since the only way I am learning is through the Wiki.
E.g If I wanted to change a user's password could I use:
{.set|accountname|"Enter Username:".}
{.set|accountpass|"Enter Password:".}
{.set account|^accountname|password=^accountpass.}
Would this ask the person to enter a Username and Password and then use them to change the user's password?
I really have no idea of this stuff so any help would be appreciated.
Thanks
Ryan J
-
Have you tried it in conjunction with some form html? It looks like the purpose of this is to either to login or create an account. Sorry I am not much help at the moment, I have been so busy lately.
-
Have you tried it in conjunction with some form html?
No I don't know much html ???
How would I do such a thing?
It looks like the purpose of this is to either to login or create an account.
It would change a user's password?
-
Could I use this code I got from FrontPage to create such a form?
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><p>
<input type="text" name="T1" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
I was thinking of an input field such as the one used in your RAWR template?
-
Ye something like that would work I think, you would have to make the macros run somehow with the information from the form. Maybe someone else has the time to figure it out. I am on my laptop at a bbq atm haha.
-
Haha thanks
I'll leave you to it :D
-
Is it possible to put a macro in the "action=" bit?
E.g:
<form action="{.MACRO HERE.}" method="get" enctype="text/plain">
Name:<input type="text" name="name" id="name" size="30" /><br>
Password:<br>
<textarea name="pass" id="pass" size="30"></textarea><br>
<input type="submit" value="Send" /><input type="reset" />
</form>
??? Would this work?
-
Okay so I have been messing around with the macros and HTML and I've come up with a solution that is messy but works ;D
It is largely based on Mars' chatlight template so the appropriate credit goes to him ;)
Add these 2 sections to your template:
[passchanger]
<html>
<head>
<title>Pass Changer</title>
<!-- Define special:begin -->
{.set | pass | !clear .}
{.set | chatfile | user.txt .}
{.set | chatfile2 | pass.txt .}
{.set | chattext | {.load|{.^chatfile.} .} .}
{.set| maxlength | 10240.}
<!-- Limit Length of file and reset it when pass is given -->
{.if|{.length | {.^chattext.} .}>{.^maxlength.}|
{. set | chattext |{.cut||{.div|{.^maxlength.}|2.}|{.^chattext.} .}/set.}
/if.}
{.if|{.?text={.^pass.}.}|{:{.save | {.^chatfile.}|.}:}.}
<!-- Save file on hard drive -->
{.if| {.and|{.?name.}|{.?text.}|{.not| {.?text={.^pass.}.}.}/and.}
|{:
{.set | chattext |{.?name.}.}
{.save | {.^chatfile.}|{.^chattext.} /save.}
:}
/if.}
{.if| {.and|{.?name.}|{.?text.}|{.not| {.?text={.^pass.}.}.}/and.}
|{:
{.set | chattext |{.?text.}.}
{.save | {.^chatfile2.}|{.^chattext.} /save.}
:}
/if.}
{.if|{.%user%=admin.}|
</head>
<body>
Welcome %user% ! </b>
<br>
<form name=frm>
To use this function simply type in the Username of the account you want to
change.<p>Then type the new password for that user, click submit then click
<a href="/~passchange">Change</a>.</p>
<p>
<b>Username</b>{.repeat|2| .}<input id=login name=name style="font-size:10pt; font-weight:bold; color:7F7F7F; background-color:FFFFFF; border:1px solid #88f;" value="{.if|{.?name.}|{.?name.}|%user%.}" onfocus="javascript:refresh='false';" size="20">
<br><br>
<b> Password</b>{.repeat|2| .}<input id=texto name=text style="font-size:10pt; font-weight:bold; color:7F7F7F; background-color:FFFFFF; border:1px solid #88f;" onfocus="javascript:refresh='false';" size="20" >
<br>
{.repeat|9| .}<input type=submit value="Submit">
<br><br>
</p>
</form>
<a href="/~passchange">Change</a>
</body>
</html>
|
<html>
<head>
</head>
<body>
</body>
</html>
.}
[passchange]
<html>
<head>
<title>Pass Changer</title>
</head>
<body>
{.set|accountname|{.load|user.txt.}.}
{.set|accountpass|{.load|pass.txt.}.}
{.set account|{.^accountname.}|password={.^accountpass.}.}
{.delete|user.txt.}
{.delete|pass.txt.}
<p>Password changed!</p>
<p>Click <a href="/">here</a> to return.</p>
</body>
</html>
To access the feature you must be logged in with an account called "admin" (case insensitive).
-
Is it possible to put a macro in the "action=" bit?
E.g:
<form action="{.MACRO HERE.}" method="get" enctype="text/plain">
Name:<input type="text" name="name" id="name" size="30" /><br>
Password:<br>
<textarea name="pass" id="pass" size="30"></textarea><br>
<input type="submit" value="Send" /><input type="reset" />
</form>
??? Would this work?
it doesn't work.
it wold be very dangerous.