AnimeSuki Forums

Register Forum Rules FAQ Members List Social Groups Search Today's Posts Mark Forums Read

Go Back   AnimeSuki Forum > AnimeSuki & Technology > Tech Support

Notices

Reply
 
Thread Tools
Old 2006-01-11, 01:19   Link #1
phoenixfire92983
Senior Member
 
 
Join Date: Jan 2004
Location: California
Age: 31
Send a message via ICQ to phoenixfire92983 Send a message via AIM to phoenixfire92983 Send a message via MSN to phoenixfire92983
Help with webpage

Ok, I have a odd issue to bring up and I'm not sure what the name of what I'm looking for is so I'm hoping someone here can help

I have a website that introduces new Japanese artists. It gives a profile, their discography, etc.... and lastly, we have a section titled 'thoughts' where one of our members reviews the band. Some of the members want multiple opinions to be posted under these profiles and the only thing I can think to do is either do a tagboard or something similar to amazon or yesasia where you can submit your comments.

Problem is that we have over 200 artists and are still growing. I'm under the impression that you can only really have one tagboard on a site. I also don't know if you can edit or delete messages on tagboards because I'm worried about spam. I really would like to have a system like amazon or yesasia's where people can submit comments. I don't know what type of script they are using or what it is called. Can anyone help me out or is there another system I could use?

Here's a example of one of our profiles:
http://www.jmignited.com/leon.php
__________________
phoenixfire92983 is offline   Reply With Quote
Old 2006-01-11, 19:47   Link #2
ChibiDusk
Back From The Dead?
 
 
Join Date: Apr 2003
Location: Canada
Age: 25
Try switching over to a blog-like site - wordpress, movabletype, something of the sort. Your reviews could be posted via comments. Also, if you want - you could set up CuteNews, create an account for each artist, and let them enter their reviews there. You can use php to call the reviews and display them on the page you like.
__________________

AniBUROGU// Loveless Animation vs. Manga Comparison
ChibiDusk is offline   Reply With Quote
Old 2006-01-13, 01:38   Link #3
ImperialPanda
Senior Member
 
Join Date: Dec 2005
Location: US
Program a script in PHP/MySQL?

I dunno if all you need is simple user comments on the bottom of the page it doesn't seem too hard.

You already have a phpbb set up so you can even use the userdb from that, if you want a login.
ImperialPanda is offline   Reply With Quote
Old 2006-01-13, 03:10   Link #4
phoenixfire92983
Senior Member
 
 
Join Date: Jan 2004
Location: California
Age: 31
Send a message via ICQ to phoenixfire92983 Send a message via AIM to phoenixfire92983 Send a message via MSN to phoenixfire92983
ChibiDusk: not really looking for a blog type site. I don't see it as being successful like that or as organized.

Imperial Panda: Can you suggest any sites that discuss creating such scripts or guide me through how I could do that? My knowledge of PHP and MySQL is just so so.
__________________
phoenixfire92983 is offline   Reply With Quote
Old 2006-01-14, 00:38   Link #5
ImperialPanda
Senior Member
 
Join Date: Dec 2005
Location: US
Hmm... I'm not really sure about any web resources for learning php.

http://www.w3schools.com/php/default.asp

has some basic stuff.

http://www.php.net/manual/en/

php manual, a reference mostly, if you're using mysql you might be interested in

http://www.php.net/manual/en/ref.mysql.php

the "Table of Contents" lists pretty much all the functions you'll want

I'm not sure where you'd go about learning SQL queries. I just borrow books from the library heh. =P

I have some sample code that I wrote myself tho.
Code:
<?php

// dbconnect.php

include('/path/to/phpBB/config.php'); // replace with correct path to config.php in phpBB

$dbc = mysql_connect($dbhost, $dbuser, $dbpasswd) OR die('Could not connect to MySQL.');
mysql_select_db($dbname) OR die('Could not select database.');

unset($dbpasswd);

?>
The above script will connect to the phpbb database.

Code:
<?php

// login.php

define( IN_PHPBB, 1 );

ob_start(); // must be before any data is sent to browser

include('/path/to/dbconnect.php'); // replace with correct path to dbconnect.php
include('/path/to/phpBB/includes/constants.php'); // replace with correct path to constants.php in phpBB

function escape_data($data) {

	global $dbc;
	if( ini_get('magic_quotes_gpc')) {
		$data = stripslashes($data);
	}
	return mysql_real_escape_string($data, $dbc);

}

if( isset( $_POST['submit'] ) ) {

	if( empty($_POST['username']) ) {

		echo '<p>You forgot to enter your username.</p>';
		$username = FALSE;

	} else {

		$username = escape_data( $_POST['username'] );

	}

	if( empty($_POST['password']) ) {

		echo '<p>You forgot to enter your password.</p>';
		$password = FALSE;

	} else {

		$password = escape_data( $_POST['password'] );

	}

	if( $username && $password ) {

		$query = "SELECT user_id, username, user_password, user_active, user_level
			FROM " . USERS_TABLE . " WHERE username = '" . str_replace("\\'", "''", $username) . "'";
		$result = mysql_query($query);
		$row = mysql_fetch_array( $result, MYSQL_ASSOC );

		if( $row ) {
	
			if( md5($password) == $row['user_password'] && $row['user_active'] ) {
	
				session_start();
				$_SESSION['username'] = $row['username'];
				$_SESSION['user_id'] = $row['user_id'];
				echo 'You have logged in.';
				ob_end_flush();
				exit();

			} else {

				echo 'Incorrect information entered.';
	
			}
	
		} else {
	
			echo 'Incorrect information entered.';

		}

	}

}

?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

<p><b>User Name: </b><input type="text" name="username" size="15" maxlength="25" 
	value="<?php if(isset($_POST['username'])) echo $_POST['username']; ?>" /></p>
<p><b>Password: </b><input type="password" name="password" size="15" maxlength="25" /></p>

<div align="center"><input type="submit" name="submit" value="Login" /></div>

</form>

<?php

ob_end_flush();

?>
The above is a login script which will log a user in based on information in phpbb's database. It starts a session and sets $_SESSION['username'] and $_SESSION['user_id'] variables. This script doesn't have the necessary html around it so you'd have to include your own template.

The following is a couple more bits I just typed up. It'll be the start of building a simple comments system you'd have to fill out the queries in the post.php and make your displays.

Code:
<?php

// pdbconnect.php

// replace with correct hostname, username and password.
$pdbc = mysql_connect( 'hostname', 'username', 'password' ) OR die('Could not connect to MySQL.');

// replace with the correct database name.
mysql_select_db('database_name') OR die('Could not select database.');

// replace with correct password variable, delete if you didn't use a variable for the password
unset('password');

?>
Code:
<?php

// pdbsetup.php - delete after successful use

include('/path/to/pdbconnect.php'); // replace with correct path to pdbconnect.php

$result1 = mysql_query("CREATE TABLE posts ( post_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, 
	group_id MEDIUMINT UNSIGNED NOT NULL, user_id MEDIUMINT UNSIGNED NOT NULL, post_text TEXT 
	NOT NULL, post_date DATETIME NOT NULL, PRIMARY KEY (post_id) )");
$result2 = mysql_query("CREATE TABLE users ( user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, 
	username VARCHAR(25) NOT NULL, PRIMARY KEY (user_id) )");
$result3 = mysql_query("CREATE TABLE groups ( group_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, 
	groupname VARCHAR(40) NOT NULL, PRIMARY KEY (group_id) )");

if( $result1 && $result2 && $result3 ) {

	echo 'Successfully setup database.';

} else {

	echo 'Setup unsuccessful.';

}

?>
Code:
<?php

// post.php

include('/path/to/pdbconnect.php'); // replace with correct path to pdbconnect.php

session_start();

if( isset($_POST['submit']) && isset($_SESSION['username']) ) {

	// if groupname for comments is not in groups table, insert it

	// if username for comments is not in users table, insert it	

	// obtain the correct group_id and user_id

	// finally, insert group_id, user_id, $_POST['comments'], post_date into posts table

} else {

	if( !(isset($_SESSION['username']) ) {

		echo 'You need to log in to post comments.';

	} else {

?>

<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">

<p><b>Comments: </b><br />
<textarea name="comments" rows="5" cols="60"></textarea></p>

<div align="center"><input type="submit" name="submit" value="Submit" /></div>

</form>

<?php

	}

}

?>
ImperialPanda is offline   Reply With Quote
Old 2006-01-14, 22:16   Link #6
phoenixfire92983
Senior Member
 
 
Join Date: Jan 2004
Location: California
Age: 31
Send a message via ICQ to phoenixfire92983 Send a message via AIM to phoenixfire92983 Send a message via MSN to phoenixfire92983
Thanks for your help!
__________________
phoenixfire92983 is offline   Reply With Quote
Old 2006-01-15, 10:43   Link #7
Ending
Senior Member
 
 
Join Date: May 2004
Does that work with IPB too or can you direct to some -preferably- simple tool for similar comment-boxes?
Ending is offline   Reply With Quote
Old 2006-01-16, 00:06   Link #8
ImperialPanda
Senior Member
 
Join Date: Dec 2005
Location: US
Eh well most likely IPB would have put the db login info somewhere else. And the table design is probably different. I don't really know since it's not free. But the basic idea is the same, just a mysql_connect() with the forum db for login and use queries to interact with another database to store your own info.

Writing up my own content management/site admin right now so kinda busy (no more ftp damn it! xD).
ImperialPanda is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:04.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
We use Silk.