Making a form on my website edit a lua file

SORRY GUYS, the server has gone down thx for all your help and time

I think you should look in selfhtml.org if you can read german.
If Not, look here:
http://www.w3schools.com/html/html_forms.asp
Make that. I will help you with php then.

Dont worry

The easiest way is to use Sql…

The best would probably be SQLite

Ye. I think you can include html(in Derma). And with an Apache server with php support you can set the folder to gmod data folder. That will work i think.

Its not a data folder its a autorun

What ever…

Ok, i quickly made a form.


<html>
<form>
First name:
<input type="text" name="firstname" />
<br />
Email Ad.:
<input type="text" name="Email" />
</form> 
Steam ID:
<input type="text" name="steamid" />
<br />
<br />
<br />

Favorite Gun:<br />
<input type="radio" name="gun" value="mp5" /> mp5
<br />
<input type="radio" name="gun" value="Awp" /> Awp
<br />
<input type="radio" name="gun" value="M3" /> M3 Shotgun
<br />
<br />
<br />
Apply for admin:
<input type="checkbox" name="extras" value="applyforadmin" />
<br />
<form/>
<html/>

Only readout the Steamid and name … or sth else?

While what you’re asking is very possible, it is much, much easier to set up an SQL database, stick the information in there, and grab it from there from Garry’s Mod.

This is great guys. What I heard about facepunch helping coders and answering questions, is all true.

please post the PHP code here or pm me please

Yes I was looking for some thing like this and I have no clue how to do it. I know a fair bit of lua and can understand a lot of stuff, the problem is the PHP I know zero PHP code. So if you guys find a way to get this to work please tell me or private message me.

Also is there a way to make a derma menu with a username/password text field(I know how to make that so I don’t need help with the lua) were the info you submit goes to my server forums and creates a member using the username and password they provided.

We could work together on this, i could code the derma menu and peacemaker could code the php.

Help is greatly appreciated.

100% you can. you can use html in derma.

How do i set gmod up to collect the info from a sql

you could use this DLL:
http://www.facepunch.com/showthread.php?t=241247

its andyvincent’s gm_MySQL Lua DLL Module - v1.8

im just putting this out there but you could use this(i dont know if it will work, i dont use mysql)
[lua]
function Get_Steam()
local res = sql.Query("SELECT * FROM “” … your_table … “” WHERE steamid = “” … steamid … " )

for id, row in pairs (res) do
return tostring(row[‘steamid’])
end
end
[/lua]

then you could use that function to do somthing like this.

[lua]
function Admin_Spawn(ply)
if Get_Steam() == ““Admin_SteamID”” then
ply:GodEnable()
end
end
hook.Add( “PlayerSpawn”, “giveadmingodmode”, Admin_Spawn )
[/lua]

So once i get the dll in lua/includes/modules how do i put stuff in my mysql and how can i make it edit the files in the mysql database

[editline]02:35PM[/editline]

then how do i link it so it puts the file in the sql in lua/autorun

I still need help

Use the primary ID to count up and have the table save as a .lua with fopen.

Use the php documentation and look up the fopen function.

[editline]04:52PM[/editline]

The files in the autorun would be reading directly from the table.
Probably easier then actually making the file with php.

[editline]04:53PM[/editline]


query("INSERT INTO users WHERE steamid='".$steamid."'")

[editline]04:56PM[/editline]

If you are gonna open <html> you should open <body> inside of it.

You don’t really need body tags unless your using headers just neatens up the code a little/

Yea, I will just add the script to one of my pages

Do you need my PHP script now or not ?
edit: Wow. Nivek i can inject scripts in your Mysql in 4 Seconds

Yes please, i do need the php script

May i ask is the script you have a registration screen? that does whatever to mysql

Thx for the help

Yes that would be nice, and maybe some help with installing it into my website(i could get my webmaster to do it for me)

Is this Possible ? (they do the same thing on the PERP servers.)