I am having a bit of a problem writing to the database using a form for a league hosting application I am developing. It is located outside of my forums subfolder (however I don't think that has anything to do with it).
Anyway here is the code:
register.php:
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'League Registration'); // 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( 'League Registration', );
// pre-cache templates used by specific actions $actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################ // ============================================ // Enter the full path to your forum here // Example: /home/vbadvanced/public_html/forum // ============================================
$forumpath = '/apache/htdocs/forums/';
// ============================================ // No Further Editing Necessary! // ============================================
if ($forumpath) { if (!is_dir($forumpath)) { echo 'Invalid forum path specified! Please edit this file and be sure to include the correct path for your $forumpath variable.'; exit; }
// League Name error checking if (!$leaguename) { standard_error('Please enter a league name.'); } else { // Check length $subleague = stripslashes($leaguename); if(strlen($subleague) < 6) { standard_error('League name is below 6 characters.'); } else if(strlen($subleague) > 30) { standard_error('League name is above 30 characters.'); } // Check if league name is not alphanumeric */ else if(!eregi("^([0-9a-z])+$", $subleague)) { standard_error('League name is not alphanumeric.'); } }
// Password error checking if(!$leaguepassword) { standard_error('Password not entered.'); } else { // Check length $subpass = stripslashes($leaguepassword); if(strlen($subpass) < 6) { standard_error('Password is below 6 characters.'); } /* Check if password is not alphanumeric */ else if(!eregi("^([0-9a-z])+$", ($subpass = trim($subpass)))) { standard_error('Password is not alphanumeric.'); } /* Confirm Password */ else if($subpass != $leaguepasswordconfirm) { standard_error('Passwords do not match.'); } }