Personal Blog for Users

Posted on Friday 8th June 2007 at 04:24 AM
MCP
MCP's Avatar
On the RMB user system. I would like this feature. But I don't know how to make it. Could someone help me?
Posted on Friday 8th June 2007 at 05:11 AM
SkillMaster
SkillMaster's Avatar
What features would it need?
Posted on Friday 8th June 2007 at 06:53 AM
MCP
MCP's Avatar
It would look like so:

Title
Body

That is it. On the viewing of the person's profile it shows either their latest blog or a link to it. Or a link saying "View my Blog" or something along those lines.
Posted on Friday 8th June 2007 at 10:33 PM
SkillMaster
SkillMaster's Avatar
ill whip one up now. k
Posted on Friday 8th June 2007 at 10:58 PM
SkillMaster
SkillMaster's Avatar
members.php
Code
Blogs:<br>";
$fetch = mysql_query("SELECT * FROM `blog` WHERE `username` = '$user[username]'");
while($blog = mysql_fetch_array($fetch))
{
echo("- <a href='blog.php?title=$blog[title]'>$blog[title]</a><br>");
}
echo "

after
Code
Sex: $user[sex]<br>
Age: $user[age]

make a new file called blog.php
PHP Code
  1. <?php
  2. session_start();
  3. include ("config.php");
  4. if ($logged[username])
  5. {
  6. switch($_GET[page])
  7. {
  8. default:
  9. $title = ("$_GET[title]");
  10. $fetch = mysql_query("SELECT * FROM `blog` WHERE `title` = '$title'");
  11. $blog = mysql_fetch_array($fetch);
  12. if ($logged[username] == $blog[username])
  13. {
  14. echo ("<a href='?page=addblog'>Add blog</a>");
  15. }
  16. else
  17. {
  18. echo("<b>$blog[title]</b><br>$blog[message]");
  19. }
  20. break;
  21.  
  22. case 'addblog':
  23. echo ("
  24. <form method='POST' action='?page=insertblog'>
  25. <table width='100%'>
  26. <tr>
  27. <td align='right' width='25%'>Title</td>
  28. <td align='left'>
  29. <input size='25' name='title'></td>
  30. </tr>
  31. <tr>
  32. <td align='right' width='25%'>Message</td>
  33. <td align='left'>
  34. <textarea cols='30' rows='10' name='message'></textarea></td>
  35. </tr>
  36. <tr>
  37. <td align='center'></td>
  38. <td align='left'>
  39. <input type='submit' name='submit' value='New Blog'></td>
  40. </tr>
  41. </table>
  42. </form>
  43. ");
  44. break;
  45.  
  46. case 'insertblog':
  47. $title = htmlspecialchars($_POST[title]);
  48. $message = htmlspecialchars($_POST[message]);
  49. $insert = mysql_query("INSERT INTO `forum_category` (`name`, `message`, `username`) VALUES ('$category', '$message', '$logged[username]')");
  50. echo ("New Blog Created.");
  51. break;
  52. }
  53. }
  54. ?>
Posted on Friday 8th June 2007 at 10:58 PM
SkillMaster
SkillMaster's Avatar
Code
CREATE TABLE `blog` (
`id` int(10) NOT NULL auto_increment,
`title` varchar(225) NOT NULL default '',
`message` varchar(225) NOT NULL default '',
`username` varchar(225) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

thats the mysql code
Posted on Friday 8th June 2007 at 11:02 PM
SkillMaster
SkillMaster's Avatar
Thats basic you can modify it make it better post as a tut if you like.
Posted on Saturday 9th June 2007 at 02:31 AM
MCP
MCP's Avatar
All I get with this is a blank page.

Below is my code.
PHP Code
  1. <?php
  2. session_start();
  3. include ("config.php");
  4. if ($logged[username])
  5. {
  6. switch($_GET[page])
  7. {
  8. default:
  9. $title = ("$_GET[title]");
  10. $fetch = mysql_query("SELECT * FROM `blog` WHERE `title` = '$title'");
  11. $blog = mysql_fetch_array($fetch);
  12. if ($logged[username] == $blog[username])
  13. {
  14. echo ("<a href='?page=addblog'>Add blog</a>");
  15. }
  16. else
  17. {
  18. echo("<b>$blog[title]</b><br>$blog[message]");
  19. }
  20. break;
  21.  
  22. case 'addblog':
  23. echo ("
  24. <form method='POST' action='?page=insertblog'>
  25. <table width='100%'>
  26. <tr>
  27. <td align='left' width='13%'>Title</td>
  28. <td width='87%' align='left'><input size='25' name='title'></td>
  29. </tr>
  30. <tr>
  31. <td align='left' width='13%'>Body</td>
  32. <td align='left'><textarea cols='30' rows='10' name='message'></textarea></td>
  33. </tr>
  34. <tr>
  35. <td colspan='2'><left><input type='submit' name='submit' value='Post Blog'></left></td>
  36. </tr>
  37. </table></form>
  38. ");
  39. break;
  40.  
  41. case 'insertblog':
  42. $title = htmlspecialchars($_POST[title]);
  43. $message = htmlspecialchars($_POST[message]);
  44. $insert = mysql_query("INSERT INTO `forum_category` (`name`, `message`, `username`) VALUES ('$category', '$message', '$logged[username]')");
  45. echo ("New Blog Created.");
  46. break;
  47. }
  48. }
  49. ?>
Posted on Friday 22nd June 2007 at 10:03 AM
dtnet
dtnet's Avatar
Its the same for me
Posted on Friday 13th July 2007 at 03:12 AM
MCP
MCP's Avatar
Hey Skillmaster any way to get this working, please?
Login or register to respond to this forum topic.