RAPIDGRAB Posted May 13, 2009 Share Posted May 13, 2009 Hello, I'm new in PHP and i want to make a PHP navigator that help me to view URL from a text or PHP file saved on the server and i want to add variable to URLS to hide them in my page and call them from the text file ??? And i want these links to be displayed randomly every time when refreshing the page by user request "not auto refresh" and target them to an inline iframe in my page so that i want links to be hidden by variables like [ /index.php?link=2 , /index.php?link=3 and so on]. If this should done by MySQL data base, so please any one help me and post the code that explain how to connect to the data base as I'm very weak in PHP Thanks! Quote Link to comment Share on other sites More sharing options...
jackpf Posted May 13, 2009 Share Posted May 13, 2009 http://www.tizag.com/mysqlTutorial/mysqlconnection.php There you go. Quote Link to comment Share on other sites More sharing options...
RAPIDGRAB Posted May 13, 2009 Author Share Posted May 13, 2009 http://www.tizag.com/mysqlTutorial/mysqlconnection.php There you go. Thank you this was useful, I'm searching now in these tutorials. Also if any one could help me about navigation code and how to associate it with the iframe, it will be appreciated. Quote Link to comment Share on other sites More sharing options...
jackpf Posted May 13, 2009 Share Posted May 13, 2009 You can't really obfuscate the source of an iframe, as the browser needs to be able to read it. However, you could use cURL to open pages. So, for example: //in your iframe page <iframe src="curl.php?id=1"></iframe> //and then in curl.php $id = $_GET['id']; $sql = mysql_query("SELECT * FROM table WHERE ID='$id'"); $fetch = $mysql_fetch_array($sql); $link = $fetch['link']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $link); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($ch); curl_close($ch); echo $return; Something like that anyway. Quote Link to comment Share on other sites More sharing options...
RAPIDGRAB Posted May 13, 2009 Author Share Posted May 13, 2009 You can't really obfuscate the source of an iframe, as the browser needs to be able to read it. However, you could use cURL to open pages. So, for example: //in your iframe page <iframe src="curl.php?id=1"></iframe> //and then in curl.php $id = $_GET['id']; $sql = mysql_query("SELECT * FROM table WHERE ID='$id'"); $fetch = $mysql_fetch_array($sql); $link = $fetch['link']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $link); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $return = curl_exec($ch); curl_close($ch); echo $return; Something like that anyway. Thank you sir Please see this pic As you see at the top there is dynamic navigation bar that show random URL in the iframe "You are using server [ 1 ]" I believe this need MySQL connection to perform this function! The codes you post, could you explain more how many files i should create to execute them ??? Thanks. Quote Link to comment Share on other sites More sharing options...
jackpf Posted May 13, 2009 Share Posted May 13, 2009 Well, if you create a table with ID and link, and a page that calls them values from the database, that's all you need. Just point the iframe to that file. Quote Link to comment Share on other sites More sharing options...
RAPIDGRAB Posted May 14, 2009 Author Share Posted May 14, 2009 Well, if you create a table with ID and link, and a page that calls them values from the database, that's all you need. Just point the iframe to that file. Well I'm trying now and i succeeded to create and insert into tables But how i hide urls in my page and view them with variables like "index.php?link=1" then on click this url open in the iframe I hope you answer me if i have more questions Thanks. Quote Link to comment 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.