I want to make a php page for embedding videos so i just change video ID in URL to change the video.

Discussion in 'PHP' started by Kaisar Abbas, Dec 5, 2013.

  1. #1
    Hello every one!! I'm new here.. I want to make a php page for embedding video iframes, so when i change video id in URL it should changes (redirects) the video below in iframe.. here is the example page.. http://dramasvid.com/vid/tune.php?v=894442 in this url when i change v= value it also changes the video. Please help me how can i make this... any help will be appreciated !! :) Thanks in advance
     
    Kaisar Abbas, Dec 5, 2013 IP
  2. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #2
    Some of these questions are really weird because the answers should be so utterly obvious... It makes me wonder if given the answer will you even know how to take the next step.....

    The value of "v" in the query string would be an ID. This ID number you would use to fetch the video information from your database (URL of video or embed code, title, category, description, length etc.). Then you would simply output HTML with the data you fetched from the database. That is how they do it. That is how you do it.

    If your next question is "how?" my next answer is read a basic php tutorial.
     
    NetStar, Dec 5, 2013 IP
  3. karthikmllore

    karthikmllore Active Member

    Messages:
    132
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    53
    #3
    there are many possible ways to achieve that...
    1 : If the video URL is based on that number then you don't need to have any database...
    I just observed that the embeded video URL is :
    /player/embed_player.php?vid=894442&width=728&height=400&autoplay=no
    Now, here it is based on that number which you send as a GET parameter... So you can make your PHP script to output :
    /player/embed_player.php?vid=$_GET['v']&width=728&height=400&autoplay=no

    So whatever value you send as v=xxxxxx, that value will be substituted as the value of vid of the embeded player...

    2 : If the video URL is not based on the number you are passing then, as NetStar said, you need to store info in a database and using the number you send, you need to get the video url from the database...
     
    karthikmllore, Dec 7, 2013 IP
  4. xtmx

    xtmx Active Member

    Messages:
    359
    Likes Received:
    12
    Best Answers:
    4
    Trophy Points:
    88
    #4
    karth, please stop giving bad advice. Your method may allow for SQL Injection, and either way is not how PHP is properly coded.

    /player/embed_player.php?vid=';%20DROP%20DATABASE%20DATABASE();--&width=728&height=400&autoplay=no
     
    xtmx, Dec 7, 2013 IP
  5. NetStar

    NetStar Notable Member

    Messages:
    2,471
    Likes Received:
    541
    Best Answers:
    21
    Trophy Points:
    245
    #5
    Karth didn't provide any code that interacts with a database for SQL Injection to be a concern. Your example is not harmful in any way.
     
    NetStar, Dec 7, 2013 IP