PDA

View Full Version : Custom page Form - Need some help


tinuz
04-10-2017, 06:55 PM
Hey everyone!

I'm currently working on a custom page that includes a form. The form will update a modified template in the database, using vbulletin's own template.php file to do so.

The problem is, it requires a couple of POST request variables that I can't simply input manually. These are:

<input name='adminhash' value='' type='hidden'>
<input name='securitytoken' value='' type='hidden'>
<input name='lastedit' value='' type='hidden'>
<input name='hash' value='' type='hidden'>

I don't need to know how to include these in a custom page. I just need to know how to include these in a custom php file that is hooked to the forum by requiring global.php

PS:

For those interested: The reason I'm using vbulletin's own template.php file is because I've noticed that any direct changes to the database for a custom template won't actually go live on the forum. It seems that the template.php file is doing some other stuff that makes the changes go live.

--------------- Added 1491871875 at 1491871875 ---------------

I've solved most of the problems myself.

Admin hash:

if (!defined('ADMINHASH'))
{
define('ADMINHASH', md5(COOKIE_SALT . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']));
}

Security Token (through template):
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />

Hash:
md5(template_un column from database)

The only thing I miss is the lastedit. I don't believe this one is really required, but to keep it clean I'd prefer to have it as well. So if anyone knows this one, please do let me know :)