Jump to content

fenzo666

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by fenzo666

  1. I fixed the error but all it shows now is just the table titles :\
  2. This is the table code: <table summary="List of fields"><tr><th></th><th>#</th><th>Name</th><th>Type</th></tr> <?php $fp = fopen('include/database.csv','r'); if (!$fp) { echo 'ERROR: Unable to open file.</table></body></html>'; exit; } $row = 1; while (!feof($fp)) { $line = fgets($fp,1024); //use 2048 if very long lines $row++; list ($numb, $name, $type1, $type2) = split ('\,', $line); if ($sortby == 'numb') $sortkey = strtolower($numb); if ($sortby == 'name') $sortkey = strtolower($name); $col[$row] = array($sortkey, $numb, $name, $type1, $type2); } fclose($fp); sort($col); reset ($col); $arrays = count($col) - 1; $loop = -1; $loopcounter = 0;/********** Function for sorting by number **********/ if ($sortby == 'numb') { echo '<p class="textcenter"><a href="index.php?:A">I</a> | <a href="index.php?:B">II</a> | <a href="index.php?:C">III</a> | <a href="index.php?">IV</a> | <a href="index.php?:E">All</a></p>'; if ($sortbyletter == 'a') { $startingnumber = 001; $endingnumber = 151; } elseif ($sortbyletter == 'b') { $startingnumber = 152; $endingnumber = 251; } elseif ($sortbyletter == 'c') { $startingnumber = 252; $endingnumber = 386; } elseif ($sortbyletter == 'd') { $startingnumber = 387; $endingnumber = 493; } elseif ($sortbyletter == 'e') { $startingnumber = 001; $endingnumber = 493; } else { $startingnumber = 001; $endingnumber = 151; } while ($loopcounter < $endingnumber) { $loopcounter++; $loop++; if ($loopcounter >= $startingnumber) { echo '<tr>';//name of pokemon is second column $nameofpoke = $col[$loop][2];//name of pokemon is lowercased $nameofpoke = strtolower($nameofpoke);//name of the file is directory+filename $nameoffile = 'files/pkm/'.$nameofpoke.'.pkm'; $nameoffile2 = 'files/pkm/'.ucwords($nameofpoke).'.pkm';//type 1 is column 3 $typename1 = strtolower($col[$loop][3]);//remove spaces from type1 $typename1 = str_replace ( ' ', "", $typename1);//type 2 is column 4 $typename2 = strtolower($col[$loop][4]);//remove new-lines from column 4 $typename2 = str_replace ( '', "", $typename2);//img tag for type1 $typeimage = '<img alt="type icon" src="include/image/'.$typename1.'.gif" />';//url of second type $type2url = 'include/image/'.$typename2.'.gif';//checks if the pkm file exists if (file_exists($nameoffile) || file_exists($nameoffile2)) {//if it does... echo //1 is Poke #, 2 is Poke Name, 3 is Generation '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td><a href="'.$nameoffile.'">'.$col[$loop][2].'</a></td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr> '; } }//zipfiles elseif (file_exists("files/pkm/".$nameofpoke.".zip")) { echo '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td><a href="files/pkm/'.$nameofpoke.'.zip">'.$col[$loop][2].'</a></td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr>'; } }//same thing but only if there is no file else { echo '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td>'.$col[$loop][2].'</td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr>'; } }}}} /********** Function for sorting by name **********/ if ($sortby == 'name') { echo '<div style="text-align:center;"><a href="index.php?name:A">A</a><a href="index.php?name:B">B</a><a href="index.php?name:C">C</a><a href="index.php?name:D">D</a><a href="index.php?name:E">E</a><a href="index.php?name:F">F</a><a href="index.php?name:G">G</a><a href="index.php?name:H">H</a><a href="index.php?name:I">I</a><a href="index.php?name:J">J</a><a href="index.php?name:K">K</a><a href="index.php?name:L">L</a><a href="index.php?name:M">M</a><a href="index.php?name:N">N</a><a href="index.php?name:O">O</a><a href="index.php?name:P">P</a><a href="index.php?name:Q">Q</a><a href="index.php?name:R">R</a><a href="index.php?name:S">S</a><a href="index.php?name:T">T</a><a href="index.php?name:U">U</a><a href="index.php?name:V">V</a><a href="index.php?name:W">W</a><a href="index.php?name:X">X</a><a href="index.php?name:Y">Y</a><a href="index.php?name:Z">Z</a> | <a href="index.php?name">All</a></div><br />'; while ($loop < $arrays) { $loop++;// Outputs the name of the pokemon and the name of the directory+nameofpokemon uncaptilized+.pkm//name of pokemon is second column $nameofpoke = $col[$loop][2];$nameofpoke = strtolower($nameofpoke);//name fo the file is directory+filename $nameoffile = 'files/pkm/'.$nameofpoke.'.pkm';//type 1 is column 3 $typename1 = strtolower($col[$loop][3]); $typename1 = str_replace ( ' ', "", $typename1);//type 2 is column 4 $typename2 = strtolower($col[$loop][4]); $typename2 = str_replace ( '', "", $typename2);//img tag for type1 $typeimage = '<img alt="type icon" src="include/image/'.$typename1.'.gif" />';//url of second type $type2url = 'include/image/'.$typename2.'.gif'; $firstletter = $nameofpoke{0}; if ($firstletter == $sortbyletter) { echo '<tr>';//checks if the file exists $nameoffile2 = 'files/pkm/'.ucwords($nameofpoke).'.pkm'; if (file_exists($nameoffile) || file_exists($nameoffile2)) {//if it does... echo //1 is Poke #, 2 is Poke Name, 3 is Generation '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td><a href="'.$nameoffile.'">'.$col[$loop][2].'</a></td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr>'; }}//zipfiles elseif (file_exists("files/pkm/".$nameofpoke.".zip") || file_exists("files/pkm/".ucwords($nameofpoke).".zip")) { echo'<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td><a href="files/pkm/'.$nameofpoke.'.zip">'.$col[$loop][2].'</a></td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>';}else {echo '</td></tr>'; }} else {//same thing but only if there is no file echo '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td>'.$col[$loop][2].'</td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr>'; }}}}} if ($sortby == 'missing') { while ($loop < $arrays) { $loop++;// Outputs the name of the pokemon and the name of the directory+nameofpokemon uncaptilized+.pkm//name of pokemon is second column $nameofpoke = $col[$loop][2]; $nameofpoke = strtolower($nameofpoke);//name fo the file is directory+filename $nameoffile = 'files/pkm/'.$nameofpoke.'.pkm';//type 1 is column 3 $typename1 = strtolower($col[$loop][3]); $typename1 = str_replace ( ' ', "", $typename1);//type 2 is column 4 $typename2 = strtolower($col[$loop][4]); $typename2 = str_replace ( '', "", $typename2);//img tag for type1 $typeimage = '<img alt="type icon" src="include/image/'.$typename1.'.gif" />';//url of second type $type2url = 'include/image/'.$typename2.'.gif'; $firstletter = $nameofpoke{0};//checks if the file exists if (file_exists($nameoffile)) {} else{ echo '<tr>';//same thing but only if there is no file echo '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td>'.$col[$loop][2].'</td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>';}else {echo '</td></tr>'; }}}} ?></table> This is the error: ERROR: Unable to open file. # Name Type
  3. Basically I am setting up the same site in a CMS known as Drupal. I just want to move it to a new page.
  4. Here is the table I want to move: http://db.pokesav.org/ I am moving to a new root folder as well as a new site layout. I want to bring the tables along. There is a table for each Pokemon organized by letter and by generation, as well as an "all pokemon" table. Which part of the code would I need to copy and paste into the new page? (Note: I ONLY want the code for the tables, not the site layout and sidebars, headings, etc.)Thanks! CODE: <?php $querystring = $_SERVER['QUERY_STRING']; list($sortby, $sortbyletter) = split(':', $querystring); $set = ''; if ($sortby == '') { $header = '<li class="selected"> <a href="index.php?:A">numb.</a></li><li><a href="index.php?name:A">Name</a></li>'; $sortby = 'numb'; $set = 'y'; } if ($sortby == 'name') { $header = '<li><a href="index.php?:A">numb.</a></li><li class="selected"><a href="index.php?name:A">Name</a></li>'; $set = 'y'; } if ($sortby == 'missing') { $header = '<li><a href="index.php?:A">numb.</a></li><li><a href="index.php?name:A">Name</a></li>'; $set = 'y'; } if ($set != 'y') { echo 'The variable at the end of the web address did not match one required by the code. Please check the web address for errors.'; exit; } $sortbyletter = strtolower($sortbyletter); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>The PKM Database</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="An extensive Pokemon file database, including hundreds of events and an upload bin." /> <meta name="keywords" content="pokemon,database,pkm,pokesav,event,wonder card,wondercard,iritegood,fenzo" /> <link rel="stylesheet" href="include/style.css" type="text/css" media="screen,projection" /> </head> <body> <?php include("include/header.php"); ?> <div id="container" ><div id="header"> <h1>The PKM Database</h1> <h2> <?php $randtext[] = "[slogan here]!"; $randtext[] = "Where Pokémon meet Pokésav!"; $randtext[] = "A collector's heaven."; $randtext[] = "These PKM files have hex data!"; srand ((double) microtime() * 1000000); $randomtext = rand(0,count($randtext)-1); echo $randtext[$randomtext]; ?> </h2></div><div id="navigation"> <ul> <?php echo $header.""; ?><li><a href="event.php">Events</a></li><li><a href="video.php">Videos</a></li><li><a href="other.php">Other</a></li><li><a href="help.php">Help</a></li><li><a href="about.php">About</a></li><li><a href="/upload">Upload</a></li></ul></div><div id="content"> <?php if ($sortby == 'name') { echo'<h2><h2 align=center><font color="#467AA7"><b>Alphabetical</b></font></h2></h2>'; } if ($sortby == 'numb') { echo'<h2><h2 align=center><font color="#467AA7"><b>Numerical</b></font></h2></h2>'; } ?> <table summary="List of fields"><tr><th></th><th>#</th><th>Name</th><th>Type</th></tr> <?php $fp = fopen('include/database.csv','r'); if (!$fp) { echo 'ERROR: Unable to open file.</table></body></html>'; exit; } $row = 1; while (!feof($fp)) { $line = fgets($fp,1024); //use 2048 if very long lines $row++; list ($numb, $name, $type1, $type2) = split ('\,', $line); if ($sortby == 'numb') $sortkey = strtolower($numb); if ($sortby == 'name') $sortkey = strtolower($name); $col[$row] = array($sortkey, $numb, $name, $type1, $type2); } fclose($fp); sort($col); reset ($col); $arrays = count($col) - 1; $loop = -1; $loopcounter = 0;/********** Function for sorting by number **********/ if ($sortby == 'numb') { echo '<p class="textcenter"><a href="index.php?:A">I</a> | <a href="index.php?:B">II</a> | <a href="index.php?:C">III</a> | <a href="index.php?">IV</a> | <a href="index.php?:E">All</a></p>'; if ($sortbyletter == 'a') { $startingnumber = 001; $endingnumber = 151; } elseif ($sortbyletter == 'b') { $startingnumber = 152; $endingnumber = 251; } elseif ($sortbyletter == 'c') { $startingnumber = 252; $endingnumber = 386; } elseif ($sortbyletter == 'd') { $startingnumber = 387; $endingnumber = 493; } elseif ($sortbyletter == 'e') { $startingnumber = 001; $endingnumber = 493; } else { $startingnumber = 001; $endingnumber = 151; } while ($loopcounter < $endingnumber) { $loopcounter++; $loop++; if ($loopcounter >= $startingnumber) { echo '<tr>';//name of pokemon is second column $nameofpoke = $col[$loop][2];//name of pokemon is lowercased $nameofpoke = strtolower($nameofpoke);//name of the file is directory+filename $nameoffile = 'files/pkm/'.$nameofpoke.'.pkm'; $nameoffile2 = 'files/pkm/'.ucwords($nameofpoke).'.pkm';//type 1 is column 3 $typename1 = strtolower($col[$loop][3]);//remove spaces from type1 $typename1 = str_replace ( ' ', "", $typename1);//type 2 is column 4 $typename2 = strtolower($col[$loop][4]);//remove new-lines from column 4 $typename2 = str_replace ( '', "", $typename2);//img tag for type1 $typeimage = '<img alt="type icon" src="include/image/'.$typename1.'.gif" />';//url of second type $type2url = 'include/image/'.$typename2.'.gif';//checks if the pkm file exists if (file_exists($nameoffile) || file_exists($nameoffile2)) {//if it does... echo //1 is Poke #, 2 is Poke Name, 3 is Generation '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td><a href="'.$nameoffile.'">'.$col[$loop][2].'</a></td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr> '; } }//zipfiles elseif (file_exists("files/pkm/".$nameofpoke.".zip")) { echo '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td><a href="files/pkm/'.$nameofpoke.'.zip">'.$col[$loop][2].'</a></td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr>'; } }//same thing but only if there is no file else { echo '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td>'.$col[$loop][2].'</td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr>'; } }}}} /********** Function for sorting by name **********/ if ($sortby == 'name') { echo '<div style="text-align:center;"><a href="index.php?name:A">A</a><a href="index.php?name:B">B</a><a href="index.php?name:C">C</a><a href="index.php?name:D">D</a><a href="index.php?name:E">E</a><a href="index.php?name:F">F</a><a href="index.php?name:G">G</a><a href="index.php?name:H">H</a><a href="index.php?name:I">I</a><a href="index.php?name:J">J</a><a href="index.php?name:K">K</a><a href="index.php?name:L">L</a><a href="index.php?name:M">M</a><a href="index.php?name:N">N</a><a href="index.php?name:O">O</a><a href="index.php?name:P">P</a><a href="index.php?name:Q">Q</a><a href="index.php?name:R">R</a><a href="index.php?name:S">S</a><a href="index.php?name:T">T</a><a href="index.php?name:U">U</a><a href="index.php?name:V">V</a><a href="index.php?name:W">W</a><a href="index.php?name:X">X</a><a href="index.php?name:Y">Y</a><a href="index.php?name:Z">Z</a> | <a href="index.php?name">All</a></div><br />'; while ($loop < $arrays) { $loop++;// Outputs the name of the pokemon and the name of the directory+nameofpokemon uncaptilized+.pkm//name of pokemon is second column $nameofpoke = $col[$loop][2];$nameofpoke = strtolower($nameofpoke);//name fo the file is directory+filename $nameoffile = 'files/pkm/'.$nameofpoke.'.pkm';//type 1 is column 3 $typename1 = strtolower($col[$loop][3]); $typename1 = str_replace ( ' ', "", $typename1);//type 2 is column 4 $typename2 = strtolower($col[$loop][4]); $typename2 = str_replace ( '', "", $typename2);//img tag for type1 $typeimage = '<img alt="type icon" src="include/image/'.$typename1.'.gif" />';//url of second type $type2url = 'include/image/'.$typename2.'.gif'; $firstletter = $nameofpoke{0}; if ($firstletter == $sortbyletter) { echo '<tr>';//checks if the file exists $nameoffile2 = 'files/pkm/'.ucwords($nameofpoke).'.pkm'; if (file_exists($nameoffile) || file_exists($nameoffile2)) {//if it does... echo //1 is Poke #, 2 is Poke Name, 3 is Generation '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td><a href="'.$nameoffile.'">'.$col[$loop][2].'</a></td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr>'; }}//zipfiles elseif (file_exists("files/pkm/".$nameofpoke.".zip") || file_exists("files/pkm/".ucwords($nameofpoke).".zip")) { echo'<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td><a href="files/pkm/'.$nameofpoke.'.zip">'.$col[$loop][2].'</a></td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>';}else {echo '</td></tr>'; }} else {//same thing but only if there is no file echo '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td>'.$col[$loop][2].'</td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>'; } else { echo '</td></tr>'; }}}}} if ($sortby == 'missing') { while ($loop < $arrays) { $loop++;// Outputs the name of the pokemon and the name of the directory+nameofpokemon uncaptilized+.pkm//name of pokemon is second column $nameofpoke = $col[$loop][2]; $nameofpoke = strtolower($nameofpoke);//name fo the file is directory+filename $nameoffile = 'files/pkm/'.$nameofpoke.'.pkm';//type 1 is column 3 $typename1 = strtolower($col[$loop][3]); $typename1 = str_replace ( ' ', "", $typename1);//type 2 is column 4 $typename2 = strtolower($col[$loop][4]); $typename2 = str_replace ( '', "", $typename2);//img tag for type1 $typeimage = '<img alt="type icon" src="include/image/'.$typename1.'.gif" />';//url of second type $type2url = 'include/image/'.$typename2.'.gif'; $firstletter = $nameofpoke{0};//checks if the file exists if (file_exists($nameoffile)) {} else{ echo '<tr>';//same thing but only if there is no file echo '<td><img alt="pokemon icon" src="include/icons/'.$col[$loop][1].'.png" /></td><td>'.$col[$loop][1].'</td><td>'.$col[$loop][2].'</td><td>'.$typeimage; if (file_exists('include/image/'.$typename2.'.gif')) { echo '<img alt="type icon" src="include/image/'.$typename2.'.gif" /></td></tr>';}else {echo '</td></tr>'; }}}} ?></table><br /></div> <?php include("include/sidebar.php"); ?> <div id="footer"><p> <?php $year = date("Y",time ()); if ( $year != "2008" ) {echo "© 2008 - ".$year;}else {echo "© 2008";} ?> <a href="#">Bao Trinh</a> | Last updated: <?php echo date('j F Y', getlastmod()); ?> </p> </div> </div> </body> </html>
  5. Well, I inputted the code and this is the error I get.  Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'http' (1) in /home/content/b/a/o/baohuahuang/html/db/news.php on line 12 Fatal error: SQL in /home/content/b/a/o/baohuahuang/html/db/news.php on line 12 <?php $conn = mysql_connect('http://db.pokesav.org/','fenzo666','PASSWORD') or trigger_error("SQL", E_USER_ERROR); //this is line 12 $db = mysql_select_db('fenzo666',$conn) or trigger_error("SQL", E_USER_ERROR); for ($x = 0; $x < 106; $x++) { $number = rand(100,999); $sql = "INSERT INTO numbers (number, id) VALUES ($number, '')"; $query = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } ?> <?php // database connection info $conn = mysql_connect('http://db.pokesav.org/','fenzo666','PASSWORD') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('fenzo666',$conn) or trigger_error("SQL", E_USER_ERROR);
  6. Unfortunately I am a very noob PHP programmer and I don't know where to plug in the codes form that tut. If someone would care to re-write my code with the pagination, it would be greatly appreciated.
  7. So basically I want to create a news section for my site. I have something VERY basic so far: http://db.pokesav.org/news.php No news yet, but I want to make it as appealing as possible. I also want the page to automatically input when and who put the article for the news. For example: "Crazy Lion eats Man" 09/18/09 - fenzo666 Today, a man was attacked by a giant lion... I also need to add the function that sets a cap on the number of articles. For instance, if I have 10 articles per page, and I have 50 articles in total, there will be a navigation toolbar of some sort to flip through the pages. Here is what I have so far: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>The PKM Database</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="Your website description goes here" /> <meta name="keywords" content="your,keywords,goes,here" /> <link rel="stylesheet" href="include/style.css" type="text/css" media="screen,projection" /> </head> <body> <?php include("include/header.php"); ?> <div id="container" > <div id="header"> <h1>The PKM Database</h1> <h2>Where Pokémon meet Pokésav!</h2> </div> <div id="navigation"> <ul> <li class="selected"><a href="news.php">News</a></li> <li><a href="index.php?:A">Numb.</a></li> <li><a href="index.php?name:A">Name</a></li> <li><a href="event.php">Events</a></li> <li><a href="video.php">Videos</a></li> <li><a href="other.php">Other</a></li> <li><a href="help.php">Help</a></li> <li><a href="about.php">About</a></li> <li><a href="/upload">Upload</a></li> </ul> </div> <div id="content"> <h2><h2 align=center><font color="#467AA7"><b>The PKM DB News!</b></font></h2></h2> <p> <?php include("include/pages/news.html"); ?> </p> </div> <?php include("include/sidebar.php"); ?> <div id="footer"> <p> <?php $year = date("Y",time ()); if ( $year != "2008" ) { echo "© 2008 - ".$year; } else { echo "© 2008"; } ?> <a href="#">Bao Trinh</a> | Last updated: <?php echo date('j F Y', getlastmod()); ?></p> </div> </div> </body> </html> Thanks so much for your help guys! -fenzo666
  8. Whoops: Internet Explorer viewing fixed. I forgot a tag at the end. But the banner issue still affects Mozilla's version.
  9. I think you are viewing it in Internet Explorer. Try it with Mozilla Firefox.
  10. Well, the banner only takes up about 3/4 of the space. I removed the text and added a white banner. Take a look: http://db.pokesav.org/ How can i make it so that it takes up the last quarter of the blue section?
  11. Well, I tried it out with a sample image that fits the width and length proportions but it seems to be having some difficulties. Take a look: http://db.pokesav.org/
  12. Thank you. How exactly would I input the image? Upload it to the root folder or to a site like tinypic and link it? I am new to PHP, really sorry for causing all the trouble.
  13. Hey guys, just needed some help with banners. Here is the site I am trying to modify: http://db.pokesav.org/ I am trying to replace the banner at the top (The PKM Database), with an image banner. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>The PKM Database</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="An extensive Pokemon file database, including hundreds of events and an upload bin." /> <meta name="keywords" content="pokemon,database,pkm,pokesav,event,wonder card,wondercard,iritegood,fenzo" /> <link rel="stylesheet" href="include/style.css" type="text/css" media="screen,projection" /> </head> <body> <?php include("include/header.php"); </h2></div><div id="navigation">
  14. Need some help with my directory script. It works like this. A $dir variable is passed via URL. The dir variable determines which folder the script shows and what directory the upload portion of the script uploads to. The problem is: the upload script uploads to the base folder rather than the $dir. Any help would be appreciated. <? /* Directory Listing Script - Version 2 ==================================== Script Author: Ash Young <ash@evoluted.net>. www.evoluted.net Layout: Manny <manny@tenka.co.uk>. www.tenka.co.uk REQUIREMENTS ============ This script requires PHP and GD2 if you wish to use the thumbnail functionality. INSTRUCTIONS ============ 1) Unzip all files 2) Edit this file, making sure everything is setup as required. 3) Upload to server 4) ?????? 5) Profit! CONFIGURATION ============= Edit the variables in this section to make the script work as you require. Start Directory - To list the files contained within the current directory enter '.', otherwise enter the path to the directory you wish to list. The path must be relative to the current directory. */ $startdir = '.'; /* Show Thumbnails? - Set to true if you wish to use the scripts auto-thumbnail generation capabilities. This requires that GD2 is installed. */ $showthumbnails = true; /* Show Directories - Do you want to make subdirectories available? If not set this to false */ $showdirs = true; /* Force downloads - Do you want to force people to download the files rather than viewing them in their browser? */ $forcedownloads = false; /* Hide Files - If you wish to hide certain files or directories then enter their details here. The values entered are matched against the file/directory names. If any part of the name matches what is entered below then it is now shown. */ $hide = array( 'upload', 'guestbook', 'include', '.htaccess', '.htpasswd', 'about.php', 'chat.php', 'directory.php', 'edit.php', 'event.php', 'help.php', 'index.php', 'other.php', 'comments.php', 'temp.txt' ); /* Show index files - if an index file is found in a directory to you want to display that rather than the listing output from this script? */ $displayindex = false; /* Allow uploads? - If enabled users will be able to upload files to any viewable directory. You should really only enable this if the area this script is in is already password protected. */ $allowuploads = false; /* Overwrite files - If a user uploads a file with the same name as an existing file do you want the existing file to be overwritten? */ $overwrite = false; /* Index files - The follow array contains all the index files that will be used if $displayindex (above) is set to true. Feel free to add, delete or alter these */ $indexfiles = array ( 'index.html', 'index.htm', 'default.htm', 'default.html' ); /* File Icons - If you want to add your own special file icons use this section below. Each entry relates to the extension of the given file, in the form <extension> => <filename>. These files must be located within the dlf directory. */ $filetypes = array ( 'png' => 'jpg.gif', 'jpeg' => 'jpg.gif', 'bmp' => 'jpg.gif', 'jpg' => 'jpg.gif', 'gif' => 'gif.gif', 'zip' => 'archive.png', 'rar' => 'archive.png', 'exe' => 'exe.gif', 'setup' => 'setup.gif', 'txt' => 'text.png', 'htm' => 'html.gif', 'html' => 'html.gif', 'fla' => 'fla.gif', 'swf' => 'swf.gif', 'xls' => 'xls.gif', 'doc' => 'doc.gif', 'sig' => 'sig.gif', 'fh10' => 'fh10.gif', 'pdf' => 'pdf.gif', 'psd' => 'psd.gif', 'rm' => 'real.gif', 'mpg' => 'video.gif', 'mpeg' => 'video.gif', 'mov' => 'video2.gif', 'avi' => 'video.gif', 'eps' => 'eps.gif', 'gz' => 'archive.png', 'asc' => 'sig.gif', ); /* That's it! You are now ready to upload this script to the server. Only edit what is below this line if you are sure that you know what you are doing! */ error_reporting(0); if(!function_exists('imagecreatetruecolor')) $showthumbnails = false; $leadon = $startdir; if($leadon=='.') $leadon = ''; if((substr($leadon, -1, 1)!='/') && $leadon!='') $leadon = $leadon . '/'; $startdir = $leadon; if($_GET['dir']) { //check this is okay. if(substr($_GET['dir'], -1, 1)!='/') { $_GET['dir'] = $_GET['dir'] . '/'; } $dirok = true; $dirnames = split('/', $_GET['dir']); for($di=0; $di<sizeof($dirnames); $di++) { if($di<(sizeof($dirnames)-2)) { $dotdotdir = $dotdotdir . $dirnames[$di] . '/'; } if($dirnames[$di] == '..') { $dirok = false; } } if(substr($_GET['dir'], 0, 1)=='/') { $dirok = false; } if($dirok) { $leadon = $leadon . $_GET['dir']; } } if($_GET['download'] && $forcedownloads) { $file = str_replace('/', '', $_GET['download']); $file = str_replace('..', '', $file); if(file_exists($leadon . $file)) { header("Content-type: application/x-download"); header("Content-Length: ".filesize($leadon . $file)); header('Content-Disposition: attachment; filename="'.$file.'"'); readfile($leadon . $file); die(); } } if($allowuploads && $_FILES['file']) { $upload = true; if(!$overwrite) { if(file_exists($leadon.$_FILES['file']['name'])) { $upload = false; } } if($upload) { move_uploaded_file($_FILES['file']['tmp_name'], $leadon . $_FILES['file']['name']); } } $opendir = $leadon; if(!$leadon) $opendir = '.'; if(!file_exists($opendir)) { $opendir = '.'; $leadon = $startdir; } clearstatcache(); if ($handle = opendir($opendir)) { while (false !== ($file = readdir($handle))) { //first see if this file is required in the listing if ($file == "." || $file == "..") continue; $discard = false; for($hi=0;$hi<sizeof($hide);$hi++) { if(strpos($file, $hide[$hi])!==false) { $discard = true; } } if($discard) continue; if (@filetype($leadon.$file) == "dir") { if(!$showdirs) continue; $n++; if($_GET['sort']=="date") { $key = @filemtime($leadon.$file) . ".$n"; } else { $key = $n; } $dirs[$key] = $file . "/"; } else { $n++; if($_GET['sort']=="date") { $key = @filemtime($leadon.$file) . ".$n"; } elseif($_GET['sort']=="size") { $key = @filesize($leadon.$file) . ".$n"; } else { $key = $n; } $files[$key] = $file; if($displayindex) { if(in_array(strtolower($file), $indexfiles)) { header("Location: $file"); die(); } } } } closedir($handle); } //sort our files if($_GET['sort']=="date") { @ksort($dirs, SORT_NUMERIC); @ksort($files, SORT_NUMERIC); } elseif($_GET['sort']=="size") { @natcasesort($dirs); @ksort($files, SORT_NUMERIC); } else { @natcasesort($dirs); @natcasesort($files); } //order correctly if($_GET['order']=="desc" && $_GET['sort']!="size") {$dirs = @array_reverse($dirs);} if($_GET['order']=="desc") {$files = @array_reverse($files);} $dirs = @array_values($dirs); $files = @array_values($files); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>Directory Listing of <?=dirname($_SERVER['PHP_SELF']).'/'.$leadon;?></title> <link rel="stylesheet" href="include/style.css" type="text/css" media="screen,projection" /> <? if($showthumbnails) { ?> <script language="javascript" type="text/javascript"> <!-- function o(n, i) { document.images['thumb'+n].src = 'include/directorylisting/i.php?f='+i; } function f(n) { document.images['thumb'+n].src = 'include/directorylisting/trans.gif'; } //--> </script> <? } ?> </head> <body> <?php include("include/header.php"); ?> <div id="container" > <div id="header"> <h1>The PKM Database</h1> <h2>[slogan here]!</h2> </div> <div id="navigation"> <ul> <li><a href="index.php?:A">numb.</a></li> <li><a href="index.php?name:A">name.</a></li> <li><a href="event.php">evnt.</a></li> <li><a href="other.php">othr.</a></li> <li><a href="help.php">help.</a></li> <li><a href="about.php">about.</a></li> <li><a href="/upload">UPLOAD.</a></li> </ul> </div> <div id="content"> <h2 id="dirlistheader">Directory Listing of <?=dirname($_SERVER['PHP_SELF']).'/'.$leadon;?></h2> <div id="breadcrumbs"> <a href="<?=$_SERVER['PHP_SELF'];?>">home</a> <? $breadcrumbs = split('/', $leadon); if(($bsize = sizeof($breadcrumbs))>0) { $sofar = ''; for($bi=0;$bi<($bsize-1);$bi++) { $sofar = $sofar . $breadcrumbs[$bi] . '/'; echo ' > <a href="'.$_SERVER['PHP_SELF'].'?dir='.urlencode($sofar).'">'.$breadcrumbs[$bi].'</a>'; } } $baseurl = $_SERVER['PHP_SELF'] . '?dir='.$_GET['dir'] . '&'; $fileurl = 'sort=name&order=asc'; $sizeurl = 'sort=size&order=asc'; $dateurl = 'sort=date&order=asc'; switch ($_GET['sort']) { case 'name': if($_GET['order']=='asc') $fileurl = 'sort=name&order=desc'; break; case 'size': if($_GET['order']=='asc') $sizeurl = 'sort=size&order=desc'; break; case 'date': if($_GET['order']=='asc') $dateurl = 'sort=date&order=desc'; break; default: $fileurl = 'sort=name&order=desc'; break; } ?> </div> <div id="listingcontainer"> <div id="listingheader"> <div id="headerfile"><a href="<?=$baseurl . $fileurl;?>">File</a></div> <div id="headersize"><a href="<?=$baseurl . $sizeurl;?>">Size</a></div> <div id="headermodified"><a href="<?=$baseurl . $dateurl;?>">Last Modified</a></div> </div> <div id="listing"> <? $class = 'b'; if($dirok) { ?> <div><a href="<?=$_SERVER['PHP_SELF'].'?dir='.urlencode($dotdotdir);?>" class="<?=$class;?>"><img src="include/directorylisting/dirup.png" alt="Folder" /><strong>..</strong> <em>-</em> <?=date ("M d Y", filemtime($dotdotdir));?></a></div> <? if($class=='b') $class='w'; else $class = 'b'; } $arsize = sizeof($dirs); for($i=0;$i<$arsize;$i++) { ?> <div><a href="<?=$_SERVER['PHP_SELF'].'?dir='.urlencode($leadon.$dirs[$i]);?>" class="<?=$class;?>"><img src="include/directorylisting/folder.png" alt="<?=$dirs[$i];?>" /><strong><?=$dirs[$i];?></strong> <em>-</em> <?=date ("M d Y", filemtime($leadon.$dirs[$i]));?></a></div> <? if($class=='b') $class='w'; else $class = 'b'; } $arsize = sizeof($files); for($i=0;$i<$arsize;$i++) { $icon = 'unknown.png'; $ext = strtolower(substr($files[$i], strrpos($files[$i], '.')+1)); $supportedimages = array('gif', 'png', 'jpeg', 'jpg'); $thumb = ''; if($showthumbnails && in_array($ext, $supportedimages)) { $thumb = '<span><img src="include/directorylisting/trans.gif" alt="'.$files[$i].'" name="thumb'.$i.'" /></span>'; $thumb2 = ' onmouseover="o('.$i.', \''.urlencode($leadon . $files[$i]).'\');" onmouseout="f('.$i.');"'; } if($filetypes[$ext]) { $icon = $filetypes[$ext]; } $filename = $files[$i]; if(strlen($filename)>43) { $filename = substr($files[$i], 0, 40) . '...'; } $fileurl = $leadon . $files[$i]; if($forcedownloads) { $fileurl = $_SESSION['PHP_SELF'] . '?dir=' . urlencode($leadon) . '&download=' . urlencode($files[$i]); } ?> <div><a href="<?=$fileurl;?>" class="<?=$class;?>"<?=$thumb2;?>><img src="include/directorylisting/<?=$icon;?>" alt="<?=$files[$i];?>" /><strong><?=$filename;?></strong> <em><?=round(filesize($leadon.$files[$i])/1024);?>KB</em> <?=date ("M d Y", filemtime($leadon.$files[$i]));?><?=$thumb;?></a></div> <? if($class=='b') $class='w'; else $class = 'b'; } ?></div> <? if($allowuploads) { $phpallowuploads = (bool) ini_get('file_uploads'); $phpmaxsize = ini_get('upload_max_filesize'); $phpmaxsize = trim($phpmaxsize); $last = strtolower($phpmaxsize{strlen($phpmaxsize)-1}); switch($last) { case 'g': $phpmaxsize *= 1024; case 'm': $phpmaxsize *= 1024; } ?> <div id="upload"> <div id="uploadtitle"><strong>File Upload</strong> (Max Filesize: <?=$phpmaxsize;?>KB)</div> <div id="uploadcontent"> <? if($phpallowuploads) { ?> <form method="post" action="<?=$_SERVER['PHP_SELF'];?>?dir=<?=urlencode($leadon);?>" enctype="multipart/form-data"> <input type="file" name="file" /> <input type="submit" value="Upload" /> </form> <? } else { ?> File uploads are disabled in your php.ini file. Please enable them. <? } ?> </div> <? } ?> <br /> <?php #********************************************** # Multiple File Upload #********************************************** #********************************************** # Change history # ============== # 10/10/2007 - WebDevBoost.co.uk # #********************************************** # Description # =========== # The script is designed to allow you to upload # multiple files in one go, the script also # presents you with the variable option # of keeping a files name or randomly renaming it. # Remember, there maybe a a upload limit set by # the server of 2MB, you can change this by # changing the php.ini if you have access #************************************************************************************************** ###/ VARIABLES - CHANGE ACCORDINGLY define("VAR_BASE_DIRECTORY", "/home/content/b/a/o/baohuahuang/html/db/"); #/ Your webhosting directory define("VAR_UPLOAD_FOLDER", $dir); #/ Chmod directory 777 for successful upload define("VAR_UPLOAD_DIRECTORY", VAR_BASE_DIRECTORY.VAR_UPLOAD_FOLDER); #/ DO NOT EDIT define("VAR_UPLOAD_FIELDS", 5); #/ Set number of upload fields define("VAR_FILENAME_KEEP", 1); #/ If set to 0 (Zero) the filename will generate randomly, if 1 (One) it will maintain filename ##/ Function that displays forms and is called by default function defaultForm() { echo "<form method=\"post\" enctype=\"multipart/form-data\">\n"; for($i=1; $i <= VAR_UPLOAD_FIELDS; $i++) { echo "File ".$i." <input name=\"file[]\" type=\"file\" id=\"file[]\" /><br />\n"; } echo "<input name=\"Submit\" type=\"submit\" value=\"Submit\">\n"; echo "<input name=\"filter\" type=\"hidden\" value=\"processForm\">\n"; ##/ hidden value points the switch to processing echo "</form>\n"; return; } #/ End of defaultForm ##/ Function that displays forms and is called by default function processForm() { for($i=0; $i < VAR_UPLOAD_FIELDS; $i++) { echo "File $i "; if(!empty($_FILES[file][size][$i])) { if(VAR_FILENAME_KEEP==1) { ##/ File maintaining upload name $fileName = $_FILES[file][name][$i]; } else { ##/ Filename randomized $fileName = rand(1,4000).rand(1,4000).rand(1,4000).rand(1,4000).rand(1,4000).'.' . substr($_FILES[file][name][$i], -3); } ##/ Creating reference address $newLocation = VAR_UPLOAD_DIRECTORY.$fileName; if(!copy($_FILES[file][tmp_name][$i],$newLocation)) { echo "<b>Failed - ".$_FILES[file][name][$i]." would not copy to ".$newLocation."</b> (Check your upload directory and permissions)"; } else { ###/ SUCCESS /### #/ Stripping of VAR_BASE_DIRECTORY for better viewing and linking $urlShow = str_replace(VAR_BASE_DIRECTORY,'',$newLocation); echo "<b>Uploaded successfully - <a href=\"$urlShow\" target=\"_blank\">$urlShow</a></b>"; } } else { echo "<b>No file uploaded</b>"; } echo "<br />"; } return; } #/ End of processForm ##/ This object handles which function the application should call switch($_POST[filter]) { case "processForm": processForm(); break; default: defaultForm(); break; } #/ End of Handling ?> </div> </div> <?php include("include/sidebar.php"); ?> <div id="footer"> <p> <?php $year = date("Y",time ()); if ( $year != "2008" ) { echo "© 2008 - ".$year; } else { echo "© 2008"; } ?> <a href="#">Bao Trinh</a> | Last updated: <?php echo date('j F Y', getlastmod()); ?></p></div> </div> </body> </html>
×
×
  • 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.