1. Buat beberapa objek yang teranimasi dalam Viewport Anda. Gambar dibawah adalah posisi objek-objek teranimasi pada frame 0. Gambar 01. Objek-Objek Teranimasi pada Frame 0
2. Gambar dibawah, adalah posisi objek-objek teranimasi pada frame 100. Gambar 02. Objek-objek Teranimasi pada Frame 100 3. Sekarang Anda kembalikan Time Slider ke posisi 0. Gambar 03. Posisi Frame 0 4. Anda pilih keseluruhan objek-objek yang teranimasi
5. Klik menu Animation > Delete Selected Animation.
Tutorial ini diarsipkan di ilmugrafis pada kategori 3DS Max. Selamat mencoba Menghapus Object - Object yang Teranimasi, pelajari juga tutorial sebelumnya yaitu Pencahayaan Global Illuminationdan tutorial selanjutnya kita akan belajar yaitu Membuat Background di 3dsMAX Semoga bermanfaat.
Sebagai langkah pertama, kita akan membuat database dengan namadatabase yang berisikan tabel user,categories, topics, dan posts.
Tabel user :
CREATE TABLE users ( user_id INT(8) NOT NULL AUTO_INCREMENT, user_name VARCHAR(30) NOT NULL, user_pass VARCHAR(255) NOT NULL, user_email VARCHAR(255) NOT NULL, user_date DATETIME NOT NULL, user_level INT(8) NOT NULL, UNIQUE INDEX user_name_unique (user_name), PRIMARY KEY (user_id) ) TYPE=INNODB;
Tabel categories :
CREATE TABLE categories ( cat_id INT(8) NOT NULL AUTO_INCREMENT, cat_name VARCHAR(255) NOT NULL, cat_description VARCHAR(255) NOT NULL, UNIQUE INDEX cat_name_unique (cat_name), PRIMARY KEY (cat_id) ) TYPE=INNODB;
Tabel topics :
CREATE TABLE topics ( topic_id INT(8) NOT NULL AUTO_INCREMENT, topic_subject VARCHAR(255) NOT NULL, topic_date DATETIME NOT NULL, topic_cat INT(8) NOT NULL, topic_by INT(8) NOT NULL, PRIMARY KEY (topic_id) ) TYPE=INNODB;
Tabel posts :
CREATE TABLE posts ( post_id INT(8) NOT NULL AUTO_INCREMENT, post_content TEXT NOT NULL, post_date DATETIME NOT NULL, post_topic INT(8) NOT NULL, post_by INT(8) NOT NULL, PRIMARY KEY (post_id) ) TYPE=INNODB;
Selanjutnya kita akan menghubungkan tabel-tabel tersebut. Hubungkan topics ke categories : ALTER TABLE topics ADD FOREIGN KEY(topic_cat) REFERENCES categories(cat_id) ON DELETE CASCADE ON UPDATE CASCADE
hubungkan topics ke user :
ALTER TABLE topics ADD FOREIGN KEY(topic_by) REFERENCES users(user_id) ON DELETE RESTRICT ON UPDATE CASCADE;
selanjutnya hubungkan post ke topics :
ALTER TABLE posts ADD FOREIGN KEY(post_topic) REFERENCES topics(topic_id) ON DELETE CASCADE ON UPDATE CASCADE;
dan yang terakhir adalah menghubungkan posts ke user :
ALTER TABLE posts ADD FOREIGN KEY(post_by) REFERENCES users(user_id) ON DELETE RESTRICT ON UPDATE CASCADE;
Langkah 2 : Pengenalan Header/Footer System
Pada langkah kedua ini, kita akan membuat header dan body untuk halaman forum kita nanti.
echo 'Topic subject at 10-10'; echo '
';echo '';include 'footer.php';?>
Langkah 5: Mendaftarkan Pengguna
Mari kita mulaidengan membuatbentukHTML sederhanasehinggapengguna barudapatmendaftar. Lihat halamansignup.phpdi bawah.
//signup.php include 'connect.php'; include 'header.php'; echo '
Sign up
'; if($_SERVER['REQUEST_METHOD'] != 'POST'){ /*the form hasn't been posted yet, display it note that the action="" will cause the form to post to the same page it is on */ echo ' Username: Password: Password again: E-mail:
';} else{ /* so, the form has been posted, we'll process the data in three steps: 1. Check the data 2. Let the user refill the wrong fields (if necessary) 3. Save the data */ $errors = array(); /* declare the array for later use */ if(isset($_POST['user_name'])) { //the user name exists if(!ctype_alnum($_POST['user_name'])) { $errors[] = 'The username can only contain letters and digits.'; } if(strlen($_POST['user_name']) > 30) { $errors[] = 'The username cannot be longer than 30 characters.'; } } else { $errors[] = 'The username field must not be empty.'; } if(isset($_POST['user_pass'])) { if($_POST['user_pass'] != $_POST['user_pass_check']) { $errors[] = 'The two passwords did not match.'; } } else { $errors[] = 'The password field cannot be empty.'; } if(!empty($errors)) /*check for an empty array, if there are errors, they're in this array (note the ! operator)*/ { echo 'Uh-oh.. a couple of fields are not filled in correctly..'; echo '
';
foreach($errors as $key => $value) /* walk through the array so all the errors get displayed */ { echo '
' . $value . '
'; /* this generates a nice error list */ } echo '
'; } else { //the form has been posted without, so save it //notice the use of mysql_real_escape_string, keep everything safe! //also notice the sha1 function which hashes the password $sql = "INSERT INTO users(user_name, user_pass, user_email ,user_date, user_level) VALUES('" . mysql_real_escape_string($_POST['user_name']) . "', '" . sha1($_POST['user_pass']) . "', '" . mysql_real_escape_string($_POST['user_email']) . "',NOW(),0)"; $result = mysql_query($sql); if(!$result) { //something went wrong, display the error echo 'Something went wrong while registering. Please try again later.'; //echo mysql_error(); //debugging purposes, uncomment when needed } else { echo 'Successfully registered. You can now sign in and start posting! :-)'; } } } include 'footer.php'; ?>
Langkah 6: MenambahkanOtentikasi dan TingkatPengguna
Filesignin.php ada di bawah ini :
//signin.php include 'connect.php'; include 'header.php'; echo '
Sign in
'; //first, check if the user is already signed in. If that is the case, there is no need to display this page if(isset($_SESSION['signed_in']) && $_SESSION['signed_in'] == true) { echo 'You are already signed in, you can sign out if you want.'; } else { if($_SERVER['REQUEST_METHOD'] != 'POST') { /*the form hasn't been posted yet, display it note that the action="" will cause the form to post to the same page it is on */ echo '
'; } else { /* so, the form has been posted, we'll process the data in three steps: 1. Check the data 2. Let the user refill the wrong fields (if necessary) 3. Varify if the data is correct and return the correct response */ $errors = array(); /* declare the array for later use */ if(!isset($_POST['user_name'])) { $errors[] = 'The username field must not be empty.'; } if(!isset($_POST['user_pass'])) { $errors[] = 'The password field must not be empty.'; } if(!empty($errors)) /*check for an empty array, if there are errors, they're in this array (note the ! operator)*/ { echo 'Uh-oh.. a couple of fields are not filled in correctly..'; echo '
'; foreach($errors as $key => $value) /* walk through the array so all the errors get displayed */ { echo '
' . $value . '
'; /* this generates a nice error list */ } echo '
'; } else { //the form has been posted without errors, so save it //notice the use of mysql_real_escape_string, keep everything safe! //also notice the sha1 function which hashes the password $sql = "SELECT user_id, user_name, user_level FROM users WHERE user_name = '" . mysql_real_escape_string($_POST['user_name']) . "' AND user_pass = '" . sha1($_POST['user_pass']) . "'"; $result = mysql_query($sql); if(!$result) { //something went wrong, display the error echo 'Something went wrong while signing in. Please try again later.'; //echo mysql_error(); //debugging purposes, uncomment when needed } else { //the query was successfully executed, there are 2 possibilities //1. the query returned data, the user can be signed in //2. the query returned an empty result set, the credentials were wrong if(mysql_num_rows($result) == 0) { echo 'You have supplied a wrong user/password combination. Please try again.'; } else { //set the $_SESSION['signed_in'] variable to TRUE $_SESSION['signed_in'] = true; //we also put the user_id and user_name values in the $_SESSION, so we can use it at various pages while($row = mysql_fetch_assoc($result)) { $_SESSION['user_id'] = $row['user_id']; $_SESSION['user_name'] = $row['user_name']; $_SESSION['user_level'] = $row['user_level']; } echo 'Welcome, ' . $_SESSION['user_name'] . '. Proceed to the forum overview.'; } } } } } include 'footer.php'; ?>
//set the $_SESSION['signed_in'] variable to TRUE $_SESSION['signed_in'] = true; //we also put the user_id and user_name values in the $_SESSION, so we can use it at various pages while($row = mysql_fetch_assoc($result)) { $_SESSION['user_id'] = $row['user_id']; $_SESSION['user_name'] = $row['user_name']; } ?>
Langkah 7 : Membuat Kategori
Untuk membuat halaman kategori, buatlah form terlebih dahulu.
//create_cat.php include 'connect.php'; if($_SERVER['REQUEST_METHOD'] != 'POST') { //the form hasn't been posted yet, display it echo '
'; } else { //the form has been posted, so save it $sql = ìINSERT INTO categories(cat_name, cat_description) VALUES('' . mysql_real_escape_string($_POST['cat_name']) . ì', '' . mysql_real_escape_string($_POST['cat_description']) . ì')'; $result = mysql_query($sql); if(!$result) { //something went wrong, display the error echo 'Error' . mysql_error(); } else { echo 'New category successfully added.'; } } ?>
Langkah8: MenambahkanKategorike index.php
Kamitelah membuatbeberapa kategori, jadi sekarangkami dapatmenampilkannyadi halaman depan.
index.php : //create_cat.php include 'connect.php'; include 'header.php'; $sql = "SELECT cat_id, cat_name, cat_description, FROM categories"; $result = mysql_query($sql); if(!$result) { echo 'The categories could not be displayed, please try again later.'; } else { if(mysql_num_rows($result) == 0) { echo 'No categories defined yet.'; } else { //prepare the table echo '
//create_cat.php include 'connect.php'; include 'header.php'; echo '
Create a topic
'; if($_SESSION['signed_in'] == false) { //the user is not signed in echo 'Sorry, you have to be signed in to create a topic.'; } else { //the user is signed in if($_SERVER['REQUEST_METHOD'] != 'POST') { //the form hasn't been posted yet, display it //retrieve the categories from the database for use in the dropdown $sql = "SELECT cat_id, cat_name, cat_description FROM categories"; $result = mysql_query($sql); if(!$result) { //the query failed, uh-oh :-( echo 'Error while selecting from database. Please try again later.'; } else { if(mysql_num_rows($result) == 0) { //there are no categories, so a topic can't be posted if($_SESSION['user_level'] == 1) { echo 'You have not created categories yet.'; } else { echo 'Before you can post a topic, you must wait for an admin to create some categories.'; } } else { echo '
'; } } } else { //start the transaction $query = "BEGIN WORK;"; $result = mysql_query($query); if(!$result) { //Damn! the query failed, quit echo 'An error occured while creating your topic. Please try again later.'; } else { //the form has been posted, so save it //insert the topic into the topics table first, then we'll save the post into the posts table $sql = "INSERT INTO topics(topic_subject, topic_date, topic_cat, topic_by) VALUES('" . mysql_real_escape_string($_POST['topic_subject']) . "', NOW(), " . mysql_real_escape_string($_POST['topic_cat']) . ", " . $_SESSION['user_id'] . " )"; $result = mysql_query($sql); if(!$result) { //something went wrong, display the error echo 'An error occured while inserting your data. Please try again later.' . mysql_error(); $sql = "ROLLBACK;"; $result = mysql_query($sql); } else { //the first query worked, now start the second, posts query //retrieve the id of the freshly created topic for usage in the posts query $topicid = mysql_insert_id(); $sql = "INSERT INTO posts(post_content, post_date, post_topic, post_by) VALUES ('" . mysql_real_escape_string($_POST['post_content']) . "', NOW(), " . $topicid . ", " . $_SESSION['user_id'] . " )"; $result = mysql_query($sql); if(!$result) { //something went wrong, display the error echo 'An error occured while inserting your post. Please try again later.' . mysql_error(); $sql = "ROLLBACK;"; $result = mysql_query($sql); } else { $sql = "COMMIT;"; $result = mysql_query($sql); //after a lot of work, the query succeeded! echo 'You have successfully created your new topic.'; } } } } } include 'footer.php'; ?>
Langkah 10: Menampilkan Kategori
Kita akanmembuathalamanikhtisaruntuksatu kategori. Kamibaru saja membuatkategori, itu akan bergunauntuk dapatmelihat semuatopikdi dalamnya. Pertama, membuat halamanyang disebutcategory.php.
//create_cat.php include 'connect.php'; include 'header.php'; //first select the category based on $_GET['cat_id'] $sql = "SELECT cat_id, cat_name, cat_description FROM categories WHERE cat_id = " . mysql_real_escape_string($_GET['id']); $result = mysql_query($sql); if(!$result) { echo 'The category could not be displayed, please try again later.' . mysql_error(); } else { if(mysql_num_rows($result) == 0) { echo 'This category does not exist.'; } else { //display category data while($row = mysql_fetch_assoc($result)) { echo '
Topics in ′' . $row['cat_name'] . '′ category
'; } //do a query for the topics $sql = "SELECT topic_id, topic_subject, topic_date, topic_cat FROM topics WHERE topic_cat = " . mysql_real_escape_string($_GET['id']); $result = mysql_query($sql); if(!$result) { echo 'The topics could not be displayed, please try again later.'; } else { if(mysql_num_rows($result) == 0) { echo 'There are no topics in this category yet.'; } else { //prepare the table echo '
Pada tahap ini, kita tinggal menggantikan query pada bagian PHP dalam halaman category.php. Query yang pertama untukmengambil informasidasar tentangtopik: SELECT topic_id, topic_subject FROM topics WHERE topics.topic_id = " . mysql_real_escape_string($_GET['id']) Selanjutnya, kitamengambilsemuapostingdalam topik inidari database. Query berikutmemberi kitaapa yang kita butuhkan:
SELECT posts.post_topic, posts.post_content, posts.post_date, posts.post_by, users.user_id, users.user_name FROM posts LEFT JOIN users ON posts.post_by = users.user_id WHERE posts.post_topic = " . mysql_real_escape_string($_GET['id'])
Langkah 12: Menambahkan Reply
Mari kitamembuat bagianterakhir yang hilangdariforum ini, kemungkinanuntuk menambahkanbalasan. Kitaakan mulaidengan membuatform.
Kode lengkap reply.phpterlihat seperti ini :
//create_cat.php include 'connect.php'; include 'header.php'; if($_SERVER['REQUEST_METHOD'] != 'POST') { //someone is calling the file directly, which we don't want echo 'This file cannot be called directly.'; } else { //check for sign in status if(!$_SESSION['signed_in']) { echo 'You must be signed in to post a reply.'; } else { //a real user posted a real reply $sql = "INSERT INTO posts(post_content, post_date, post_topic, post_by) VALUES ('" . $_POST['reply-content'] . "', NOW(), " . mysql_real_escape_string($_GET['id']) . ", " . $_SESSION['user_id'] . ")"; $result = mysql_query($sql); if(!$result) { echo 'Your reply has not been saved, please try again later.'; } else { echo 'Your reply has been saved, check out the topic.'; } } } include 'footer.php'; ?> REFERENSI