Page 1 of 1

php dynamic link help

Posted: Mon Mar 24, 2008 12:18 am
by edanlee
hello all and thank you for your help with the community,

i'm kinda stuck and need some help.. let me begin by telling you what i want to do and then i'll ask you how i should approach the task...

i'm creating a website that will have video tutorials on 3d design... none of these videos will be user submitted all of them will be submitted by me.
i have all of the site coded except for the video section... what i want to do is have a rank table.. like say 0=guest, 1=registered, 2= gold member.
i want a page that will display all of the videos but only those that match the current users rank will be clickable. please look at this site to explain what i'm talking about.
http://movielibrary.lynda.com/html/modPage.asp?ID=560, if you look at that page you will see that some videos you can view and some you cannot untill you login.
all the videos will be stored in mysql with prolly about 3-4 fields: vid_id, title, src, catagory. when the link is clicked it will call the video by id and play it in a pop-up. but some videos can only be seen by gold members. i already have a pretty good login script being used. the current login script uses sessions and mysql.

how should i go about creating this video section... i dont neccesarilly need code but more a run down of what should take place. but code would also be nice... i cant afford much but i would be willing to pay some money if i needed to... i thank you for your time reading this and your time of solving my problem...

thank you,
Edanlee

Re: php dynamic link help

Posted: Thu Mar 27, 2008 6:49 pm
by edanlee
can anyone please help me with this.. atleast explain how to do the whole .php?vid=12

Re: php dynamic link help

Posted: Fri Mar 28, 2008 12:25 pm
by aceconcepts
What is your objective?

It sounds like you want to know how to list user-specific links and then you talk about url variables.

Explaid in brief what you're trying to do.

Re: php dynamic link help

Posted: Fri Mar 28, 2008 12:28 pm
by John Cartwright
Simply put, .php?vid=12

Code: Select all

$vid = $_GET['vid']; //12

Re: php dynamic link help

Posted: Sat Mar 29, 2008 12:23 pm
by edanlee
i dont much understand what your telling me to do... but what i want to do is have a pop up that will play a movie based on what link they click... so the pop up will always have the same url but the variable will be defined by the link... like popup.php?vid=12, popup.php?vid=13, and so forth all based on what link they clicked...

Re: php dynamic link help

Posted: Sat Mar 29, 2008 6:03 pm
by John Cartwright
when listing the results, simlpy append the movie id to the url

Code: Select all

while ($row = mysql_fetch_assoc(... )) {
   echo '<a href="movie.php?id='. $row['id'].'">'. $row['title'].'</a> <br >';
}
Then on your movie page, you provide the $_GET['id'] from the link into your query

Code: Select all

$id = isset($_GET['id']) ? intval($_GET['id']) : 0; //basic sanitation
$sql = 'SELECT * FROM movies WHERE id = '. intval($id);
 
$result = mysql_query($sql) or die(mysql_error());
// etc
Clearer?

Re: php dynamic link help

Posted: Sat Mar 29, 2008 11:00 pm
by edanlee
that is exactly what i was looking for... thank you so much

Re: php dynamic link help

Posted: Sun Mar 30, 2008 7:14 pm
by AMCH
I see you have what you need now but I was a little confused by your link here, this is an asp page but you are trying to use php on it? :|

AMCH

PS: Upon re-examination of the article I have realised that this is not your page but an example of the functionality you require using php instead of asp. It's late! :?

:lol:

Re: php dynamic link help

Posted: Mon Mar 31, 2008 7:56 am
by edanlee
yes thats the gameplan is to have something similar to that website. if i can tackle it. but thank you for your help.

Edanlee

Re: php dynamic link help

Posted: Mon Mar 31, 2008 8:20 am
by kryles
this is to show the movie, but where was the rank part taken care of? Wouldn't you use a query to check if the user has access to that video?

Re: php dynamic link help

Posted: Mon Mar 31, 2008 8:00 pm
by edanlee
kryles wrote:this is to show the movie, but where was the rank part taken care of? Wouldn't you use a query to check if the user has access to that video?
well i just assumed i would have to come up with that part on my own... i already have a login system that uses sessions... i guess i would have to register the rank from the users database entry and using a if statement check to see if the users rank matches the rank required for the movie and if not then display a error.

edanlee