Hi by fault ive lost mysql of my banned Ip table and got only this code available please tell me mysql command to run in mysql to make reqd tables ... <?php include("../include/config.php"); include_once("../include/functions/import.php"); verify_login_admin(); if($_GET['add']){ $sql = "insert into ban_ip (ip) values ('".mysql_real_escape_string($_GET['ip'])."')"; $conn->execute($sql); } elseif($_GET['delete']) { $sql = "delete from ban_ip where id='".$_GET['delete']."'"; $conn->execute($sql); } $query2 = "SELECT * from ban_ip"; $executequery2 = $conn->Execute($query2); if($executequery2) $results = $executequery2->getrows(); Stemplate::assign('results',$results); STemplate::display("administrator/global_header.tpl"); STemplate::display("administrator/banned.tpl"); STemplate::display("administrator/global_footer.tpl"); ?> Code (markup): thanks regards SEOPrist
here is the total php system you need to run it.. connect.php <?php $hostname='***'; //// specify host, i.e. 'localhost' $user='****'; //// specify username $pass='****'; //// specify password $dbase='****'; //// specify database name $connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL"); $db = mysql_select_db($dbase , $connection) or die ("Can't select database."); ?> add.php <form id="FormName" action="added.php" method="post" name="FormName"> <table width="448" border="0" cellspacing="2" cellpadding="0"> <tr> <td width="150" align="right"><label for="ip">ip</label></td> <td><input name="ip" maxlength="15" type="text" value="<?php echo stripslashes($ip) ?>"></td> </tr> <tr> <td colspan="2" align="center"><input name="" type="submit" value="Add"></td> </tr> </table> </form> <?php include("connect.php"); $ip = trim(mysql_real_escape_string($_POST["ip"])); $results = mysql_query("INSERT INTO ban_ip (id, ip) VALUES ('', '$ip')"); if($results) { echo "Successfully Added"; } else { die('Invalid query: '.mysql_error()); } ?> updated.php <?php include("connect.php"); $id = $_REQUEST['id']; $c_Z = mysql_query("SELECT * FROM ban_ip WHERE id = '$id' "); $r_Z = mysql_fetch_array($c_Z); extract($r_Z); ?> <form id="FormName" action="updated.php" method="post" name="FormName"> <table width="448" border="0" cellspacing="2" cellpadding="0"> <tr> <td width="150" align="right"><label for="ip">ip</label></td> <td><input name="ip" maxlength="15" type="text" value="<?php echo stripslashes($ip) ?>"></td> </tr> <tr> <td colspan="2" align="center"><input name="" type="submit" value="Update"></td> </tr> </table> </form> index.php <a href="add.php">Add entry</a><br> <br> <?php include("connect.php"); $result = mysql_query("SELECT * FROM ban_ip "); $num = mysql_num_rows ($result); mysql_close(); if ($num > 0 ) { $i=0; while ($i < $num) { $ip = stripslashes(mysql_result($result,$i,"ip")); $row .= '<tr> <td><a href="update.php?id=$id">ip</a></td> <td><a href="delete.php?id=$id">Delete</a></td> </tr>'; ++$i; }} else { $row = '<tr><td colspan="2" align="center">Nothing found</td></tr>'; } ?> <table border="1" cellpadding="3" cellspacing="0"><? echo $row ?></table> delete.php <?php include("connect.php"); $id = $_GET['id']; mysql_query("DELETE FROM ban_ip WHERE id = '$id' "); mysql_close(); echo "Entry deleted"; ?> and the database CREATE TABLE `ban_ip` ( `id` int(6) NOT NULL auto_increment, `ip` varchar(15) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ;