milknhoney Posted May 18, 2010 Share Posted May 18, 2010 Hi, I use a tool that allows me to "clone" websites using a bit of php. My problem is that when you click on a link, it opens in a new window. I would like it to open in the same window. Here is the generated code: <script type="text/javascript"> var $_GET = { };var q = window.location.href.split('?')[1]; var pairs = (q != null) ? q.split('&') : []; for(var i=0;i<pairs.length;i++) { var pair = pairs.split('='); if(pair[1] == null) { pair[1] = ''; } pair[1] = decodeURI(pair[1]); $_GET[pair[0]] = pair[1]; } var tid = $_GET['tid']; </script><?php $pgc=file_get_contents("http://www.somedomain.com"); $pgc=preg_replace ('/pub-[0-9]+/i','pub-XXXXXXXXXXXXXXXX',$pgc); $pgc=preg_replace('/UA-[0-9]+-[0-9]/i','UA-XXXXXXX-X',$pgc); $nhead="<head> <base href=\"http://www.somedomain.com\"> <base target=\"self\"> <script type=\"text/javascript\">var redir=false;</script> "; if (!preg_match('#<head>#i',$pgc)) { // no head tag found $pgc=preg_replace('#<html>#i',"<HTML>$nhead",$pgc); } else { $pgc=preg_replace('#<head>#i',$nhead,$pgc); } $pgc=preg_replace('#</body>#i','',$pgc); $pgc=preg_replace('#</html>#i','',$pgc); $pgc=preg_replace('#saveasale.net#i','pkemfier.dif',$pgc); $pgc=preg_replace('#upsellit.com#i','pkemfier.dif',$pgc); $pgc=preg_replace('#intellichat.com#i','pkemfier.dif',$pgc); $pgc=preg_replace('#PreventExitPop == false#i','PreventExitPop == "yourmama62"',$pgc); echo $pgc; ?> <script type="text/javascript"> var nvv='NVV3C7363726970743E617371496D67203D206E657720496D61676528293B69662028746964203D3D20756E646566696E656429207B2075726C3D22687474703A2F2F7777772E73686172656173616C652E636F6D2F722E63666D3F423D373834333026553D333134393132264D3D3132343431223B207D20656C7365207B2075726C3D22687474703A2F2F7777772E73686172656173616C652E636F6D2F722E63666D3F423D373834333026553D333134393132264D3D31323434312F3F7469643D222B7469643B207D20617371496D672E737263203D2075726C3B6966287265646972297B73657454696D656F757428276E6F77676F2829272C35303030293B7D3C2F7363726970743E';eval(unescape('%66%75%6E%63%74%69%6F%6E%20%75%6E%64%6F%45%6E%63%28%76%61%6C%29%7B%65%6E%64%3D%76%61%6C%2E%6C%65%6E%67%74%68%3B%76%61%6C%3D%76%61%6C%2E%73%75%62%73%74%72%28%33%2C%65%6E%64%29%3B%64%3D%76%61%6C%2E%6D%61%74%63%68%28%2F%5B%5C%77%5D%7B%32%7D%2F%67%69%29%3B%66%6F%72%28%69%3D%30%3B%69%3C%64%2E%6C%65%6E%67%74%68%3B%69%2B%2B%29%7B%64%5B%69%5D%3D%22%25%22%2B%64%5B%69%5D%3B%7D%64%3D%64%2E%6A%6F%69%6E%28%27%27%29%3B%72%65%74%75%72%6E%20%64%3B%7D%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%75%6E%65%73%63%61%70%65%28%75%6E%64%6F%45%6E%63%28%6E%76%76%29%29%29%3B'));</script></BODY></HTML> Thanks in advance for the help Link to comment https://forums.phpfreaks.com/topic/202148-open-link-in-same-window/ Share on other sites More sharing options...
JAY6390 Posted May 18, 2010 Share Posted May 18, 2010 Change all links so that their target is set to _parent Link to comment https://forums.phpfreaks.com/topic/202148-open-link-in-same-window/#findComment-1060052 Share on other sites More sharing options...
milknhoney Posted May 18, 2010 Author Share Posted May 18, 2010 Thanks for the answer Jay. One day I aspire to be considered a PHP newbie but I'm embarassed to say that I'm not quite to that level yet. Could you be more specific, maybe offer an example of how the link code should look. And should I only change these links in this portion of the code: <?php $pgc=file_get_contents("http://www.somedomain.com"); $pgc=preg_replace ('/pub-[0-9]+/i','pub-XXXXXXXXXXXXXXXX',$pgc); $pgc=preg_replace('/UA-[0-9]+-[0-9]/i','UA-XXXXXXX-X',$pgc); $nhead="<head> <base href=\"http://www.somedomain.com\"> <base target=\"self\"> <script type=\"text/javascript\">var redir=false;</script> "; if (!preg_match('#<head>#i',$pgc)) { // no head tag found $pgc=preg_replace('#<html>#i',"<HTML>$nhead",$pgc); } else { $pgc=preg_replace('#<head>#i',$nhead,$pgc); } $pgc=preg_replace('#</body>#i','',$pgc); $pgc=preg_replace('#</html>#i','',$pgc); $pgc=preg_replace('#saveasale.net#i','pkemfier.dif',$pgc); $pgc=preg_replace('#upsellit.com#i','pkemfier.dif',$pgc); $pgc=preg_replace('#intellichat.com#i','pkemfier.dif',$pgc); $pgc=preg_replace('#PreventExitPop == false#i','PreventExitPop == "yourmama62"',$pgc); echo $pgc; ?> I would really appreciate the help. Thanks again. Link to comment https://forums.phpfreaks.com/topic/202148-open-link-in-same-window/#findComment-1060077 Share on other sites More sharing options...
milknhoney Posted May 18, 2010 Author Share Posted May 18, 2010 Figured it out, Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/202148-open-link-in-same-window/#findComment-1060106 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.