• Forum Techniques [Help/ ideas needed]
    4 replies, posted
Hello, I am undergoing web development at the moment, I am using WAMP to host my server and I am only going to host it through lan while it is still in development, I will be using PHP Ver 5.3.9, MySql Ver 5.5.20, APache Ver 2.2.21 and WAMP 2.2, I have had plenty of experience with HTML, CSS, XML and JavaScript but I am fairly new to PHP and MySql. I also want to create a basic app in C#.net 4 that will connect to the server and MySql database and inform the client how many users are online and the client will be able to view threads and post up threads and comments on other users threads. (I don't need any suggestions here) Any idea for the forums would be greatly appreciated :) Thankyou SciBerC P.S. Do not be rude on my post. :)
Here's one hint: Don't have the C# app connect directly to the database. Make an API it can connect to instead.
Hello, I am undergoing web development at the moment, I am using WAMP to host my server and I am only going to host it through lan while it is still in development, I will be using PHP Ver 5.3.9, MySql Ver 5.5.20, APache Ver 2.2.21 and WAMP 2.2, I have had plenty of experience with HTML, CSS, XML and JavaScript but I am fairly new to PHP and MySql. ----------------------------- Well first you need to know why PHP and MySQL. This takes care off the dynamics of your website. With HTML you can only display text and coulden't add anything dynamic so the script could respond on a input. In PHP you almost use alway's if statements so you compare data. To make a forum you draw on the paper a drawning with how you think it should work like this, PC (USER)>>CONTROLLER(Takes care of the request)>>Model(Get's everything out of the database,returns it to the controller so it gives the data back.)>>Controller(The data can be compared and given to the view>>View(display's the forum) My tip start simple no layouts and shit just simple what do you need? You need something so it can read the URL segments (URI) because you got categories, topics, posts so it will look like [url]http://www.heresomething.com/forum/4(cat[/url] id)/ and then it loads all the posts. This is how i did it in my database: For the cats: Table Name: forum_cats. Structure: cat_id cat_name cat_subject Table name: forum_topics: topic_id topic_cat topic_author topic_date topic_title Table name: forum_posts: post_id post_cat post_topic post_author post_date post_content Like you see everything is linked to eachelder this is supposed because then you can link them with PHP. So if you would open my controller of my forum it would look like this: [code] <?php class Forum extends Controller { public function __construct() { parent::__construct(); $this->load->database('***', '****', '*****'); $this->load->model('forum/crud_model'); $this->load->model('forum/get_model'); $this->load->library('session'); $this->load->helper('text_helper'); } public function index() { $data['cats'] = $this->get_model->getCats(); $this->load->view('forum/cats_view', $data); } public function topics() { $data['topics'] = $this->get_model->getTopics(); $this->load->view('forum/topics_view', $data); } public function topic() { if($this->get_model->getPosts() != FALSE) { $data['posts'] = $this->get_model->getPosts(); $this->load->view('forum/topic_view', $data); } else { $data['var_heading'] = 'No posts'; $data['var_content'] = 'There are no posts availible.'; $this->load->view('var_view', $data); } } public function reageren() { if( $_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['reaction']) ) { if( $this->session->Get('logged_in') == TRUE ) { $this->crud_model->addPost(); $data['var_heading'] = 'Replyed'; $data['var_content'] = 'Your reply has been posted.'; $this->load->view('var_view', $data); } else { $data['var_heading'] = 'Error'; $data['var_content'] = 'U have to login to reply on this treath.'; $this->load->view('var_view', $data); } } else { $this->load->view('forum/addpost_view'); } } public function nieuwtopic() { if( $_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['topic_name']) ) { if( $this->session->Get('logged_in') == TRUE) { $this->crud_model->newTopic(); $data['var_heading'] = 'Topic added'; $data['var_content'] = 'You'r topic has been created.'; $this->load->view('var_view', $data); } else { $data['var_heading'] = 'Error'; $data['var_content'] = 'Sorry you are not logged in to create a topic.'; $this->load->view('var_view', $data); } } else { $this->load->view('forum/newtopic_view'); } } } [/code] I think this will not help you out but it gives you a direction in wich you should go.
[QUOTE=swift and shift;34570261]Here's one hint: Don't have the C# app connect directly to the database. Make an API it can connect to instead.[/QUOTE] What are the perks of doing it this way?
[QUOTE=toaster468;34702737]What are the perks of doing it this way?[/QUOTE] It stops people picking apart your program and gaining your database name and password. It happens all the time.
Sorry, you need to Log In to post a reply to this thread.