Jump to content

2260419

Members
  • Posts

    6
  • Joined

  • Last visited

2260419's Achievements

Newbie

Newbie (1/5)

1

Reputation

  1. That is not a valid Header redirect. Perhaps you need to tell us what "mystring1" actually is, and why you are urlencode'ing it. It is true that $mylink (probably) needs to be urlencode'd, but the url you are redirecting to needs to be clean. $url = 'http://mydomain.com/redirect.php?url=' . urlencode($mylink); Yeah, I know, but without knowing the "mystring1" and "mystring2", I leave the code as he put it. xD
  2. I did a test with this code and this is the result $mylink = 'http://forums.phpfreaks.com/test'; $final_link = $mylink; if(strpos($mylink,"test")>0) { $tmp = "mystring1".$mylink."mystring2"; $final_link = urlencode($tmp); $loc = "Location: ". $final_link; echo $loc; //or echo 'Location: '.$final_link; //header('Location: '.$final_link); //exit(); //if the link contains "test", then it returns: //Location: mystring1http%3A%2F%2Fforums.phpfreaks.com%2Ftestmystring2 }else{ //otherwise it returns: //Location: http://forums.phpfreaks.com/ echo 'Location: '.$final_link; //header('Location: '.$final_link); } you can try the code on this site: http://writecodeonline.com/php/
  3. you can put the javascript file anywhere, just make sure to change the link in the code of the footer.php of your template. http://example.dev/link_to_this_javascript.js
  4. you can try using the classic script to anonymize links. I have copied one, just change "http: //example.dev/" with your url. and the variable "url" if you want. eg "http:// yourdomain.com/redirect.php?url =" javascript.zip then put this code in your file "footer.php" of your template. <!--script at the end of the body--> <script src="http://example.dev/link_to_this_javascript.js" type="text/javascript"></script> <script type="text/javascript"> //name of the sites that you want to exclude. only the name. protected_links = "myspace,ebay"; redirect_refer(); </script> <!--script at the end of the body--> and finally, create a file called "redirect.php" in your root directory with the code: //get the link $str = $_GET['url']; if ($str == '') { //if the variable URL link is empty. eg ".../redirect.php?url=" or ".../redirect.php" then redirects to home. header('Location: http://example.dev/'); } else { //otherwise redirects the external site. header('Location: '.$str); } after this, all you will see links like this: http://example.dev/redirect.php?url=http://forums.phpfreaks.com/topic/280170-redirect-all-external-links-thru-my-website/
  5. Thanks Kicken, but the truth, I try to understand the code, but I ended losing me more. I try if watching the array could accommodate it, but could not. it was easier with this option. I could do it the first time. thanks guys. you are amazing.
  6. I have some videos I upload to server for online viewing. Sometimes they are too long and I have to cut them into pieces. I am a beginner in this and I'm a little lost. the idea is this: I have these table in MySQL: and this is my php code I have so far: $sql="SELECT * FROM table_name WHERE type = 'tutorials' and type2='word' and video_id='01' ORDER BY server ASC,format ASC,resolution ASC"; $result = mysql_query($sql); <table> while($row = mysql_fetch_array($result)) { echo "<tr>"; switch ($row['server']) { case "youtube": echo '<td><a href="'; echo $row['short_link'].'"><image youtube/></a></td>'; break; case "vimeo": echo '<td><a href="'; echo $row['short_link'].'"><image vimeo/></a></td>'; break; case "dailymotion": echo '<td><a href="'; echo $row['short_link'].'"><image dailymotion/></a></td>'; break; default: echo '<td><a href="'; echo $row['short_link'].'"></a></td>'; } echo "<td>" . $row['server'] . "</td>"; echo "<td>" . $row['format'] . "</td>"; echo "<td>" . $row['resolution'] . "</td>"; echo "<td>" . $row['size'] . "</td>"; echo "<td>" . $row['user'] . "</td>"; echo "</tr>"; } echo "</table>"; but I need that if the server has parts, put all in a div and appears like this: sometimes the video has more parts, I searched for "group by" but I don't know how to integrate it. How I can do that or What do I need search in google to find examples?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.