Jump to content

Recommended Posts

Im trying to do some work but I've became stuck on how to go about it. I think I have done part a which is:

Allow a new user to sign up to the site. A new user should provide their name, birthday, interests, and a username and password. Note that for data protection reasons, do not use your real birthday when testing! This should add a record to the users table, which has been set up on the Edward server and which has the following structure:

ID – an auto-incrementing numerical ID which references each user. It is the primary key of the table, and automatically increases by 1 for each user. So the first user will have ID 1, the second user, ID 2, and so on.

username VARCHAR(255) – the user’ username

password VARCHAR(255) – the user’s password

interests VARCHAR(255) – the user’s interests

birthday VARCHAR(255) - the user’s birthday in a format like “June 6 1970”

If Im right with what I think I need to do I have created an index page, sign-up page(html and a php script) and a login page (html and a php script).

Then Ive got to do part b but dont have a clue how to go about doing it which is the following:

Write a profile page. This should display the name, interests, birthday and friends of the currently logged in user. Ideally profiles should only be visible to friends of this user, but this is not necessary for a basic pass.

You will need to use the friends table to work out who are the friends of the currently logged-in user. This is also set up on Edward and has the following structure:

 

ID – an auto-incrementing numerical ID which references each record. It is the primary key of the table, and automatically increases by 1 for each record. So the first record will have ID 1, the second record, ID 2, and so on.

me – the current user

friend – friends of the current user

 

This is probably best illustrated by example. Imagine the user with username John has three friends: Amar, Jeremy, and Scott. Scott, meanwhile, has as friends Amar, Jeremy and Jamie. In other words, John has made Scott his friend, but Scott has not yet made John his friend, and therefore Scott can view John’s profile but John cannot yet view Scott’s profile (because Scott has not agreed to John becoming his friend yet). The table would look like the following:

 

IDmefriend

1JohnAmar

2JohnJeremy

3JohnScott

4ScottAmar

5ScottJeremy

6ScottJamie

 

Anyone able to help me please as need to do it tonight and have 2 other parts to do.

 

 

Link to comment
https://forums.phpfreaks.com/topic/147025-confussed-about-what-to-do/
Share on other sites

you could create a freinds feild in the user table and store a comma seperated list of unique userID's of all accepted freinds

 

or make a freinds table with 2 columns selfID and freindID and just write each entry to that index KEY order by selfID which means you can have multiple repeating entries, just check that the first combo doesnt already exist before writing a new one

 

table sql create

CREATE TABLE freinds (
selfID int(20) NOT NULL,
freindID int(10) NOT NULL,
KEY selfID (selfID))

 

 

 

You need a user_to_friends table

 

Lets change your users table so the pk is user_id

 

user_to_friends

===========

id INT AUTO INC

user_id INT

friend_id INT

 

1 1 2

2 1 3

3 2 1

4 3 1

5 3 2

 

So

user_id 1 is friends with user_id 2 and user_id 3

user_id 2 is friends with user_id 1

user_id 3 is friends with user_id 1 and user_id 2

 

Also in your users table the fields username and password should not be varchar 255. When have you ever used 255 characters for either. I would say that 10 characters is big enough.

to be honest i dont understand any of this. Its due in 2moz and i need to pass it. What i pasted was the work we was given so i didnt decided on the varchar. To be honest I wish someone would do my work just so that I could pass. I have even offered to pay people to do it but no1 seems to have the time or know what to do. I need help  :'(

to be honest i dont understand any of this. Its due in 2moz and i need to pass it. What i pasted was the work we was given so i didnt decided on the varchar. To be honest I wish someone would do my work just so that I could pass. I have even offered to pay people to do it but no1 seems to have the time or know what to do. I need help  :'(

 

lol I have the time and know exactly what to do. But I do not believe in doing one's homework. Read the book, talk to your teacher get a study group with other students. Being proactive in class is your only hope, sad enough.

You should have paid attention or asked for help if you don't understand. This is simple stuff and if you don't get it then paying somebody to do it won't help as you wont understand what you are handing in.

 

When you say you think that you have done part A which is user signup. Have you got a form which users enter their details and it is recorded into the user database table?

 

If so do you have a login system that checks the input against the username and password field in the user table?

 

I can point you to tutorials but nobody here will do any work for you!

I wasnt really asking someone on here to do it for me. i was just simply asking for them to explain how to go about doing part b which is the profile bit as i dont understand. Am I right in thinking that when a user sign-up the information goes into a table. Then i have to create a html page im guess. Then with the php script is it simply getting the information from the table and displaying it?

Create a page profile.php where it accesses a get parameter (user). So someone can call the page profile.php?user=bob  and it will show bob's profile. On the page you do a check make sure it is valid data, query the database for the username bob. If he is found display is information, if not then show a "user not found" message.

 

Yes, during signup process you would put his information in the database so you can access it later. The profile script is simply reading from the table in the db, and should not really be doing anything else.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.