2006-01-11, 01:19 | Link #1 |
Senior Member
|
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 |
2006-01-11, 19:47 | Link #2 |
Back From The Dead?
Join Date: Apr 2003
Location: Canada
Age: 34
|
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.
|
2006-01-13, 03:10 | Link #4 |
Senior Member
|
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. |
2006-01-14, 00:38 | Link #5 |
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); ?> 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 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 } } ?> |
2006-01-16, 00:06 | Link #8 |
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). |
|
|