A friends network MySQL/PHP help please
Posted: Thu Nov 10, 2005 11:37 am
So im working on a myspace type social network program for fun and have run into a roadblock. Basicly i want a link so users can add people to a friends list, and upon their approval be added.
Theres a table i have setup called friends in the main database, with 3 fields being, ID, uname, and friend_uname.
ID is auto inc primary, uname is pulled from the login cookie of the person whos logged in, and friend_uname is the person who you want to add to your friends list.
So currently i have http://www.open-blog.org/myopenspace/us ... er=uberamd setup as a test. I would like a link that (if logged in) will put database information in. So if the users logged in and clicks Add to Friends, it will pull your uname from the cookie and the person you want to add from the user=whatever in the address bar and fill in the database accordingly.
So how would i code a link and a file that upon a click would pull both the uname value from the cookie as well as the persons openspace your viewing from the user=username in the address and put it into a database.
Another thing i thought of is adding another field called confirm with values 0 = no and 1 = yes. If in the database confirm is set to 1 for the uname and friend_uname then it will display on the site. if its set to 0 it wont. But that would require a verification system which i also dont know how to impliment. Ive tried some ideas but they havent worked.
If you need to know the cookie looks like:
To recap:
Question 1: how would i make a link that ads the cookie data and address data (uname=usernamehere) and put it into a database?
Question 2: how would i add verification using the 0 and 1 system (0 being no 1 being yes) or another better system if you know of one for the users (that isnt critical at the moment im more focused on question 1).
Thanks in advance
-Steve
Theres a table i have setup called friends in the main database, with 3 fields being, ID, uname, and friend_uname.
ID is auto inc primary, uname is pulled from the login cookie of the person whos logged in, and friend_uname is the person who you want to add to your friends list.
So currently i have http://www.open-blog.org/myopenspace/us ... er=uberamd setup as a test. I would like a link that (if logged in) will put database information in. So if the users logged in and clicks Add to Friends, it will pull your uname from the cookie and the person you want to add from the user=whatever in the address bar and fill in the database accordingly.
So how would i code a link and a file that upon a click would pull both the uname value from the cookie as well as the persons openspace your viewing from the user=username in the address and put it into a database.
Another thing i thought of is adding another field called confirm with values 0 = no and 1 = yes. If in the database confirm is set to 1 for the uname and friend_uname then it will display on the site. if its set to 0 it wont. But that would require a verification system which i also dont know how to impliment. Ive tried some ideas but they havent worked.
If you need to know the cookie looks like:
Code: Select all
<?php
ob_start();
//include the header
require("top.php");
//check if the session Uname is in use
if($_SESSION['Uname'] == '' || $_SESSION['lp'] == '')
{
header("Location: login.php");
exit;
}
echo "<br><br>";
//get the users profile
$result = mysql_query("SELECT * FROM loginphp
WHERE Uname='{$_SESSION['Uname']}'") or die(mysql_error());
$row = mysql_fetch_array( $result );Question 1: how would i make a link that ads the cookie data and address data (uname=usernamehere) and put it into a database?
Question 2: how would i add verification using the 0 and 1 system (0 being no 1 being yes) or another better system if you know of one for the users (that isnt critical at the moment im more focused on question 1).
Thanks in advance
-Steve