New CMS - Help Needed

Reply

Join Date: Apr 2005
Posts: 16,145
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

New CMS - Help Needed

 
0
  #1
May 10th, 2007
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.
Last edited by jbennet; May 10th, 2007 at 7:01 pm.
Attached Thumbnails
add.JPG   id.JPG   main.JPG  
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 521
Reputation: pty is on a distinguished road 
Solved Threads: 37
pty's Avatar
pty pty is offline Offline
Posting Pro

Re: New CMS - Help Needed

 
0
  #2
May 10th, 2007
Looks like a good start. No better way of learning than diving in and trying to actually build something useful!
Note to self... pocket cup
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,145
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: New CMS - Help Needed

 
0
  #3
May 11th, 2007
hmm i am going to try and add a search function and an admin panel
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,145
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: New CMS - Help Needed

 
0
  #4
May 11th, 2007
hey heres a little function i used in order to make PHP's date/time more human readable.

  1.  
  2. <?php
  3. function formatDate($val)
  4. {
  5. $arr = explode('-', $val);
  6. return date('d M Y', mktime(0,0,0, $arr[1], $arr[2], $arr[0]));
  7. }
  8. ?>

someone may find it useful
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,145
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: New CMS - Help Needed

 
0
  #5
May 11th, 2007
Aha! Ok i made the admin panel. The admin can now add/edit/delete

now i just need some sort of authentication and a search function
Attached Thumbnails
add.jpg   admin.JPG   edit.jpg   index.JPG  

story.JPG  
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,145
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: New CMS - Help Needed

 
0
  #6
May 11th, 2007
why is this code not working:

(its meant to edit - i always get error on the last line?)

  1.  
  2. <html>
  3. <body>
  4. <table width="100%" cellspacing="0" cellpadding="5">
  5. <tr>
  6. <td bgcolor="Orange"><font size="5" color="Black">
  7. <b>James Bennet's CMS</b></font>
  8. </td>
  9. </tr>
  10. </table>
  11. <?php
  12. include('../lib/conf.php');
  13. include('../lib/functions.php');
  14. if (!$_POST['submit'])
  15. {
  16. if ((!isset($_GET['id']) || trim($_GET['id']) == ''))
  17. {
  18. die('Missing record ID!');
  19. }
  20. $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to mysql database!');
  21. mysql_select_db($db) or die ('Unable to select mysql database!');
  22. $id = $_GET['id'];
  23. $query = "SELECT title, content, contact FROM news WHERE id = '$id'";
  24. $result = mysql_query($query) or die ("Error in mysql query: $query. " . mysql_error());
  25.  
  26. if (mysql_num_rows($result) > 0)
  27. {
  28. $row = mysql_fetch_object($result);
  29. ?>
  30. <table cellspacing="5" cellpadding="5">
  31. <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
  32. <input type="hidden" name="id" value="<?php echo $id; ?>">
  33. <tr>
  34. <td valign="top"><b><font size="2">Title</font></b></td>
  35. <td>
  36. <input size="50" maxlength="250" type="text" name="title"
  37. value="<?php echo $row->title; ?>">
  38. </td>
  39. </tr>
  40. <tr>
  41. <td valign="top"><b><font size="2">Content</font></b></td>
  42. <td>
  43. <textarea name="content" cols="40" rows="10">
  44. <?php echo $row->content; ?>
  45. </textarea>
  46. </td>
  47. </tr>
  48. <tr>
  49. <td valign="top"><b><font size="2">Contact Address:</font></b></td>
  50. <td>
  51. <input size="50" maxlength="250" type="text" name="contact"
  52. value="<?php echo $row->contact; ?>">
  53. </td>
  54. </tr>
  55. <tr>
  56. <td>
  57. <input type="Submit" name="submit" value="Edit">
  58. </td>
  59. </tr>
  60. </form>
  61. </table>
  62. <?php
  63. }
  64. else
  65. {
  66. echo '<font size=-1>That content could not be located in our database.</font>';
  67. }
  68. }
  69. else
  70. {
  71. $errorList = array();
  72.  
  73. $title = $_POST['title'];
  74. $content = $_POST['content'];
  75. $contact = $_POST['contact'];
  76. $id = $_POST['id'];
  77.  
  78. if ((!isset($_POST['id']) || trim($_POST['id']) == ''))
  79. {
  80. die ('Missing record ID!');
  81. }
  82. if (trim($_POST['title']) == '')
  83. {
  84. $errorList[] = 'Invalid entry: Title';
  85. }
  86.  
  87. if (trim($_POST['content']) == '')
  88. {
  89. $errorList[] = "Invalid entry: Content";
  90. }
  91.  
  92. if (trim($_POST['contact']) == '')
  93. {
  94. $contact = $def_contact;
  95. }
  96.  
  97. if (sizeof($errorList) == 0)
  98. {
  99. $connection = mysql_connect($host, $user, $pass) or die ('Unable to connect to mysql database!');
  100. mysql_select_db($db) or die ('Unable to select mysql database!');
  101. $query = "UPDATE news SET title = '$title', content = '$content', contact = '$contact', timestamp = NOW() WHERE id = '$id'";
  102. $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
  103. echo '<font size=-1>Update successful!';
  104. echo '<a href=index.php>Go back to the main menu</a>.</font>';
  105. mysql_close($connection);
  106. }
  107. else
  108. {
  109. echo '<font size=-1>The following errors were encountered:';
  110. echo '<br>';
  111. echo '<ul>';
  112. for ($x=0; $x<sizeof($errorList); $x++)
  113. {
  114. echo "<li>$errorList[$x]";
  115. }
  116. echo '</ul></font>';
  117. }
  118. }
  119. ?>
  120. </body>
  121. </html>
  122.  
Last edited by jbennet; May 11th, 2007 at 12:24 pm.
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 2,564
Reputation: Serunson is an unknown quantity at this point 
Solved Threads: 43
Serunson's Avatar
Serunson Serunson is offline Offline
Posting Maven

Re: New CMS - Help Needed

 
0
  #7
May 11th, 2007
You probs missed a { or } or ( or ) somewhere
otherwise that is my knowledge wasted!
The Great Lord, Serunson.
Epic Hedgehog power all the way!

Quote from scru :: "If you were a file I'd hit delete."
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 2,564
Reputation: Serunson is an unknown quantity at this point 
Solved Threads: 43
Serunson's Avatar
Serunson Serunson is offline Offline
Posting Maven

Re: New CMS - Help Needed

 
0
  #8
May 11th, 2007
== '') ==> that dont look right ~
should it not be like =="") ?
The Great Lord, Serunson.
Epic Hedgehog power all the way!

Quote from scru :: "If you were a file I'd hit delete."
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,145
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: New CMS - Help Needed

 
0
  #9
May 11th, 2007
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)
Last edited by jbennet; May 11th, 2007 at 6:14 pm.
Attached Thumbnails
add.JPG   admin.JPG   article.JPG   cp.JPG  

edit.JPG   main.JPG  
Attached Files
File Type: zip index.zip (5.7 KB, 34 views)
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 143
Reputation: didier-fr is an unknown quantity at this point 
Solved Threads: 0
didier-fr's Avatar
didier-fr didier-fr is offline Offline
Junior Poster

Re: New CMS - Help Needed

 
0
  #10
May 12th, 2007
Why don't use Smarty?
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC