javascript - Createing a php/js toggle for a list of links -
so got in truble php code want obtain this, toggle link same page, toggle when pressed show list of link generated using php, links download documents server, sorry in advance using torrent links had no idee of else, want mention not using these create type of illegal content website, here illustration in html:
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script type="text/javascript"> function toggle_visibility(id) { var e = document.getelementbyid(id); if (e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; } </script> <style> #foo1 { list-style-type: none; padding-bottom:10px; display: none; } #foo2 { list-style-type: none; padding-bottom:10px; display: none; } </style> </head> <body> <h3>programs</h3> <a href="#" onclick="toggle_visibility('foo1');">movies</a> <div id="foo1"> <ul style="padding-bottom:15px;list-style-type: none;"> <li style="padding-bottom:15px;"><a href="itms-services://?action=download-manifest&url=http://kickass.to/the-official-uk-top-40-singles-chart-15-06-2014-t9225052.html" onclick="this.color=#ff0000;"> _movie~2014-06-16-1808-name-muzic--1.0.1-4035-g0d107d0~host</a> </li> <li style="padding-bottom:15px;"><a href="itms-services://?action=download-manifest&url=http://kickass.to/the-official-uk-top-40-singles-chart-15-06-2014-t9225052.html" onclick="this.color=#ff0000;"> _movie~2014-06-16-1808-name-muzic--1.0.1-4035-g0d107d0~host</a> </li> <li style="padding-bottom:15px;"><a href="itms-services://?action=download-manifest&url=http://kickass.to/the-official-uk-top-40-singles-chart-15-06-2014-t9225052.html" onclick="this.color=#ff0000;"> _movie~2014-06-16-1808-name-muzic--1.0.1-4035-g0d107d0~host</a> </li> </ul> </div> <br><a href="#" onclick="toggle_visibility('foo2');">music</a> <div id="foo2"> <ul style="padding-bottom:15px;list-style-type: none;"> <li style="padding-bottom:15px;"><a href="itms-services://?action=download-manifest&url=https://kickass.to/game-of-thrones-s04e10-720p-hdtv-x264-killers-rartv-t9225859.html" onclick="this.color=#ff0000;"> _muzic~2014-06-16-1808-name-muzic--1.0.1-4035-g0d107d0~host</a> </li> <li style="padding-bottom:15px;"><a href="itms-services://?action=download-manifest&url=http://kickass.to/game-of-thrones-s04e10-720p-hdtv-x264-killers-rartv-t9225859.html" onclick="this.color=#ff0000;"> _muzic~2014-06-16-1808-name-muzic--1.0.1-4035-g0d107d0~host</a> </li> <li style="padding-bottom:15px;"><a href="itms-services://?action=download-manifest&url=http://kickass.to/game-of-thrones-s04e10-720p-hdtv-x264-killers-rartv-t9225859.html" onclick="this.color=#ff0000;"> _muzic~2014-06-16-1808-name-muzic--1.0.1-4035-g0d107d0~host</a> </li> </ul> </div> </body></html> and have done in php this:
<? if (isset($_post['password'])) { $password = $_post['password']; $goodpass = '******'; if ($password == $goodpass) $_session['loggedin']=1; } if (!isset($_session['loggedin'])) showpasswordform(); else { $install_links = getdirectory("."); rsort($install_links); $oldprefix = ""; foreach ($install_links $key => $val) { $strip_val = strip_tags($val); $prefix = explode("~",$strip_val); //echo "prefix:|".$prefix[0]."|</br>"; if (strcmp($prefix[0],$oldprefix)!=0) echo <<<eot </div> <a href='#' onclick="toggle_visibility('".$prefix[0]."');"> "".$prefix[0].""</a><div id="".$prefix[0]."">eot; $oldprefix = $prefix[0]; echo '<li style="padding-bottom:15px">'.$val.'</li><br/>'; } } function getdirectory( $path = '.', $level = 0 ){ $echodata = false; $protocol = isset($_server['https']) ? "https://" : "http://"; $root_folder_url_prefix = $protocol."....."; $ignore = array( 'cgi-bin', '.', '..','what.app.dsym' ); // directories ignore when listing output. many hosts // deny php access cgi-bin. $dh = @opendir( $path ); // open directory handle $dh $install_links = array(); while( false !== ( $file = readdir( $dh ) ) ){ // loop through directory if( !in_array( $file, $ignore ) ){ // check file not ignored $spaces = str_repeat( ' ', ( $level * 4 ) ); // add together spacing list, improve // show directory tree. if( is_dir( "$path/$file" ) ){ // directory, need maintain reading down... if ( $echodata) echo "<strong>$spaces $file</strong><br />"; $subarray = getdirectory( "$path/$file", ($level+1) ); $install_links = array_merge($install_links, $subarray); // re-call same function on new directory. // makes function recursive. } else { if (strstr($file,".ipa")) { //echo ">>".$file."<<"; $filename = str_replace(".ipa","",$file); $plist_path = substr($path,2); $plist_path = str_replace("/","~",$plist_path); $plist_location = $root_folder_url_prefix.$plist_path."~".$filename.".plist"; $link = '<a href="itms-services://?action=download-manifest&url='.$plist_location.'" onclick="this.color=#ff0000;"> '.$plist_path.'-'.$filename.'</a>'; if ( $echodata) echo "$spaces $link<br/>"; array_push($install_links,$link); } else { // echo "$spaces $file<br />"; // print out filename } } } } closedir( $dh ); // close directory handle homecoming $install_links; } function showpasswordform() { ?> <center> <form action="index.php" method="post"> <table> <tr><td>user:</td> <td> <input type="text" name="user" /></td></tr> <tr><td>password:</td> <td> <input type="password" name="password" /></td></tr> <tr><td colspan="2" align="center"><input type="submit" value="submit" /></td> </tr> </table> </form> </center> <? } ?> and may see have not yet implemented js php....
javascript php html toggle
No comments:
Post a Comment