| | |
New CMS - Help Needed
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Ok i am making a CMS using PHP/Mysql (its designed as a learning experience for me so it will not be anything like mambo etc...
)
Anyway, here are some screenies. If anyone wants to help then I would happily share what little code I have written.
)Anyway, here are some screenies. If anyone wants to help then I would happily share what little code I have written.
Last edited by jbennet; May 10th, 2007 at 7:01 pm.
If i am helpful, please give me reputation points.
hey heres a little function i used in order to make PHP's date/time more human readable.
someone may find it useful
PHP Syntax (Toggle Plain Text)
<?php function formatDate($val) { $arr = explode('-', $val); return date('d M Y', mktime(0,0,0, $arr[1], $arr[2], $arr[0])); } ?>
someone may find it useful
If i am helpful, please give me reputation points.
why is this code not working:
(its meant to edit - i always get error on the last line?)
(its meant to edit - i always get error on the last line?)
PHP Syntax (Toggle Plain Text)
<html> <body> <table width="100%" cellspacing="0" cellpadding="5"> <tr> <td bgcolor="Orange"><font size="5" color="Black"> <b>James Bennet's CMS</b></font> </td> </tr> </table> <?php include('../lib/conf.php'); include('../lib/functions.php'); if (!$_POST['submit']) { if ((!isset($_GET['id']) || trim($_GET['id']) == '')) { die('Missing record ID!'); } $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to mysql database!'); mysql_select_db($db) or die ('Unable to select mysql database!'); $id = $_GET['id']; $query = "SELECT title, content, contact FROM news WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in mysql query: $query. " . mysql_error()); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_object($result); ?> <table cellspacing="5" cellpadding="5"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <input type="hidden" name="id" value="<?php echo $id; ?>"> <tr> <td valign="top"><b><font size="2">Title</font></b></td> <td> <input size="50" maxlength="250" type="text" name="title" value="<?php echo $row->title; ?>"> </td> </tr> <tr> <td valign="top"><b><font size="2">Content</font></b></td> <td> <textarea name="content" cols="40" rows="10"> <?php echo $row->content; ?> </textarea> </td> </tr> <tr> <td valign="top"><b><font size="2">Contact Address:</font></b></td> <td> <input size="50" maxlength="250" type="text" name="contact" value="<?php echo $row->contact; ?>"> </td> </tr> <tr> <td> <input type="Submit" name="submit" value="Edit"> </td> </tr> </form> </table> <?php } else { echo '<font size=-1>That content could not be located in our database.</font>'; } } else { $errorList = array(); $title = $_POST['title']; $content = $_POST['content']; $contact = $_POST['contact']; $id = $_POST['id']; if ((!isset($_POST['id']) || trim($_POST['id']) == '')) { die ('Missing record ID!'); } if (trim($_POST['title']) == '') { $errorList[] = 'Invalid entry: Title'; } if (trim($_POST['content']) == '') { $errorList[] = "Invalid entry: Content"; } if (trim($_POST['contact']) == '') { $contact = $def_contact; } if (sizeof($errorList) == 0) { $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to mysql database!'); mysql_select_db($db) or die ('Unable to select mysql database!'); $query = "UPDATE news SET title = '$title', content = '$content', contact = '$contact', timestamp = NOW() WHERE id = '$id'"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); echo '<font size=-1>Update successful!'; echo '<a href=index.php>Go back to the main menu</a>.</font>'; mysql_close($connection); } else { echo '<font size=-1>The following errors were encountered:'; echo '<br>'; echo '<ul>'; for ($x=0; $x<sizeof($errorList); $x++) { echo "<li>$errorList[$x]"; } echo '</ul></font>'; } } ?> </body> </html>
Last edited by jbennet; May 11th, 2007 at 12:24 pm.
If i am helpful, please give me reputation points.
here are screenshots of the newest version . I got .htaccess authentication running. Full code is here and if possible can get some help making it look nicer.
Source code included (not the htaccess stuff)
Source code included (not the htaccess stuff)
Last edited by jbennet; May 11th, 2007 at 6:14 pm.
If i am helpful, please give me reputation points.
![]() |
Similar Threads
- Hey Guys, CMS needed ..... (Existing Scripts)
- PHP/MySQL CMS Beta Testers Needed (Software Development Job Offers)
- SEO-Friendly CMS Program, Anyone? (PHP)
- Web CMS 2006 (Windows NT / 2000 / XP)
- PHP Programmer needed (CMS) (PHP)
Other Threads in the PHP Forum
- Previous Thread: PHP Session Admin Advice?
- Next Thread: sql INSERT question
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql navigation number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white xml youtube






