Click to See Complete Forum and Search --> : Comics related website using php/mysql
x3n1x
December 21st, 2007, 12:03 AM
Hey everyone,
Well, our college wants us students to make one "mini-project", a site with a database plus something in e-commerce.
Now, I've chosen the topic as "comics".
Can you guys help me create one ? Nothing too complex.
Here's what I have on mind.
The site will have 3 sections.
1. Comic profiles
2. News / Articles
3. Store / Shopping cart
Now, there will be user logins and the site will be accessible to only registered users.
1. Comic profiles.
Lets say we have 10 comic superheroes. Each character will have a page listing his name / alias / powers / enemies / photo etc.
Something like /charprofile.php?=phantom
An admin can add new characters, or edit existing ones. A separate admin section need not exist.
2. News / Articles.
A simple articles publishing system, where registered users can submit their content, which goes into review. When an admin approves it, it is published and others can leave comments.
3. Store / Cart
Say, 10 products listed. Select them, enter address and proceed to checkout.
That's it. I hope its not too complex.
Now, all these 3 are in the Wrox book ( Beginning PHP5, Apache.... ) that I have, but not in the manner that I want.
So, is anyone reading this and is willing to help ?
Thanks.
PeejAvery
December 21st, 2007, 09:23 AM
Seeing that this is a homework assignment, we will help point you in the right direction, but we cannot do it for you.
What do you have so far? Then you can work from there.
x3n1x
December 21st, 2007, 09:30 AM
Well, agreed that it is an homework assignment. But a homework assignment is justified is that is the subject that you are learning :) The students ( 65 students ) do not even know html yet, forget learning php.
The professor who teaches us just wants us to create an e-commerce website with relational databases as backend and html as front-end. He himself doesn't have any idea how this can be implemented.
Anyhow.........
I've so far created a user registration / login system, ofcourse by taking help from a script I found and customizing it.
I even was successful is create a trial page which is only accessible to logged in users. If not, the page says "No authorization" to view.
What next ?
To be frank, I'm really not made for coding. But you _gotta_ use some part of your brains when the project is due in 20 days :-s
PeejAvery
December 21st, 2007, 10:09 AM
He himself doesn't have any idea how this can be implemented.
Then he has no right to teach the class! A professor must know what he is teaching!
Have you learned to interface well with a database? I highly suggest learning MySQL (http://www.php.net/manual/en/ref.mysql.php). I would suggest reading up on the PHP documentation (http://www.php.net/manual/en/index.php). It will take some time to browse through it. But after you will be much more ready to get going.
x3n1x
December 21st, 2007, 11:31 AM
Actually, he _does_ know what he is teaching. He teaches "e-commerce", a theoretical subject. Just for the sake of giving a project to the students, he has given us the project.
Well, yes. I know how php interacts with database and all. The user registration / login is kinda done. The script interacts with the table "userdata" and works fine.
I'm not sure how to implement the comic superhero profiles.
PeejAvery
December 21st, 2007, 11:47 AM
I'm not sure how to implement the comic superhero profiles.
That is why you want to get to know your database well. Here is a well commented code example that should get you started.
<?php
// make sure that the URL line has a hero in it
// example: charprofile.php?hero=phantom
if(isset($_GET['hero'])){
// get the comic hero from the URL line
$hero = $_GET['hero'];
// now let's take a look at this hero's database information
$query = "SELECT * FROM heros WHERE name = '$hero'";
$sql = mysql_query($query);
// now that the querying is done, we grab the information
$info = mysql_fetch_assoc($sql);
// the variables must coincide with your column names
$name = $info['name'];
$alias = $info['alias'];
$powers = $info['powers'];
$enemies = $info['enemies'];
$photo = $info['photo'];
// after all the information is extracted we need to free up MySQL
// this helps with resources and performance
mysql_free_results($sql);
// now you can output the data however you like
// let's break into HTML with interjecting the PHP
?>
<table>
<tr>
<td>Name:</td>
<td><?php echo $name; ?></td>
</tr>
<tr>
<td>Alias:</td>
<td><?php echo $alias; ?></td>
</tr>
<tr>
<td>Powers:</td>
<td><?php echo $powers; ?></td>
</tr>
<tr>
<td>Enemies:</td>
<td><?php echo $enemies; ?></td>
</tr>
<tr>
<td>Photo:</td>
<td><img src="<?php echo $photo; ?>" alt="" /></td>
</tr>
</table>
<?php
}
else{
echo 'Error: No hero chosen.';
}
?>
x3n1x
December 21st, 2007, 12:38 PM
Hi,
Thanks a lot for that code. Really helped me to try something on my own and I succeded too.
I created the table heros via phpmyadmin, added some default data ( 2 rows ) and tried accessing them. :)
But, I get an error with the mysql_free_results() part. So had to comment them.
Also, I'm now going to create a page that'll help me add superheroes, instead of doing it via phpMyAdmin. But I need to make this "for me only".
So I have this thought. I user either the "name=admin" or userid=1 from the userdata table. The page will check if a user is logged in, if yes, what's his id or uname anf will only allow him to access the page.
Does this sound okay ?
PeejAvery
December 21st, 2007, 01:01 PM
To work with login information, you are going to have to step into a more intermediate level. You will need to work with sessions (http://www.php.net/manual/en/ref.session.php). Also, you don't want to pass that sort of information through the URL using $_GET to retrieve it. Anyone can access it then. You need to use forms to post (http://www.tizag.com/phpT/forms.php) the information and then retrieve it using $_POST.
x3n1x
December 21st, 2007, 01:11 PM
Hi,
Security, for this project, is not really important since a) it would be running on a local server and b) the professor doesn't knw anything about it.
I'm using a modified version of this (http://users.tpg.com.au/adslgkcj/uzzisoft/projects/PHP_Simple_Member_System.htm) member management script for now.
PeejAvery
December 21st, 2007, 02:47 PM
That system is fine for beginning. One thing I do not advise about it is its use of cookies instead of sessions. That is a major security breach.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.