11<?php
2-
2+ error_reporting ( 0 );
33// header to return JSON to the jQuery Ajax request
44header ('Content-Type: application/json ' );
55
@@ -77,7 +77,7 @@ function random_glyphicon(){
7777
7878 // gather success info and display to user at the end
7979 $ message = "The operations that were performed are: <ul> " ;
80-
80+
8181 // select the database
8282 $ linkdb = mysqli_select_db ($ link , $ database );
8383 if (!$ linkdb ) {
@@ -105,7 +105,7 @@ function random_glyphicon(){
105105 // the generation process starts here
106106 // collecting DB connection info to generate includes/connect.php file
107107 $ connection = "<?php
108- mysqli_connect( \"$ host \", \"$ username \", \"$ password \");
108+ \$ link = mysqli_connect( \"$ host \", \"$ username \", \"$ password \");
109109 mysqli_select_db( \$link, \"$ database \");
110110 mysqli_query( \$link, \"SET CHARACTER SET utf8 \");
111111 ?>
@@ -137,6 +137,7 @@ function random_glyphicon(){
137137
138138 // collecting data for the includes/header.php page which is the header of all pages
139139 $ header = '<?php
140+ error_reporting(0);
140141 session_start();
141142 if ($_COOKIE["auth"] != "admin_in"){header("location:"."./");}
142143 include("includes/connect.php");
@@ -223,6 +224,7 @@ function random_glyphicon(){
223224 // collecting data for the edit page
224225 $ edit = "<?php
225226 include \"includes/header.php \";
227+ \$data=[];
226228
227229 $ " ."act = $ " ."_GET['act'];
228230 if($ " ."act == \"edit \"){
@@ -256,7 +258,13 @@ function random_glyphicon(){
256258 $ icon = random_glyphicon ();
257259 $ header .= "<li><a href= \"" . $ small . ".php \"> <i class= \"glyphicon glyphicon- " .$ icon ."\"></i> " . $ capital . " <span class= \"pull-right \"><?=counting( \"" . $ small . "\", \"id \")?></span></a></li> \n" ;
258260
261+ $ head ='' ;
262+ $ body ='' ;
263+ $ mid ='' ;
259264
265+ $ insert ='' ;
266+ $ update ='' ;
267+ $ values ='' ;
260268 // finding all the columns in a table
261269 $ row = mysqli_query ($ link , "SHOW columns FROM " . $ table [0 ])
262270 or die ('cannot select table fields ' );
@@ -287,7 +295,7 @@ function random_glyphicon(){
287295 // check if the column is not the ID to create the corresponding save and insert data
288296 if ($ col [0 ] != 'id ' ){
289297
290- $ save .= "$ " . $ col [0 ] . " = mysqli_real_escape_string($ " ."_POST[ \"" . $ col [0 ] . "\"]); \n" ;
298+ $ save .= "$ " . $ col [0 ] . " = mysqli_real_escape_string( \$ link, $ " ."_POST[ \"" . $ col [0 ] . "\"]); \n" ;
291299
292300 $ insert .= " ` " . $ col [0 ] . "` , " ;
293301
@@ -296,6 +304,7 @@ function random_glyphicon(){
296304 $ values .= " ' \".md5($ " . $ col [0 ] . "). \"', " ;
297305
298306 }else {
307+ $ attach_password = 0 ;
299308 $ values .= " ' \".$ " . $ col [0 ] . ". \"' , " ;
300309 $ update .= " ` " . $ col [0 ] . "` = ' \".$ " . $ col [0 ] . ". \"' , " ;
301310 }
0 commit comments