rejetto forum

Macro Help: Possible Admin Panel?

Ryan J · 9 · 6333

0 Members and 1 Guest are viewing this topic.

Offline Ryan J

  • Occasional poster
  • *
    • Posts: 38
  • Soon to be coder...
    • View Profile
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:
Code: [Select]
{.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
« Last Edit: January 01, 2009, 05:35:40 AM by Ryan J »


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
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.


Offline Ryan J

  • Occasional poster
  • *
    • Posts: 38
  • Soon to be coder...
    • View Profile
Quote
Have you tried it in conjunction with some form html?
No I don't know much html ???
How would I do such a thing?
Quote
It looks like the purpose of this is to either to login or create an account.
It would change a user's password?
« Last Edit: January 01, 2009, 06:12:35 AM by Ryan J »


Offline Ryan J

  • Occasional poster
  • *
    • Posts: 38
  • Soon to be coder...
    • View Profile
Could I use this code I got from FrontPage to create such a form?
Code: [Select]
<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?
« Last Edit: January 01, 2009, 06:22:11 AM by Ryan J »


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
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.


Offline Ryan J

  • Occasional poster
  • *
    • Posts: 38
  • Soon to be coder...
    • View Profile
Haha thanks
I'll leave you to it :D
« Last Edit: January 02, 2009, 04:25:13 AM by Ryan J »


Offline Ryan J

  • Occasional poster
  • *
    • Posts: 38
  • Soon to be coder...
    • View Profile
Is it possible to put a macro in the "action=" bit?
E.g:
Code: [Select]
<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?


Offline Ryan J

  • Occasional poster
  • *
    • Posts: 38
  • Soon to be coder...
    • View Profile
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:
Code: [Select]
[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|&nbsp;.}<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>&nbsp;Password</b>{.repeat|2|&nbsp;.}<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|&nbsp;.}<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).
« Last Edit: January 02, 2009, 05:35:32 AM by Ryan J »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
Is it possible to put a macro in the "action=" bit?
E.g:
Code: [Select]
<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.