[Openfirst-cvscommit] base/includes .cvsignore,NONE,1.1 auth.php,NONE,1.1 db_setup.php,NONE,1.1 dbas
Brought to you by:
xtimg
From: Astronouth7303 <ast...@us...> - 2005-05-25 21:44:39
|
Update of /cvsroot/openfirst/base/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15151/includes Added Files: .cvsignore auth.php db_setup.php dbase.php sitesettings.tpl Log Message: -Adding /style and /includes directories -Moving /images to /style/images -Moving appropriate files out of config -Updating ignore files --- NEW FILE: sitesettings.tpl --- <?php /* * openFIRST base configuration file * This file has been automatically generated by first.php. * it contains the basic configuration options required to * operate the OpenFIRST web portal software. Note, that * most configuration options are now stored in the MySQL * database, in the ofirst_config table. */ $dbasetype = %DBTYPE%; $encryption = %ENCRYPT%; $title = %TITLE%; $version = %VER%; $sqlserver = %DBSERVER%; $sqluser = %DBUSER%; $sqlpassword = %DBPASS%; $sqldatabase = %DBNAME%; $sqlconnection = ofirst_dbconnect("$sqlserver","$sqluser","$sqlpassword"); ofirst_select_db($sqldatabase); $pass_save_disabled=%COOKIE%; $regenabled=%REG%; $home = %HOME%; $header = %HEADER%; $footer = %FOOTER%; $mailnotify = %MASTERMAIL%; $mailfrom = %BOTMAIL%; $server = %SERVER%; $basepath = %BASEPATH%; $fbasepath = %FBASEPATH%; ?> --- NEW FILE: auth.php --- <?php /* * openFIRST.base - config/auth.php * * Copyright (C) 2003, * openFIRST Project * Original Author: Tim Ginn <tim...@po...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Purpose: Deal with authorization of users. require_once('dbase.php'); if(isset($encryption) == false) { $encryption = "crypt"; } // Provide functions for the various encryption types... // syntax: cryptpassword(password, encryption-type, salt); function cryptpassword ($password, $enctype = false, $salt="") { global $encryption; if ($enctype === false) $enctype = $encryption; // Encrypt passwords using whatever algorithm is preferred. if ($enctype == "crc32") { return(crc32($password)); } else if ($enctype == "sha1") { return(sha1($password)); } else if ($enctype == "crypt") { return(crypt($password, $salt)); } else { return(md5($password)); } } function logout(){ if(isset($GLOBALS["user"]->user)) { $q = ofirst_dbquery("UPDATE ofirst_members SET authcode = NULL WHERE user='".$GLOBALS["user"]->user."';"); } } function showlogin () { // Show a login form for the user. echo("<br /><br />"); if (isset($_POST["login"]) && !isset($user)) { echo '<div class="error">Invalid username or password!</div>'; } echo "<form action='". $_SERVER["PHP_SELF"] . "' method='post'>"; if(isset($_SERVER["HTTP_REFERER"])){ echo("<input name='referer' type='hidden' value='".$_SERVER["HTTP_REFERER"]."'/>"); } echo "<table width='200' class='center' id='login'> <caption>Account Login</caption> <tr> <td><div align='right'>Username:</div></td> <td><input name='login' type='text' /> </td> </tr> <tr> <td><div align='right'>Password:</div></td> <td> <input name='password' type='password' /></td> </tr> <tr> <td colspan='2'><input type=\"submit\" value=\"Login\" />"; global $pass_save_disabled; if(!(isset($pass_save_disabled) && $pass_save_disabled)){ echo " <br /><input type=checkbox name=savepass id=savepass value=1 checked /><label for=savepass>Save Password</label>"; } echo "</td></tr> <tr><td colspan='2'><a href=\"".$GLOBALS["basepath"]."/members/forgotten.php\">Forgot Password</a></td></tr> </table>"; // Include anything else in the post, so it is forwarded to the actual form unset($_POST['login'], $_POST['password']); foreach($_POST as $name => $value) { echo '<input type="hidden" name="'.htmlentities($name).'" value="'.htmlentities($value).'" />'; } echo "</form><br /><br />"; return(0); } function InitUser() { global $pass_save_disabled, $encryption, $user; // Determine if the user has already logged in with this session. If // they have, set variables indicating this. If they have not, make a // note of this so that components requiring them to log in are disabled. if ( (isset($_SESSION['authcode'])) || (isset($_COOKIE["openFIRSTlogin"]) && !$pass_save_disabled) ) { if (isset($_SESSION['authcode'])) { $authcode = $_SESSION['authcode']; } else if (isset($_COOKIE["openFIRSTlogin"]) && $_COOKIE["openFIRSTlogin"] != 0) { $authcode = $_COOKIE["openFIRSTlogin"]; $_SESSION['authcode'] = $authcode; //renew cookie setcookie("openFIRSTlogin", $authcode, time()+2592000, "/"); } else { $authcode = 0; } $query = ofirst_dbquery("SELECT * FROM ofirst_members WHERE authcode='$authcode';"); if (ofirst_dberrno() == 0 && ofirst_dbnum_rows($query) == 1 && $authcode != 0 ) { $user = ofirst_dbfetch_object($query); } else { unset($_SESSION['authcode']); if(!isset($pass_save_disabled)){ //delete cookie setcookie("openFIRSTlogin"," ",time()-3600,"/"); } if (isset($_POST["login"])){ $query = ofirst_dbquery("SELECT * FROM ofirst_members WHERE user='" . $_POST["login"] . "';"); if (ofirst_dberrno() == 0) { $user = ofirst_dbfetch_object($query); if (ofirst_dbnum_rows($query) == 1) { if (cryptpassword($_POST["password"], false, $user->password) == $user->password) { session_register("authcode"); mt_srand(microtime() * 1000000); $_SESSION["authcode"] = (microtime()|mt_rand(1,mt_getrandmax())).substr(gethostbyaddr($_SERVER["REMOTE_ADDR"]),0,40); $aquery = ofirst_dbquery("UPDATE ofirst_members SET authcode='" . $_SESSION["authcode"] . "' WHERE user='" . $_POST["login"] . "';"); } else { unset($user); } } } } } } elseif (isset($_POST["login"]) && isset($_POST["password"])) { $query = ofirst_dbquery("SELECT * FROM ofirst_members WHERE user='{$_POST['login']}';"); if (ofirst_dberrno() == 0) { $user = ofirst_dbfetch_object($query); if (ofirst_dbnum_rows($query) == 1) { if (cryptpassword($_POST["password"], $encryption, $user->password) == $user->password) { session_register("authcode"); mt_srand(microtime() * 1000000); $_SESSION["authcode"] = (microtime()|mt_rand(1,mt_getrandmax())).substr($_SERVER["REMOTE_HOST"],0,40); $aquery = ofirst_dbquery("UPDATE ofirst_members SET authcode='" . $_SESSION["authcode"] . "' WHERE user='" . $_POST["login"] . "';"); if(!isset($pass_save_disabled)){ if(isset($_POST["savepass"])&&$_POST["savepass"]="1"){ //save authcode in a cookie setcookie("openFIRSTlogin",$_SESSION["authcode"],time()+2592000,"/"); } else { //delete cookie setcookie("openFIRSTlogin"," ",time()-3600,"/"); unset($_COOKIE["openFIRSTlogin"]); } } } else { # invalid password! unset($user); } } } else { # invalid user! unset($user); } } if(isset($user->user)){ $query = "UPDATE ofirst_members SET lastseen='" . date("h:i:s M d, Y") . "' WHERE user='$user->user';"; $q = ofirst_dbquery($query); unset($q); } } ?> --- NEW FILE: dbase.php --- <?php /* * openFIRST.base - config/dbase.php * * Copyright (C) 2003, * openFIRST Project * Original Author: Tim Ginn <tim...@po...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Purpose: Provide database functionality so that each module is // able to easily switch between, say, MySQL and MSSQL databases // without having to be completely rewritten or released as two // different versions. $lastquery = ''; if(isset($dbasetype) == false) { $dbasetype = "mysql"; } $connectdsn = ""; if(isset($peardb) && $peardb) { // Include the PEAR Database Abstraction Layer include_once("DB.php"); } elseif(! isset($peardb)) { $peardb = false; } // Wrapper for database selection. function ofirst_dbconnect($server = "", $username = "", $password = "", $newlink = "", $intclientflags = "") { global $dbasetype, $connectdsn; if($dbasetype == "mysql") { if(function_exists("mysql_connect") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); } if($intclientflags != "") { return(mysql_connect($server, $username, $password, $newlink, $intclientflags)); } elseif($newlink != "") { return(mysql_connect($server, $username, $password, $newlink)); } else { return(mysql_connect($server, $username, $password)); } } elseif ($dbasetype == "mssql") { if(function_exists("mssql_connect") == false) { die("Microsoft SQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable Microsoft SQL support, or choose another database type."); } return(mssql_connect($server, $username, $password)); } elseif ($dbasetype == "odbc") { if(function_exists("odbc_connect") == false) { die("ODBC support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable ODBC support, or choose another database type."); } if($newlink != "") { return(odbc_connect($server, $username, $password, $newlink)); } else { return(odbc_connect($server, $username, $password)); } } exit(0); } function ofirst_select_db($databasename, $linkidentifier = "") { global $dbasetype, $connectdsn; if($dbasetype == "mysql") { if(function_exists("mysql_select_db") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); } if($linkidentifier != "") { return(mysql_select_db($databasename, $linkidentifier)); } else { return(mysql_select_db($databasename)); } } elseif ($dbasetype == "mssql") { if(function_exists("mssql_select_db") == false) { die("Microsoft SQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable Microsoft SQL support, or choose another database type."); } if($linkidentifier != "") { return(mssql_select_db($databasename, $linkidentifier)); } else { return(mssql_select_db($databasename)); } //ODBC does not require slecting a DB } exit(0); } function ofirst_dberrno($linkidentifier = "") { global $dbasetype; if($dbasetype == "mysql") { if(function_exists("mysql_errno") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); } if($linkidentifier != "") { return(mysql_errno($linkidentifier)); } else { return(mysql_errno()); } } elseif ($dbasetype == "mssql") { if(function_exists("mssql_connect") == false) { die("Microsoft SQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable Microsoft SQL support, or choose another database type."); } return(0); } elseif ($dbasetype == "odbc") { if(function_exists("odbc_error") == false) { die("ODBC support is not enabled in your version of PHP. To use the openFIRST Web Portal Software, please either enable ODBC support, or choose another database type."); } if($linkidentifier != "") { return(odbc_error($linkidentifier)); } else { return(odbc_error()); } } exit(0); } function ofirst_dberror($linkidentifier = "") { global $dbasetype; if($dbasetype == "mysql") { if(function_exists("mysql_error") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); } if($linkidentifier != "") { return(mysql_error($linkidentifier)); } else { return(mysql_error()); } } elseif ($dbasetype == "mssql") { if(function_exists("mssql_connect") == false) { die("Microsoft SQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable Microsoft SQL support, or choose another database type."); } return(0); } elseif ($dbasetype == "odbc") { if(function_exists("odbc_errormsg") == false) { die("ODBC support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable ODBC support, or choose another database type."); } if($linkidentifier != "") { return(odbc_errormsg($linkidentifer)); } else { return(odbc_errormsg()); } } exit(0); } function ofirst_dbquery($string, $linkidentifier = "", $batchsize = "") { global $dbasetype, $sqlconnection, $lastquery; $lastquery = "\$string = \"$string\", \$linkidentifier = \"$linkidentifier\", \$batchsize = \"$batchsize\""; if($dbasetype == "mysql") { if(function_exists("mysql_query") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); } if($linkidentifier != "") { return(mysql_query($string, $linkidentifier)); } else { return(mysql_query($string)); } } elseif($dbasetype == "mssql") { if(function_exists("mssql_query") == false) { die("Microsoft SQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable Microsoft SQL support, or choose another database type."); } if($batchsize != "") { return(mssql_query($string, $linkidentifier, $batchsize)); } elseif($linkidentifier != "") { return(mssql_query($string, $linkidentifier)); } else { return(mssql_query($string)); } } elseif ($dbasetype == "odbc") { if(function_exists("odbc_exec") == false) { die("ODBC support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable ODBC support, or choose another database type."); } // Note: this may be misleading, the variable names are not reflective of their content in this particular line, as the odbc function uses an order different from the other databases. return(odbc_exec($string, $linkidentifer)); } exit(0); } function ofirst_dbfetch_object($resource, $rownumber = "") { global $dbasetype; if($dbasetype == "mysql") { if(function_exists("mysql_fetch_object") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); } return(mysql_fetch_object($resource)); } elseif($dbasetype == "mssql") { if(function_exists("mssql_fetch_object") == false) { die("Microsoft SQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable Microsoft SQL support, or choose another database type."); } return(mssql_fetch_object($resource)); } elseif($dbasetype == "odbc") { if(function_exists("odbc_fetch_object") == false) { die("ODBC support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable ODBC support, or choose another database type."); } if($rownumber != "") { return(odbc_fetch_object($resource, $rownumber)); } else { return(odbc_fetch_object($resource)); } } exit(0); } function ofirst_dbnum_rows($resource) { global $dbasetype; if($dbasetype == "mysql") { if(function_exists("mysql_num_rows") == false) { die("MySQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable MySQL support, or choose another database type."); } if (!is_resource($resource)) return -1; return(mysql_num_rows($resource)); } elseif($dbasetype == "mssql") { if(function_exists("mssql_num_rows") == false) { die("Microsoft SQL support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable Microsoft SQL support, or choose another database type."); } if (!is_resource($resource)) return -1; return(mssql_num_rows($resource)); } elseif($dbasetype == "odbc") { if(function_exists("odbc_num_rows") == false) { die("ODBC support is not available in your version of PHP. To use the openFIRST Web Portal Software, please either enable ODBC support, or choose another database type."); } if($resource != "") { if (!is_resource($resource)) return -1; return(odbc_num_rows($resource)); } else { return(odbc_num_rows()); } } exit(0); } function ofirst_dbname_version() { global $dbasetype; if($dbasetype == "mysql") { $v = ofirst_dbfetch_object(ofirst_dbquery("SELECT VERSION() AS mysql_version")); return "MySQL $v->mysql_version"; } elseif($dbasetype == "mssql") { $v = ofirst_dbquery("SELECT @@VERSION"); return "Microsoft SQL Server $v <br><strong>Warning:</strong> unconfirmed"; } elseif($dbasetype == "odbc") { return "ODBC"; } else { return "Unknown DB type"; } } function ofirst_dbsize() { global $dbasetype, $sqldatabase; if($dbasetype == "mysql") { $dbsize = 0; $dq = ofirst_dbquery("SHOW TABLE STATUS FROM $sqldatabase"); while($d = ofirst_dbfetch_object($dq)) { $dbsize += $d->Data_length + $d->Index_length; } return (int) (($dbsize + 0.5) / 1024 * 10) / 10 . " KB"; } elseif($dbasetype == "mssql") { $s = ofirst_dbfetch_object(ofirst_dbquery("SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize FROM sysfiles")); return (int) (( $s->dbsize + 0.5) / 1024 * 10) / 10 . " KB"; } else { return "Size not supported"; } } # Check if there the connection is valid function ofirst_dbcheck($linkidentifier = "") { #TODO: Write me! global $dbasetype; if($dbasetype == "mysql") { } elseif($dbasetype == "mssql") { } elseif($dbasetype == "odbc") { } exit(0); } function ofirst_dbcreate($sqlserver, $sqluser, $sqlpassword, $sqldatabase) { /* Create database if it does not already exist */ ofirst_dbconnect("$sqlserver","$sqluser","$sqlpassword"); ofirst_dbquery("CREATE DATABASE IF NOT EXISTS $sqldatabase;"); if (ofirst_dberror() != 0) return false; ofirst_select_db($sqldatabase); $query = ofirst_dbquery("CREATE TABLE `ofirst_config` ( `modulename` varchar(25) NOT NULL default '', `label` VARCHAR(25), `version` VARCHAR(10) NOT NULL default 'CVS', `showonmenu` TINYINT( 1 ) NOT NULL DEFAULT '0', `active` TINYINT( 1 ) NOT NULL DEFAULT '0', `adminnavigation` text, `modulenavigation` text, `includes` text, PRIMARY KEY (`modulename`), UNIQUE (`modulename`) )"); if (ofirst_dberror() != 0) return false; /* copied from auth.php */ $query = ofirst_dbquery("CREATE TABLE ofirst_members ( UNIQUE(user), user CHAR(128), firstname TINYTEXT, lastname TINYTEXT, lastseen TINYTEXT, ip TINYTEXT, password TEXT, authcode TEXT, membertype TINYTEXT, division TINYTEXT, year INTEGER, email TEXT, icq INTEGER, aim TINYTEXT, msn TINYTEXT, yim TINYTEXT, description TEXT, signature TINYTEXT, dateregistered TINYTEXT, picturelocation TINYTEXT, team INTEGER, skills TEXT );"); if (ofirst_dberror() != 0) return false; if (ofirst_dberrno() == 0) { // Insert a default user 'administrator' and set them to have // administrative access and some password. $query = ofirst_dbquery("INSERT INTO ofirst_members (user, membertype, password) VALUES('admin', 'administrator', '" . cryptpassword("openfirst") ."');"); if (ofirst_dberror() != 0) return false; } /* End copy */ return true; } function ofirst_dbexec_file($filename, $linkidentifier = "") { if (file_exists($filename) && is_readable($filename)) { $sf = fopen($filename, "r"); $query = ""; while($line = fgets($sf)) { if(substr($line, 0, 2) != "--" && substr($line, 0, 1) != "#" && strlen($line) > 0) { $q = ofirst_dbquery(trim($line)); } } fclose($sf); return true; } else { return false; } } function ofirst_dbescape($text) { global $dbasetype; if($dbasetype == "mysql") { return mysql_real_escape_string($text); # MS SQL and ODBC don't have specific escaping functions. } else { # Lets just assume there isn't an escaping function return addslashes($text); } exit(0); } #Used for quoting field, table, and DB names function ofirst_dbquote_name($name) { return '`'.ofirst_dbescape($name).'`'; } #Used for quoting data function ofirst_dbquote_data($data) { return "'".ofirst_dbescape($data)."'"; } ?> --- NEW FILE: .cvsignore --- sitesettings.php --- NEW FILE: db_setup.php --- <?php /* * openFIRST.base - config/db_setup.php * * Copyright (C) 2005, * openFIRST Project * Original Author: Jamie Bliss <ja...@op...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Purpose: Allow easy and stable configuration of database tables. This // includes both setup and modification of said tables. require_once('dbase.php'); /** An array of valid SQL types * This won't be used for checking */ $sqlValidTypes = array( /* After each type, there may be a list of options: * length - can have the form TYPE(###) * need length - must have the form TYPE(###) * length&digits - can have the form TYPE(###, ###) * length&bits - can have the form TYPE(###, ###) * length or digits - can have the form TYPE(###) or TYPE(###, ###) * * Any options not in this list refer to literal attributes */ # These are from phpMyAdmin 'VARCHAR', #need length, national, binary 'TINYINT', #length, unsigned, zerofill 'TEXT', #length 'DATE', 'SMALLINT', #length, unsigned, zerofill 'MEDIUMINT', #length, unsigned, zerofill 'INT', #length, unsigned, zerofill 'BIGINT', #length, unsigned, zerofill 'FLOAT', #need length, unsigned, zerofill OR #length&digits, unsigned, zerofill 'DOUBLE', #length&bits, unsigned, zerofill 'DECIMAL', #length or digits, unsigned, zerofill 'DATETIME', 'TIMESTAMP', #length(14,12,8,6) 'TIME', 'YEAR', #length(2,4) 'CHAR', #need length, national, binary, ascii, unicode OR #(none) 'TINYBLOB', 'TINYTEXT', 'BLOB', #length 'MEDIUMBLOB', 'MEDIUMTEXT', 'LONGBLOB', 'LONGTEXT', 'ENUM',#list of values 'SET',#list of values # These are additional types from the MySQL manual 'BIT', #length 'BOOL', 'BOOLEAN', 'INTEGER', #length, unsigned, zerofill 'DOUBLE PRECISION', #length&digits, unsigned, zerofill 'REAL', #length&digits, unsigned, zerofill 'DEC', #length or digits, unsigned, zerofill 'NUMERIC', #length or digits, unsigned, zerofill 'FIXED', #length or digits, unsigned, zerofill 'DATE', 'BINARY', #need length 'VARBINARY', #need length ); /** Gets an array of tables. * Uses the current DB connection. The key is the name, the content * is a Table class */ function GetTables() { # } /** The class representing a table. * This is a wrapper for a SQL table. It allows access to fields, * keys, etc. Note that it does not handle records, just structure. */ class Table { var $mName; /** Constructor */ function Table($Name) { # } /** Gets an array of current fields. * The returned array contains just the field names, in order. */ function getFields() { # } /** Adds a field to the table. * @param $Name The name of the new field * @param $Type The type of the new field * @param $Options An associative array of options. Certain elements * are required under certain conditions. */ function addField($Name, $Type, $Options=array()) { # } function getFieldType($Name) { # } function getFieldOptions($Name) { # } function alterField($Name, $Type, $Options) { # } } /*** SQL Statements ***/ /* Get information on a table: DESCRIBE `{TABLE NAME}` Which returns a series of "records" with the "fields": Field - some kind of string - Name Type - a type (with length and all) - data type Null - SET('YES') - whether it can be null Key - SET('MUL','PRI','UNI') - what kind of key it is Default - the same type as the field - the default value Extra - SET('auto_increment') - */ ?> |