Announcement add not work on my pc wireless internet but on phone it does work ive got wireless internet so i dnt know if i have to change the code so that it will work i can add notifications but not announcments please can anyone help
admin.php
functions.php
or if there is another way i can get a code to add on my site that i can add new announcements with images would also work
admin.php
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Valentinos</title> <meta name="keywords" content="Valentinos" /> <meta name="description" content="Valentinos" /> <link href="templatemo_style.css" rel="stylesheet" type="text/css" /> <link rel="icon"type="images/favicon.ico"href="images/favicon.ico" /> </head> <body> <div id="templatemo_wrapper"> <div id="templatemo_header"> <a href="" target="_parent">Valentinos</a> </div> <div id="templatemo_menu"> <ul> <li><a href="admin.php" class="current">Admin Panel</a></li> <li><a href="?act=announcements">Announcements</a></li> <li><a href="?act=notice">Notices</a></li> <li><a href="gallery/admin.php">Gallery</a></li> </ul> </div> <!-- end of templatemo_menu --> <div id="templatemo_main"> <div id="templatemo_content"> <div class="content_box"> <?php include('functions.php'); $act = isset($_GET['act']) ? Cleanse($mysqli, $_GET['act']) : null; if($act == '') { echo '<h2>WELCOME TO VALENTINOS ADMIN PANEL</h2><br/>'; echo '<a href="?act=announcements"><h5>Announcements</h5></a><br/>'; echo '<a href="?act=notice"><h5>Notices</h5></a><br/>'; echo '<a href="gallery/admin.php"><h5>Gallery</h5></a><br/></br>'; echo '<h5>Go to gallery copy the image link you have uploaded then go to announcements and paste the link to the image url</h5><br/>'; } if($act == 'logout') { { session_destroy(); echo '<meta http-equiv="Refresh" content="0; url=admin.php" />'."\r\n"; } } if($act == 'announcements') { { admin_announcements($mysqli); } } if($act == 'edit_announcement') { { if(isset($_POST['update_announcement'])) { $image = Cleanse($mysqli, $_POST['image']); $title = Cleanse($mysqli, $_POST['title']); $description = Cleanse($mysqli, $_POST['description']); admin_update_announcement($mysqli, $id, $image, $title, $description); } else { admin_get_announcement($mysqli, $id); } } } if($act == 'delete_announcement') { { admin_delete_announcement($mysqli, $id); } } if($act == 'create_announcement') { { if(isset($_POST['create_new_announcement'])) { $image = Cleanse($mysqli, $_POST['image']); $title = Cleanse($mysqli, $_POST['title']); $description = Cleanse($mysqli, $_POST['description']); admin_create_announcement($mysqli, $image, $title, $description); } else { echo '<form method="post" action="?act=create_announcement&id='.$id.'">'; echo 'image location:<br/><input name="image" value="" type="text" maxlength="255"/><br/>'; echo 'title:<br/><input name="title" value="" type="text" maxlength="255"/><br/>'; echo 'description:<br/><textarea name="description" cols="70" rows="15"></textarea><br/><br/>'; echo '<input type="submit" value="Create" name="create_new_announcement" /><br/><br/>'; echo '</form>'; } } } if($act == 'notice') { { admin_notice($mysqli); } } if($act == 'edit_notice') { { if(isset($_POST['update_notice'])) { $description = Cleanse($mysqli, $_POST['description']); admin_update_notice($mysqli, $id, $description); } else { admin_get_notice($mysqli, $id); } } } if($act == 'delete_notice') { { admin_delete_notice($mysqli, $id); } } if($act == 'create_notice') { { if(isset($_POST['create_new_notice'])) { $description = Cleanse($mysqli, $_POST['description']); admin_create_notice($mysqli, $description); } else { echo '<form method="post" action="?act=create_notice&id='.$id.'">'; echo 'description:<br/><textarea name="description" cols="70" rows="15"></textarea><br/><br/>'; echo '<input type="submit" value="Create" name="create_new_notice" /><br/><br/>'; echo '</form>'; } } } $mysqli->close(); ?> </div> </div> </div> <!-- end of content --> </div> <!-- end of main --> <div id="templatemo_footer"> Copyright © 2013 <a href="#">Valentinos</a> | Designed by <a href="http://www.gw-designs.co.za" target="_parent">GW-Designs</a> | Validate <a href="http://validator.w3.org/check?uri=referer">XHTML</a> & <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> </div> <!-- end of footer --> </div> <!-- end of wrapper --> </body> </html>
Code:
<?php /** Connect to database (host, username, password, database) */ $mysqli = new mysqli('localhost', 'valentin_valen', 'valen2013', 'valentin_valentin'); if($mysqli->connect_errno) { /** Check connection */ printf("<br/><u>Information:</u><br/><b>Connecting To Mysqli Failed: %s\n</b>", $mysqli->connect_error); exit(); } /** Cleanse */ function Cleanse($mysqli, $Data) { $Data = $mysqli->real_escape_string(htmlentities(get_magic_quotes_gpc() ? stripslashes($Data) : $Data, ENT_QUOTES, 'UTF-8')); return $Data; } /** announcements display */ function announcements($mysqli) { $query = $mysqli->query('SELECT * FROM `announcements` ORDER BY `id` DESC') or die($mysqli->error); if($query->num_rows > 0) { while($row = $query->fetch_assoc()) { echo '<a href="" target="_parent"><img class="image_wrapper image_fl" src="'.$row['image'].'" width="200" height="170" alt="image 2" /></a>'; echo '<h4>'.$row['title'].'</h4>'; echo '<h5>'.$row['description'].'<h5>'; echo '<div class="clear h40"></div>'; } } } /** admin announcements display */ function admin_announcements($mysqli) { $query = $mysqli->query('SELECT * FROM `announcements` ORDER BY `id` DESC') or die($mysqli->error); if($query->num_rows > 0) { while($row = $query->fetch_assoc()) { echo '<a href="" target="_parent"><img class="image_wrapper image_fl" src="'.$row['image'].'" width="200" height="170" alt="image 2" /></a>'; echo '<h4>'.$row['title'].'</h4>'; echo '<h5>'.$row['description'].'<h5>'; echo '<a href="?act=edit_announcement&id='.$row['id'].'">edit</a> '; echo '<a href="?act=delete_announcement&id='.$row['id'].'">delete</a> '; echo '<div class="clear h40"></div>'; } } echo '<a href="?act=create_announcement">Create New Announcement</a>'; $query->free(); } /** admin get announcement */ function admin_get_announcement($mysqli, $id) { $query = $mysqli->query('SELECT * FROM `announcements` WHERE `id`="'.$id.'" LIMIT 1') or die($mysqli->error); if($query->num_rows > 0) { while($row = $query->fetch_assoc()) { $image = $row['image']; $title = $row['title']; $description = $row['description']; } } $query->free(); echo '<form method="post" action="?act=edit_announcement&id='.$id.'">'; echo 'image location:<br/><input name="image" value="'.$image.'" type="text" maxlength="255"/><br/>'; echo 'title:<br/><input name="title" value="'.$title.'" type="text" maxlength="255"/><br/>'; echo 'description:<br/><textarea name="description" cols="70" rows="15">'.$description.'</textarea><br/><br/>'; echo '<input type="submit" value="Update" name="update_announcement" /><br/><br/>'; echo '</form>'; } /** admin update announcement */ function admin_update_announcement($mysqli, $id, $image, $title, $description) { $query = $mysqli->query('UPDATE `announcements` SET image="'.$image.'", title="'.$title.'", description="'.$description.'" WHERE id="'.$id.'" LIMIT 1') or die($mysqli->error); if($query) { echo 'your announcement was updated successfully!<br/>'; echo '<a href="?act=announcements">back to announcements</a>'; } else { echo 'There was a problem updating your announcement. Please go back and try again.<br/>'; echo '<a href="?act=edit_announcement&id='.$id.'">back to edit</a>'; } } /** admin delete announcement */ function admin_delete_announcement($mysqli, $id) { $query = $mysqli->query('DELETE FROM `announcements` WHERE id="'.$id.'"') or die($mysqli->error); if($query) { echo 'your announcement was deleted successfully!<br/>'; echo '<a href="?act=announcements">back to announcements</a>'; } else { echo 'there was a problem deleting the announcement. please try again.<br/>'; echo '<a href="?act=announcements">back to announcements</a>'; } } /** admin create announcement */ function admin_create_announcement($mysqli, $image, $title, $description) { $query = $mysqli->query('INSERT INTO `announcements` (`id`, `image`, `title`, `description`) VALUES (NULL, "'.$image.'", "'.$title.'", "'.$description.'")') or die($mysqli->error); if($query) { echo 'your announcement was created successfully!<br/>'; echo '<a href="?act=announcements">back to announcements</a>'; } else { echo 'There was a problem creating your announcement. Please go back and try again.<br/>'; echo '<a href="?act=create_announcement">back to create announcement</a>'; } } /** notice display */ function notice($mysqli) { $query = $mysqli->query('SELECT * FROM `notice` ORDER BY `id` DESC') or die($mysqli->error); if($query->num_rows > 0) { echo '<ul class="tmo_list">'; while($row = $query->fetch_assoc()) { echo '<a href="" target="_parent"></a>'; echo '<li><h5>'.$row['description'].'<h5></li>'; } echo '</ul>'; } } /** admin notice display */ function admin_notice($mysqli) { $query = $mysqli->query('SELECT * FROM `notice` ORDER BY `id` DESC') or die($mysqli->error); if($query->num_rows > 0) { echo '<ul class="tmo_list">'; while($row = $query->fetch_assoc()) { echo '<li>'; echo '<h5>'.$row['description'].'<h5>'; echo '<a href="?act=edit_notice&id='.$row['id'].'">edit</a> '; echo '<a href="?act=delete_notice&id='.$row['id'].'">delete</a> '; echo '</li>'; } echo '</ul>'; } echo '<br/><a href="?act=create_notice">Create New notice</a>'; $query->free(); } /** admin get notice */ function admin_get_notice($mysqli, $id) { $query = $mysqli->query('SELECT * FROM `notice` WHERE `id`="'.$id.'" LIMIT 1') or die($mysqli->error); if($query->num_rows > 0) { while($row = $query->fetch_assoc()) { print_r($row); $description = $row['description']; } } $query->free(); echo '<form method="post" action="?act=edit_notice&id='.$id.'">'; echo 'description:<br/><textarea name="description" cols="70" rows="15">'.$description.'</textarea><br/><br/>'; echo '<input type="submit" value="Update" name="update_notice" /><br/><br/>'; echo '</form>'; } /** admin update notice */ function admin_update_notice($mysqli, $id, $description) { $query = $mysqli->query('UPDATE `notice` SET description="'.$description.'" WHERE id="'.$id.'" LIMIT 1') or die($mysqli->error); if($query) { echo 'your notice was updated successfully!<br/>'; echo '<a href="?act=notice">back to notice</a>'; } else { echo 'There was a problem updating your notice. Please go back and try again.<br/>'; echo '<a href="?act=edit_notice&id='.$id.'">back to edit</a>'; } } /** admin delete notice */ function admin_delete_notice($mysqli, $id) { $query = $mysqli->query('DELETE FROM `notice` WHERE id="'.$id.'"') or die($mysqli->error); if($query) { echo 'your notice was deleted successfully!<br/>'; echo '<a href="?act=notice">back to notice</a>'; } else { echo 'there was a problem deleting the notice. please try again.<br/>'; echo '<a href="?act=notice">back to notice</a>'; } } /** admin create notice */ function admin_create_notice($mysqli, $description) { $query = $mysqli->query('INSERT INTO `notice` (`id`, `description`) VALUES (NULL, "'.$description.'")') or die($mysqli->error); if($query) { echo 'your notice was created successfully!<br/>'; echo '<a href="?act=notice">back to notice</a>'; } else { echo 'There was a problem creating your notice. Please go back and try again.<br/>'; echo '<a href="?act=create_notice">back to create notice</a>'; } } ?>
Comment