So I am still working on my mod, where the admin can create, lets say a new artist.
I can get the page to show up, everything looks good, when I go to submit the form, nothing happens.
Here is the Php Code
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'vbmusic_create_artist');
define('CSRF_PROTECTION', true);
// change this depending on your filename
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array('vbmusic_create_artist',
);
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$navbits = construct_navbits(array('' => 'Create Artist'));
$navbar = render_navbar_template($navbits);
// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'Create Artist';
if ($_POST['do'] == 'createartist')
{
if ($createartist=='send') {
$name = $vbulletin->input->clean_gpc('p', 'name', TYPE_STR);
$dbirth = $vbulletin->input->clean_gpc('p', 'dbirth', TYPE_UINT);
$country = $vbulletin->input->clean_gpc('p', 'country', TYPE_STR);
$homepage = $vbulletin->input->clean_gpc('p', 'homepage', TYPE_STR);
if ($name!='') {
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "artist
(arname, dbirth, lbirth, homepage)
VALUES ('".$name."','".$dbirth."', '".$country."') ");
$id = $vbulletin->db->insert_id();
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "artdescr
(arid, ardescr)
VALUES (
'".$vbulletin->db->escape_string($id)."',
'".$vbulletin->db->escape_string('')."'
");
//$vbulletin->url = "forms.php?do=editform&fid=$id";
eval(print_standard_redirect('redirect_insertform'));
//if ($save) $mess="Your data was successfully saved.";
// else $mess="There was an SQL error!";
}
//else $mess="Please provide a name!";
}
}
// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######
$templater = vB_Template::create('vbmusic_create_artist');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('dbirth', $dbirth);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
?>
Here is the template
PHP Code:
{vb:stylevar htmldoctype}
<html xmlns="http://www.w3.org/1999/xhtml" dir="{vb:stylevar textdirection}" lang="{vb:stylevar languagecode}" id="vbulletin_html">
<head>
<title>{vb:raw vboptions.bbtitle} - {vb:raw pagetitle}</title>
{vb:raw headinclude}
{vb:raw headinclude_bottom}
</head>
<body>
{vb:raw header}
{vb:raw navbar}
<br />
<div class="colmask leftmenu">
<div class="colleft">
<div class="col1">
<!-- Column 1 start -->
<div class="audio_head">Create Artist</div>
<div class="audio_body">
<!--<form action="./vbmusic_create_artist.php" method="post">-->
<form class="vbform block" action="vbmusic_create_artist.php?do=createartist" method="post" name="vbform" onsubmit="return .prepare_submit(0, 0)">
<input type="hidden" name="do" value="insertform" />
<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<table align="center" cellspacing="0" cellpadding="0" width="100%" class="tablec">
<tr>
<td valign="top" align="center">
<table align="center" cellspacing="10" cellpadding="0" width="100%">
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<tr>
<td style="width:35%;" align="right">Name :</td>
<td style="width:65%;" align="left">
<input type="text" name="name" size="50" value="">
</td>
</tr>
<tr>
<td align="right" class="data1">Date of birth :</td>
<td align="left">
<input type="text" name="{vb:raw dbirth}" size="50" value="">
</td>
</tr>
<tr>
<td align="right" >Land of birth :</td>
<td align="left">{vb:raw lbirth}</td>
</tr>
<tr>
<td align="right" >Homepage :</td>
<td align="left">
<input type="text" name="{vb:raw homepage}" size="50" value="">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table align="center" cellspacing="0" cellpadding="0" width="100%" >
<tr>
<td valign="top" align="center">
<table align="center" cellspacing="10" cellpadding="0" width="100%">
<tr>
<td style="width:35%;" align="right" class="data1">Upload image from URL :</td>
<td style="width:65%;" align="left">
<input type="hidden" name="MAX_FILE_SIZE" value="".($csiz*1024)."\" />
<input class="text" type="text" name="covurl" size="55" >
</td>
</tr>
<tr>
<td align="right">Upload image from your PC :</td>
<td align="left">
<input type="hidden" name="MAX_FILE_SIZE" value="".($csiz*1024)."" />
<input type="file" name="covfil" size="50" accept="image/jpeg">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table align="center" cellspacing="20" cellpadding="0" width="100%" class="tablec">
<tr>
<td valign="middle" align="center"><input class="button" type="submit" value="Submit!"></td>
</tr>
</table>
</form>
</div>
<!-- Column 1 end -->
</div>
<div class="col2">
<!-- Column 2 start -->
<div class="audio_head">Menu</div>
<div class="audio_body">
<table align="center" cellspacing="0" cellpadding="0" width="100%" >
<tr>
<td valign="top" align="center">
<table align="center" cellspacing="5" cellpadding="0" width="100%">
<tr>
<td align="left"><a href="vbmusic.php" title="" alt="">- Music Home</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"browse.php?typ=artist\" title=\"\" alt=\"\">- Browse Artist</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"browse.php?typ=album\" title=\"\" alt=\"\">- Browse Albums</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"browse.php?typ=genre\" title=\"\" alt=\"\">- Browse Genre</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"import.php\" title=\"\" alt=\"\">- Import Albums</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"config.php\" title=\"\" alt=\"\">- Config Settings</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"usr_list.php\" title=\"\" alt=\"\">- Userlist</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"showlog.php\" title=\"\" alt=\"\">- Show Log</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"stats.php\" title=\"\" alt=\"\">- Statistics</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"create_artist.php\" title=\"\" alt=\"\">- Create artist</a></td>
</tr>
<tr>
<td align=\"left\"><a href=\"del_artist.php\" title=\"\" alt=\"\">- Delete artist</a></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<!-- Column 2 end -->
</div>
</div>
</div>
{vb:raw footer}
</body>
</html>
Also, I would I go about getting the select a option info from the database.