SirPereira Posted April 3, 2010 Share Posted April 3, 2010 Hey guys, Imagine that I have some videos with some ID's. I have a page player (player.php), that will get the video's ID with GET value, and then retrieve it's settings from database. Now, I've some links in my main page, that links to something link "?view=xxxx" -> xxxx is the id number. Well, it will make that verification in index.php, as I want it to make. But how can I check if the action was view, then it sends the ID to the player page, so it can check what is its settings. Regards Quote Link to comment https://forums.phpfreaks.com/topic/197443-custom-action/ Share on other sites More sharing options...
monkeytooth Posted April 3, 2010 Share Posted April 3, 2010 if your trying to find out if "view" is set in the URL try if(empty($_GET['view'])){/*not there or left blank*/}else{/*found something yay! do my bidding*/} Though I cant emphasis enough assuming more so that your using a database for your id's, that you need to make sure the variable used in "view=" is a legitimate string, be it only alpha numeric, or just numbers, or whatever the case. as well as stripslashes from the string, check for quotes, and other various methods of exploitation to either hijack your site or mess with your database via injection. SCRUB your inputs!! Quote Link to comment https://forums.phpfreaks.com/topic/197443-custom-action/#findComment-1036303 Share on other sites More sharing options...
SirPereira Posted April 3, 2010 Author Share Posted April 3, 2010 if your trying to find out if "view" is set in the URL try if(empty($_GET['view'])){/*not there or left blank*/}else{/*found something yay! do my bidding*/} Though I cant emphasis enough assuming more so that your using a database for your id's, that you need to make sure the variable used in "view=" is a legitimate string, be it only alpha numeric, or just numbers, or whatever the case. as well as stripslashes from the string, check for quotes, and other various methods of exploitation to either hijack your site or mess with your database via injection. SCRUB your inputs!! I always forget to prevent the sql injection things. There isn't something that I can just include globally, so it will check for it? Another thing according to my first question, well, so imagine that I have a system like this. - Videos -- Add -- Modify -- Delete -- View -- Rating - Users -- Add -- Modify -- Delete - News -- Add -- Modify -- Delete And imagine I want a system for it with GET method. Like ?view=news; or ?view=user&id=23; or ?modify=video&id=3. I think you got it. How do you recommend me to do something like this? Regards and thanks for helping Quote Link to comment https://forums.phpfreaks.com/topic/197443-custom-action/#findComment-1036523 Share on other sites More sharing options...
ignace Posted April 3, 2010 Share Posted April 3, 2010 if (isset($_GET['view'])) {//they want to view stuff //.. } else if (isset($_GET['modify'])) {//they want to mod stuff //.. } //.. Quote Link to comment https://forums.phpfreaks.com/topic/197443-custom-action/#findComment-1036536 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.