freelancer Posted February 11, 2007 Share Posted February 11, 2007 I worked out simple match results form where is included all data from mysql database. I can add info to database table from my file add.html witch includes <form action="insert.php" method="post"> Opponent: <input type="text" name="opponent"><br> Map: <input type="text" name="map"><br> Score: <input type="text" name="score"><br> <input type="Submit"> </form> insert.php stores info what was in fields into my database table called 'results'. Furthermore I made script that allows edit specific table via id number. File name called update.php: <?php $id=$_GET['id']; include('config.php'); mysql_connect("server",$username,$password); @mysql_select_db($database) or die( "No database selceted!"); $query=" SELECT * FROM results WHERE id='$id'"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $i=0; while ($i < $num) { $opponent=mysql_result($result,$i,"opponent"); $map=mysql_result($result,$i,"map"); $score=mysql_result($result,$i,"score"); ?> <form action="updated.php" method="post"> <input type="hidden" name="ud_id" value="<? echo $id; ?>"> Opponent: <input type="text" name="ud_opponent" value="<? echo $opponent; ?>"><br> Map: <input type="text" name="ud_map" value="<? echo $map; ?>"><br> Score: <input type="text" name="ud_score" value="<? echo $score; ?>"><br> <input type="Submit" value="Update"> </form> <? ++$i; } ?> This can be done by changing url as update.php?id=<id from table>. Now, all works fine but I want to secure it that random people can't edit table by just going to this url. After that I would like that in this admin panel witch is protected with user&pass all my table information is included and there would be 1 additional column where is 'Edit' button for each one that I don't have to type id number to change something if I need. I hope you understand what you mean and are able to help me out Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.