|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
<?php
// Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ /* table_p add_p foorm_p[] */ include("modify_CONFIG.php"); include("CONFIG_view.php"); include("addform.php"); $formdatahash=$foorm_p; $table_name=$table_p; if ( $add_p == "y" ) { $formdatahash=scrubDataBoundForDB($formdatahash, $arrays_of_fields_to_be_validated); $id=addDataToDatabase($formdatahash,$table_name,$d blink ) ; if ( $id != "" ) { $message0fwhathappened= showDataAddSuccessMessage( ) ; } else { $message0fwhathappened= showDataFAILEDMessage() ; } }//if function showDataAddSuccessMessage(){ $it= genericDBSuccessMessage(ADDED); return $it ; }//functionend function showDataFAILEDMessage( ) { $it= genericDBFAILEDMessage(ADDED); return $it ; }//functionend include("TEMPLATE_layout_heredoc.php"); print ("$heredocHTML"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $addformHTML=<<<THEHTML <form action="add.php$FREESESS_linkstring" method="post" ENCTYPE="multipart/form-data" name="add"> $modify_formfieldsHTML <input type="hidden" name="add_p" value="y"> <input type="hidden" name="table_p" value="$table_name"> <div align="center"><input type="submit" value="Add"></div> </form> THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ include("modify_formfields.php"); include("TEMPLATE_top.php"); include("TEMPLATE_bottom.php"); include("TEMPLATE_MENUlocal.php"); $heredocHTMLlocalmenu=<<<THEHTML THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ require('../site_config.php'); require('../dbconnect.php'); //require('../login/sess.php'); //require('./config_admin_table.php'); if(! $table_p ){ exit("No table_p"); }//if $whatsadmined_tablename_g=$table_p; // array below sets the fields into db with createtable_from_config.php, //,alters to add new fields from this array,it also warns if field in db is not in this array //all fields in config.ini should be here also $config_db_table_array_g=array( 'useraccesslevel_d'=>' int(11) unsigned not null ', 'login_d'=>'char(64) not null unique ', 'password_d'=>' char(64) not null', 'email_d'=>'char(32) not null', 'lastname_d'=>'char(32) not null', 'firstname_d'=>'char(32) not null', 'typeofuser_d'=>'char(32) not null', 'timestamp_d'=>'char(64) not null', 'session_id_d'=>'char(32) not null', 'datecreated_d'=>' date not null', 'datemodified_d'=>' date not null', ); /* mysql_fetch_field mysql_field_len mysql_field_flags mysql_field_type mysql_list_fields mysql_num_fields */ //print_r( $config_db_table_array_g ); //$whatsadmined_tablename_g="aaa"; //mysql_query( " drop table if exists aaa "); function mysql_table_exists($DB_Name, $whatsadmined_tablename_g, $dblink) {//still goes through here if table exists but no data $exists = mysql_query("SELECT * from $whatsadmined_tablename_g ", $dblink); $anyresult=@mysql_num_rows($exists); if ( ! $anyresult){ $query="create table $whatsadmined_tablename_g( id_d int(11) unsigned auto_increment not null, primary key (id_d) )"; mysql_query( $query); }//if }//function mysql_table_exists($DB_Name, $whatsadmined_tablename_g, $dblink); $fields = mysql_list_fields("$DB_Name", "$whatsadmined_tablename_g", $dblink); $columns = mysql_num_fields($fields); $arrayfromdbtable=''; for ($i = 0; $i < $columns; $i++) { //$type = mysql_field_type($fields, $i); $name = mysql_field_name($fields, $i); //$len = mysql_field_len($fields, $i); //$flags = mysql_field_flags($fields, $i); if((! $config_db_table_array_g[$name])&&($name!='id_d')){ print ("<br>The field $name is not in the config array<br>"); }//if $arrayfromdbtable[$name]=$name; // echo "<b>".$name. "</b>"." ".$type." ". $len." ".$flags."\n <BR>"; } //for foreach($config_db_table_array_g as $key => $value){ if ( ! $arrayfromdbtable[$key] ) { print ("<br>The field $key is not in the database<br>"); $dbatt=$value; $query="ALTER table $whatsadmined_tablename_g add $key $dbatt "; mysql_query($query ); print ("<br> $query<br>"); }//if }//foreach //mysql_query( " drop table if exists $whatsadmined_tablename_g "); /* */ $exists = mysql_query("INSERT INTO $whatsadmined_tablename_g set id_d = 1, typeofuser_d='Admin', login_d ='x', password_d='xtc' "); print ("<br>done<br>"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ require('../site_config.php'); require('../dbconnect.php'); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <TITLE>freedom</TITLE> </HEAD> <BODY> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $tables=mysql_list_tables("$DB_Name",$dblink) or die ("stupid list query didn't work"); $anyresult=mysql_num_rows($tables); $counter=0; while ($counter < $anyresult) { $tb_names[$counter] = mysql_tablename ($tables, $counter); echo "<BR> <BR>"."<b>". $tb_names[$counter] ."</b>". "<BR>"; $fields = mysql_list_fields("$DB_Name", "$tb_names[$counter]", $dblink); $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { $type = mysql_field_type($fields, $i); $name = mysql_field_name($fields, $i); $len = mysql_field_len($fields, $i); $flags = mysql_field_flags($fields, $i); echo "<b>".$name. "</b>"." ".$type." ".$len." ".$flags."\n <BR>"; } $counter++; } ?> </BODY> </HTML> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ /* table_p add_p foorm_p[] */ include("modify_CONFIG.php"); include("CONFIG_view.php"); $formdatahash=$foorm_p; $table_name=$table_p; $optionselectwidget = putRecordIDsIntoPulldown($table_name, $item_label_g, $whatsadmined_label_g,$lastname_d, $firstname_d, $extrapulldownfields_g,$dblink ); include("delete_form.php"); include("TEMPLATE_layout_heredoc.php"); print ("$heredocHTML"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $modify_formfieldsHTML = $optionselectwidget; $addformHTML=<<<THEHTML <form action="deleteselected.php$FREESESS_linkstring" method="post" ENCTYPE="multipart/form-data" name="add"> $modify_formfieldsHTML <input type="hidden" name="delete_p" value="y"> <input type="hidden" name="table_p" value="$table_name"> <div align="center"><input type="submit" value="Select to Delete"></ div> </form> THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ /* table_p add_p foorm_p[] */ include("modify_CONFIG.php"); include("CONFIG_view.php"); $formdatahash=$foorm_p; $table_name=$table_p; if ( $delete_p == "y" ) { if ( $id_p != "" && $id_p != 0 ) { $flagsuccess=deleteDataInDatabase($table_name,$id_ p,$dblink ); if ( $flagsuccess == "" ) { $message0fwhathappened = showDeleteDataFAILEDMessage("") ; }//if else{$message0fwhathappened = showDataDeleteSuccessMessage("") ; }//else } //id_p else { include("CONFIG_view.php"); $message0fwhathappened= showNoIDMessage("") ; $addformHTML=''; } }//if delete_p else { include("CONFIG_view.php"); $message0fwhathappened = showNotOKtoDeleteMessage("") ; $addformHTML=''; }//no delete_p function showDataDeleteSuccessMessage($whymessage){ $it= genericDBSuccessMessage(DELETED); return $it ; }//functionend function showDeleteDataFAILEDMessage($whymessage) { $it= genericDBFAILEDMessage(DELETED); return $it ; }//functionend function showNotOKtoDeleteMessage($whyfailed){ $it= PAGESEQUENCEERROR . $whyfailed ; return $it ; }//functionend include("TEMPLATE_layout_heredoc.php"); print ("$heredocHTML"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ /* table_p add_p foorm_p[] */ include("modify_CONFIG.php"); $formdatahash=$foorm_p; $table_name=$table_p; if ( $id_p != "" && $id_p != 0 ) { $thedata=getDataFromDatabase($table_name,$id_p,$db link ); if($thedata ==false){ $message0fwhathappened= showDeleteGetDataFAILEDMessage(""); include("CONFIG_view.php"); }//if else{ $therow = wrapSQLFetchArray( $thedata); $therenderedrow=renderDBStrings($therow, $arrays_of_fields_to_render); extract($therenderedrow); include("CONFIG_view.php"); include("deleteselectedform.php"); }//else }//id_p else { include("CONFIG_view.php"); $message0fwhathappened= showNoIDMessage("") ; $addformHTML=''; } include("TEMPLATE_layout_heredoc.php"); print ("$heredocHTML"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $addformHTML=<<<THEHTML <form action="deletedone.php$FREESESS_linkstring" method="post" ENCTYPE="multipart/form-data" name="add"> $modify_formfieldsHTML <input type="hidden" name="delete_p" value="y"> <input type="hidden" name="table_p" value="$table_name"> <input type="hidden" name="id_p" value="$id_p"> <div align="center"><input type="submit" value="Delete Now"></div> </form> THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ function wrapSQLFetchArray($recordset){ $it= mysql_fetch_array( $recordset); return $it ; }//functionend function showNoIDMessage($whymessage){ $it = NO_ID; return $it ; }//functionend function showUpdateGetDataFAILEDMessage($whyfailed) { $reasonwhy= FAILEDGET . " $whyfailed" ; $it= genericDBGetFAILEDMessage($reasonwhy); return $it ; }//functionend function showDeleteGetDataFAILEDMessage($whyfailed) { $reasonwhy= FAILEDDELETEGET . " $whyfailed" ; $it= genericDBGetFAILEDMessage("for Update. $whyfailed"); return $it ; }//functionend function genericDBGetFAILEDMessage($whyfailed){ $it = DATANOTFOUND . " $whyfailed" ; return $it ; }//functionend function genericDBSuccessMessage($typeofDBaction){ $it = SUCCESSDATA . " $typeofDBaction." ; return $it ; }//functionend function genericDBFAILEDMessage($typeofDBaction){ $it = FAILEDDATA . " $typeofDBaction." ; return $it ; }//functionend function makeQueryOfFields($formdatahash){ $set_into_DB_string=''; foreach($formdatahash as $key => $value){ $set_into_DB_string = $set_into_DB_string . $key . " = '$value',"; }//endforeach $set_into_DB_string = rtrim ($set_into_DB_string,',' ); return $set_into_DB_string ; }//functionend function getDataFromDatabase($table_name,$id,$dblink ){ $query="SELECT * from $table_name where id_d = '$id' "; $result=mysql_query($query); //$anyresults=mysql_num_rows($result); if ( $result == false ) { $why= mysql_error ( $dblink) ; print "<br>$why $query<br>" ; }//if //convertMysqlToCGIarray($recordset); return $result ; }//functionend function convertMysqlToCGIarray($recordset){ return $it ; }//functionend function addDataToDatabase($formdatahash,$table_name,$dblin k ){ $db_string=makeQueryOfFields($formdatahash); $query="INSERT into $table_name set datecreated_d = CURRENT_DATE, $db_string "; $result=mysql_query($query); if ( $result == false) { $why= mysql_error ( $dblink) ; print "<br>$why $query<br>" ; }//if $id= mysql_insert_id(); return $id ; }//functionend function updateDataToDatabase($formdatahash,$table_name,$id _p,$dblink ) { //check access perms $db_string=makeQueryOfFields($formdatahash); $query="UPDATE $table_name set datemodified_d = CURRENT_DATE, $db_string where id_d = '$id_p' "; $flagofsuccess=mysql_query($query); if ( $flagofsuccess == false) { $why= mysql_error ( $dblink) ; print "<br>$why $query<br>" ; }//if return $flagofsuccess ; }//functionend function deleteDataInDatabase($table_name,$id_p,$dblink ){ //check access perms $query="DELETE from $table_name where id_d = '$id_p' "; $flagofsuccess=mysql_query($query); if ( $flagofsuccess == false) { $why= mysql_error ( $dblink) ; print "<br>$why $query<br>" ; }//if return $flagofsuccess ; }//functionend function putRecordIDsIntoPulldown($table_name,$item_label_g , $whatsadmined_label_g,$lastname_d, $firstname_d,$extrapulldownfields_g, $dblink ){ $orderbystring = "order by $lastname_d, $firstname_d" ; $orderbystring =''; /* $item_label_g--Label pf an attribute from DB $whatsadmined_label_g--Label for what is in the table $lastname_d, $firstname_d--sort fields $extrapulldownfields_g[]-other stuff in pulldown--like a first name too */ $query="SELECT * from $table_name $orderbystring "; $result=mysql_query($query); $anyresults=mysql_num_rows($result); if ( $result == false) { $why= mysql_error ( $dblink) ; print "<br>$why $query<br>" ; }//if if ( $anyresults ) {$optionmenustring_g=<<<THEoption <select name="id_p"> <option value="0">Select a $whatsadmined_label_g</option> THEoption; $counter=0; while($counter< $anyresults){ $therow = mysql_fetch_array($result); $therenderedrow=renderDBStrings($therow, $arrays_of_fields_to_render); extract($therenderedrow); $whattoprintinpulldown=${$item_label_g}; if($extrapulldownfields_g[$item_label_g]){ $whattoprintinpulldown=""; foreach($extrapulldownfields_g[$item_label_g] as $xtrakey => $xtravalue){ $whattoprintinpulldown=$whattoprintinpulldown . $ {$xtravalue} . $xtravalue; }//endforeach }//if $optionmenustring_g=$optionmenustring_g . "<option value=\"$id_d \">$whattoprintinpulldown</option>"; $counter++; }//while $optionmenustring_g=$optionmenustring_g ."</select>"; }//if anyresults return $optionmenustring_g ; }//functionend ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $sitefoldername_G="crud";//<<<<<<<<< to overide path so you can use site_config for ALL sites include("../site_config.php"); include("../dbconnect.php"); include('../login/sess.php'); $urlofstyleforthelook="free_basic.css"; $table_p="TESTcolor"; $item_label_g ='test_d'; $whatsadmined_label_g='Color'; include("TEXTerrormessages.php"); include("functions_crud.php"); include("VALIDATOR_functions.php"); include("RENDERER_functions.php"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ require('../site_config.php'); require('../dbconnect.php'); //require('../login/sess.php'); //require('./config_admin_table.php'); if(! $table_p ){ exit("No table_p"); }//if $whatsadmined_tablename_g=$table_p; // array below sets the fields into db with createtable_from_config.php, //,alters to add new fields from this array,it also warns if field in db is not in this array //all fields in config.ini should be here also $config_db_table_array_g=array( 'test_d'=>'char(64) not null unique ', 'red_d'=>' char(64) not null', 'green_d'=>'char(32) not null', 'yellow_d'=>'char(32) not null', 'blue_d'=>'char(32) not null', 'datecreated_d'=>' date not null', 'datemodified_d'=>' date not null', ); /* mysql_fetch_field mysql_field_len mysql_field_flags mysql_field_type mysql_list_fields mysql_num_fields */ //print_r( $config_db_table_array_g ); //$whatsadmined_tablename_g="aaa"; //mysql_query( " drop table if exists aaa "); function mysql_table_exists($DB_Name, $whatsadmined_tablename_g, $dblink) {//still goes through here if table exists but no data $exists = mysql_query("SELECT * from $whatsadmined_tablename_g ", $dblink); $anyresult=@mysql_num_rows($exists); if ( ! $anyresult){ $query="create table $whatsadmined_tablename_g( id_d int(11) unsigned auto_increment not null, primary key (id_d) )"; mysql_query( $query); }//if }//function mysql_table_exists($DB_Name, $whatsadmined_tablename_g, $dblink); $fields = mysql_list_fields("$DB_Name", "$whatsadmined_tablename_g", $dblink); $columns = mysql_num_fields($fields); $arrayfromdbtable=''; for ($i = 0; $i < $columns; $i++) { //$type = mysql_field_type($fields, $i); $name = mysql_field_name($fields, $i); //$len = mysql_field_len($fields, $i); //$flags = mysql_field_flags($fields, $i); if((! $config_db_table_array_g[$name])&&($name!='id_d')){ print ("<br>The field $name is not in the config array<br>"); }//if $arrayfromdbtable[$name]=$name; // echo "<b>".$name. "</b>"." ".$type." ". $len." ".$flags."\n <BR>"; } //for foreach($config_db_table_array_g as $key => $value){ if ( ! $arrayfromdbtable[$key] ) { print ("<br>The field $key is not in the database<br>"); $dbatt=$value; $query="ALTER table $whatsadmined_tablename_g add $key $dbatt "; mysql_query($query ); print ("<br> $query<br>"); }//if }//foreach //mysql_query( " drop table if exists $whatsadmined_tablename_g "); /* */ $exists = mysql_query("INSERT INTO $whatsadmined_tablename_g set id_d = 1, typeofuser_d='Admin', login_d ='x', password_d='xtc' "); print ("<br>done<br>"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $modify_formfieldsHTML=<<<THEHTML <table border="0" cellpadding="3" cellspacing="0" > <tr class=""> <td valign="" align="">Test</td> <td valign="" align=""><input type="text" name="foorm_p[test_d]" class="" size="20" maxlength="" value="$test_d"></td> </tr> <tr class=""> <td valign="" align="">Red</td> <td valign="" align=""><input type="text" name="foorm_p[red_d]" class="" size="20" maxlength="" value="$red_d"></ td> </tr> <tr class=""> <td valign="" align="">Green</td> <td valign="" align=""><input type="text" name="foorm_p[green_d]" class="" size="20" maxlength="" value="$green_d"></td> </tr> <tr class=""> <td valign="" align="">Yello</td> <td valign="" align=""><input type="text" name="foorm_p[yellow_d]" class="" size="20" maxlength="" value="$yellow_d"></td> </tr> <tr class=""> <td valign="" align="">Blue</td> <td valign="" align=""><input type="text" name="foorm_p[blue_d]" class="" size="20" maxlength="" value="$blue_d"></td> </tr> </table> THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $modify_formfieldsHTML=<<<THEHTML <table border="0" cellpadding="3" cellspacing="0" > <tr class=""> <td valign="" align="">Email</td> <td valign="" align=""><input type="text" name="foorm_p[email_d]" class="" size="20" maxlength="" value="$email_d"></td> </tr> <tr class=""> <td valign="" align="">Login</td> <td valign="" align=""><input type="text" name="foorm_p[login_d]" class="" size="20" maxlength="" value="$login_d"></td> </tr> <tr class=""> <td valign="" align="">Password</td> <td valign="" align=""><input type="text" name="foorm_p[password_d]" class="" size="20" maxlength="" value="$password_d"></td> </tr> <tr class=""> <td valign="" align="">First Name</td> <td valign="" align=""><input type="text" name="foorm_p[firstname_d]" class="" size="20" maxlength="" value="$firstname_d"></td> </tr> <tr class=""> <td valign="" align="">Last Name</td> <td valign="" align=""><input type="text" name="foorm_p[lastname_d]" class="" size="20" maxlength="" value="$lastname_d"></td> </tr> </table> THEHTML; ?> update.php---page actually URLed --includes all pieces--needs NO modification except where to call look/feel from (either site wide template or more specific look) updateform.php--wrapper for $modify_formfieldsHTML -differs add from update -only modify for extra CGI vars modify_formfields.php--where you put form for add/update--it heredocs to->$modify_formfieldsHTML .. .................................................. .................. to modify VIEW::: CONFIG_view.php free_basic.css TEMPLATE_top.php TEMPLATE_bottom.php TEMPLATE_MENUlocal.php--add/update/delete links TEMPLATE_layout_heredoc.php Main elements for each page --Style them modify_formfields.php fields in form with DB field name .................................................. ........................ to modify DB and data:: modify_createtable_TESTcolor.php have a page for each table in DB modify_CONFIG.php:::::: $table_p="TESTcolor"; (pulldown labels):: $item_label_g ='test_d'; $whatsadmined_label_g='Color'; ......................... to change error messages text: TEXTerrormessages.php may need to modify these FUNCTIONS:........................................ ... VALIDATOR_functions.php scrubDataBoundForDB($formdatahash,$arrays_of_field s_to_be_validated) is the wrapper for validation and RENDERER_functions.php renderDBStrings($therow,$arrays_of_fields_to_rende r) is the wrapper for rendering strings for the view todo:>>>>>>>>>>> clean out extra functions from delete/selected test code on IF control and function include copyright notice sorts and labels on pulldown menus renderer sample validator sample Xhook in url rewriter/session XCSS the menu Xerror message from mysql Xclean out extra functions from update/selected Xwrap all mysql calls Xdelete confirm code XMVCRV Xsuccess/fail messages as CONSTANTS in config .................................................. .................................... rename better Xfilenames to sort vars to doc file names for polymorphing off table name $table_p a pass in page for running create tables put modify config in an array set levels in array /tree tablename and id in menu make view nestable session must be called outside an include assuming you are in/crud: needs vars from site_config.php/dbconnect.php next higher level legal_disclaimer.php too (right now in freeearth web root) also these folders at next higher level: login register $sitefoldername_G="crud"; $sitewide_url_G="http://$theurlofwhereitis_G/$sitefoldername_G";//fix should be set on every page for general freeearth code <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ function renderDBStrings($therow,$arrays_of_fields_to_rende r){ $therowrendered=$therow; return $therowrendered ; }//functionend ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $heredocHTMLbottomtemplate=<<<THEHTML </div> </body> </html> THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $heredocHTML=<<<THEHTML $heredocHTMLtoptemplate <div>$heredocHTML_MENUlocal</div> <div class="errormessages">$message0fwhathappened</div> $addformHTML $heredocHTMLbottomtemplate THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $heredocHTML_MENUlocal=<<<THEHTML <ul class="subnav" type="none"> <li><a href="add.php$FREESESS_linkstring">Add</a></li> <li><a href="update.php$FREESESS_linkstring">Update</a></li> <li><a href="delete.php$FREESESS_linkstring">Delete</a></li> </ul> THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $heredocHTMLtoptemplate=<<<THEHTML <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>$tablename</title> <link></link> <style type="text/css"><!-- @import url("$urlofstyleforthelook"); --></style> </head> <body class="textofcontent"> <div align="center" class="textofcontent"> THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ define("ADDED", "Added"); define("UPDATED", "Updated"); define("DELETED", "Deleted"); define("FAILEDGET", "for Update."); define("PAGESEQUENCEERROR", "Error in paging, Select again."); define("FAILEDDELETEGET", "for Update."); define("NO_ID", "No Id of record. Select again."); define("DATANOTFOUND", "WARNING-- data not found"); define("SUCCESSDATA", "Your data was successfully"); define("FAILEDDATA", "WARNING, Your data was NOT"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ define("ADDED", "Added"); define("UPDATED", "Updated"); define("DELETED", "Deleted"); define("FAILEDGET", "for Update."); define("PAGESEQUENCEERROR", "Error in paging, Select again."); define("FAILEDDELETEGET", "for Update."); define("NO_ID", "No Id of record. Select again."); define("DATANOTFOUND", "WARNING-- data not found"); define("SUCCESSDATA", "Your data was successfully"); define("FAILEDDATA", "WARNING, Your data was NOT"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $addformHTML=<<<THEHTML <form action="updateselected.php$FREESESS_linkstring" method="post" ENCTYPE="multipart/form-data" name="add"> $optionselectwidget <input type="hidden" name="update_p" value="y"> <input type="hidden" name="table_p" value="$table_name"> <div align="center"><input type="submit" value="Update"></div> </form> THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ /* table_p add_p foorm_p[] */ include("modify_CONFIG.php"); $formdatahash=$foorm_p; $table_name=$table_p; if ( $id_p != "" && $id_p != 0 ) { $thedata=getDataFromDatabase($table_name,$id_p,$db link ); if($thedata ==false){ $message0fwhathappened= showUpdateGetDataFAILEDMessage(""); }//if else{ $therow =wrapSQLFetchArray($thedata); $therenderedrow=renderDBStrings($therow, $arrays_of_fields_to_render); extract($therenderedrow); }//else if($updatenow_p != "" ){ $formdatahash=scrubDataBoundForDB($formdatahash, $arrays_of_fields_to_be_validated); $flagsuccess = updateDataToDatabase($formdatahash, $table_name,$id_p,$dblink ); if ( $flagsuccess == false ) { $message0fwhathappened = showUpdateDataFAILEDMessage("") ; }//if else{$message0fwhathappened = showDataUpdateSuccessMessage("") ; } }//if updatenow_p }//id_p else { $message0fwhathappened= showNoIDMessage("") ; } include("CONFIG_view.php"); //include("update_form.php"); function showDataUpdateSuccessMessage($whyfailed){ $it= genericDBSuccessMessage(UPDATED); return $it ; }//functionend function showUpdateDataFAILEDMessage($whyfailed) { $reasonwhy= UPDATED . " $whyfailed" ; $it= genericDBFAILEDMessage($reasonwhy); return $it ; }//functionend include("TEMPLATE_layout_heredoc.php"); print ("$heredocHTML"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ /* table_p add_p foorm_p[] */ include("modify_CONFIG.php"); $formdatahash=$foorm_p; $table_name=$table_p; if ( $id_p != "" && $id_p != 0 ) { $thedata=getDataFromDatabase($table_name,$id_p,$db link ); if($thedata ==false){ $message0fwhathappened= showUpdateGetDataFAILEDMessage(""); include("CONFIG_view.php"); }//if else{ $therow = wrapSQLFetchArray($thedata); $therenderedrow=renderDBStrings($therow, $arrays_of_fields_to_render); extract($therenderedrow); include("CONFIG_view.php"); include("updateselectedform.php"); }//else }//id_p else { include("CONFIG_view.php"); $message0fwhathappened= showNoIDMessage("") ; $addformHTML=''; } include("TEMPLATE_layout_heredoc.php"); print ("$heredocHTML"); ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ $addformHTML=<<<THEHTML <form action="updatedone.php$FREESESS_linkstring" method="post" ENCTYPE="multipart/form-data" name="add"> $modify_formfieldsHTML <input type="hidden" name="update_p" value="y"> <input type="hidden" name="table_p" value="$table_name"> <input type="hidden" name="id_p" value="$id_p"> <input type="hidden" name="updatenow_p" value="y"> <div align="center"><input type="submit" value="Update"></div> </form> THEHTML; ?> <?php // Copyright (c) Free 2007 /* This code is free to use, modify, sell, non-exclusively re-license, distribute, and use in other products. Use at your own risk. Not responsible for any damages or losses of any kind. You must include this copyright notice if you do use this code. */ function scrubDataBoundForDB($formdatahash, $arrays_of_fields_to_be_validated){ $scrubbed_data=$formdatahash; return $scrubbed_data ; }//functionend ?> |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
freeearthdotorg@yahoo.com wrote:
WTF? Why would I want to use this code? And BTW, your "explicit" copyright is not legal (does not identify a real person or business entity), so there is no way for you to enforce it. You still have an implicit copyright, of course, but since you've posted anonymously, you'll have trouble enforcing even the implicit copyright. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message news:d8KdnZRPbtTwYcDanZ2dnUVZ_oPinZ2d@comcast.com. .. > freeearthdotorg@yahoo.com wrote: > > > WTF? > > Why would I want to use this code? And BTW, your "explicit" copyright is > not legal (does not identify a real person or business entity), so there > is no way for you to enforce it. > > You still have an implicit copyright, of course, but since you've posted > anonymously, you'll have trouble enforcing even the implicit copyright. all true. however, back to your first argument...why would *anyone* other than the op give two flying fucks about this code? that is, anyone that can program. |
|
![]() |
| Outils de la discussion | |
|
|