Article describe admin page for removing unwanted score with remove.php script. Remove script is invoked by GET url link, then create verification form and submit data for deletion with POST method.
Admin page show all submited score in form of a table. But against way used in index page, there is every row displayed a second row with Manage content leading text and ling for a removal script.
Better way for understanding can be gain after looking on next picture
admin.page content
Code that read data from database table and create this table output is as follows
<?php// code showing all subscribers in form of a table at end of the page
echo „<td colspan=\„3\„> Manage content: </td>„; // description on first line
echo ‚<td colspan=“2″>
<a id=“DEL“ href=“remove.php?id=‚.$row[‚id‘] .
‚&score=‚ . $row[‚score‘] .
‚&nickname=‚ . $row[‚nickname‘]
. ‚&write_date=‚ . $row[‚write_date‘]
. ‚&screenshot=‚ . $row[‚screenshot‘] .
‚„> DEL – Remove score </a></td></tr>‚;
//construction of GETable link
// for remove.php input
echo „</tr>“;
echo “ </div> “ ;
}
echo „</table>“;
// Free result set
mysqli_free_result($output);
} else{
echo „There is no benchmark result in chart. Please wirite one.“; // if no records in table
}
} else{
echo „ERROR: Could not able to execute $sql. “ . mysqli_error($dbc); // if database query problem
}
// Close connection
mysqli_close($dbc);
?>
Content of whole admin page can be obtained from github here.
remove.php script
Remove.php script gather data from GET post (link created by admin page pass GET data into a remove.php script). This script obtain GET data and create internal form for verification of a removal score. This form is next submited a with POST send on themself. But not as self script but calling script name without GET url link (no further GET data need to be obtained again).
After confirmation and setting Yes for deletion, POST data are used for database deletion and removing of submitd score pisture located in images folder.
GUI of confirmation looks like this
Confirmation dialog generated by remove.php script using POST method
$image_location = IMAGE_PATH.$screenshot; // supplementary construct of image path location
echo „<img src=\“$image_location\“ alt=\“ score image to delete \“ height=\“95\“>“;
echo ‚<br><br>‘;
echo ‚<form method=“POST“ action=“remove.php“>‘; //not self but direct this script remove.php – we dont want include any GET data tahat previously send
We inform you that we use cookies and other technologies on this site to function and improve the operation of the site, ensure it, provide social networking features, personalize content and ads to users, and analyze traffic and user behavior. For more information, please read our Terms of Use and Cookies. You can prevent cookies from being processed by changing the settings in your Internet browser.OkPrivacy policy