Jump to content

DieSucker

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by DieSucker

  1. So I have this code for resizing images I have in a directory to another directory and resizing the images to 68x68. Only problem is the resizing is killing the image quality SO my quetsion is how I can I up hte image quality?? [code]<? $new_w = 68; $cfg_fullsizepics_path = "./"; $cfg_thumb_path = "thumb"; $filepath = "./"; $dir = dir($filepath); while($entry=$dir->read()) {     if($entry == "." || $entry == "..") {         continue;     }     $fp = @fopen("$filepath/$entry","r"); $photo_filename = "$entry"; $image_stats = GetImageSize($cfg_fullsizepics_path."/".$entry); $imagewidth = $image_stats[0]; $imageheight = $image_stats[1]; $img_type = $image_stats[2]; $ratio = ($imagewidth / $new_w); $new_h = round($imageheight / $ratio); if (!file_exists($cfg_thumb_path."/".$entry))  { if ($img_type=="2") { $src_img = imagecreatefromjpeg($cfg_fullsizepics_path."/".$entry); $dst_img = imagecreate($new_w,$new_h); imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img)); imagejpeg($dst_img, "$cfg_thumb_path"."/$entry"); } elseif  ($img_type=="3") { $dst_img=ImageCreate($new_w,$new_h); $src_img=ImageCreateFrompng($cfg_fullsizepics_path."/".$entry); ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); Imagepng($dst_img, "$cfg_thumb_path"."/$entry"); } elseif  ($img_type=="1") { $cfg_thumb_url=$cfg_fullsizepics_url; } }   echo "$entry";   echo " ";   } ?> [/code]
  2. Anyone got any clue on this?
  3. only bad thing with that is the images are 128x128 and I need them to be like 68x68, so I gota use the image width tag
  4. OK so I have tried numerous ways to get this to wkr but I sure as hell can't get it to I have tried DIV technique but nope [code]<?php echo "<table width='100%' border=0 cellspacing=0 cellpadding=0 class=sample>"."<tr>"."<td>"."<img src=http://www.evilbunnytracks.net/btrecords/images/$testing.jpg width=68>"."<DIV STYLE=position:left; top:250px; left:20px; width:200px; height:25px>"."This is a test"."</td>"."</tr>"."</table>"."</DIV>"; ?>[/code] u can see wha its doing @ http://www.evilbunnytracks.net/index2.php if anyone can help me ge the TEXT INSIDE the image i would e greatly appricated
  5. you da man cunoodle2 , thanks so much
  6. OK so i have written this script [code]$d = dir("./"); while(false !== ($e = $d->read())) if ($e != "." && $e != ".." && $e !="index.php") {       $insertFILE = "insert into information2(map_name, map_size) values ('" . $e . "', '" . formatbytes(filesize($e)) . "')";   $resultFILE = mysql_query($insertFILE);     echo $e . "\n" . formatbytes(filesize($e)) . "\n" . '<br/>';   } ?>[/code] so then the database will look like [code]       CTF-BT-YouAreLOL.zip 389 kB       CTF-BT-YouAreOnCoke.zip 5.38 MB       CTF-BT-Zwielicht-2.zip 546 kB       CTF-BT-Zyron.zip 758 kB [/code] I anna read the list into a table, but the table needs to go 3 entries across, doesn't mater how far it goes down, each cell it include the file name and size ie CTF-BT-YouAreLOL.zip(389 kB) I just dont know how to get it to 3 across then end the tr any help?
  7. ne help on this?? the database shows everything correctly bu twhen i output it it doubles
  8. ok so I tried using the code that foster proved for me to output the DB, but it isnt working to well, its repeating itself every so often and I dunno wth it is doing this here is the page http://www.evilbunnytracks.net/btrecords/107a.php and here is the code now [code]<? ////////////////mySQL Info/////////// $DBhost = "localhost"; $DBuser = "btrecords"; $DBpass = "*****"; $DBName = "btrecords"; mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database"); @mysql_select_db("$DBName") or die("Unable to select database $DBName"); ////////////////////////// //////////////////Creating Tables for recs $drop = 'DROP TABLE IF EXISTS `information`'; mysql_query( $drop ); $sql = "CREATE TABLE information( player_name CHAR(60) NOT NULL, map_name CHAR(60) NOT NULL, map_time CHAR(60) NOT NULL, rec_date CHAR(30) NOT NULL )"; $res = mysql_query( $sql ); /////////////////Server Info $ftp_server = "65.99.211.107"; $ftp_user = "211.107"; $ftp_pass = "*****"; $local_file = 'records.txt'; $server_file = 'BTRecords.ini'; // set up a connection or die $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); // try to login ftp_login($conn_id, $ftp_user, $ftp_pass); ftp_chdir($conn_id, "System"); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) // close the connection ftp_close($conn_id); ///////////////////////// function duration($timestamp) { $years=floor($timestamp / (60*60*24*365)); $timestamp%=60*60*24*365; $weeks=floor($timestamp / (60*60*24*7)); $timestamp%=60*60*24*7; $days=floor($timestamp / (60*60*24)); $timestamp%=60*60*24;     $hrs=floor($timestamp / (60*60)); $timestamp%=60*60;     $mins=floor($timestamp / 60); $secs=$timestamp % 60;     $str=""; if ($years >= 1) { $str.="{$years} years "; }   if ($weeks >= 1) { $str.="{$weeks} weeks "; }   if ($days >= 1) { $str.="{$days} days "; }   if ($hrs >= 1) { $str.="{$hrs} hours "; }   if ($mins >= 1) { $str.="{$mins}"; }   // Checks if there are only seconds.   if ($years < 1 && $weeks < 1 && $days < 1 && $hrs < 1 && $mins < 1)       {$str = "0";}   if ($secs >= 10) { $str.=":{$secs}"; }   if ($secs < 10) { $str.=":0{$secs}"; }     return $str; } //////////////////////// function cutline($filename,$line_no=-1) {  $strip_return=FALSE;  $data=file("records.txt");  $pipe=fopen("records.txt",'w');  $size=count($data);  if($line_no==-1) $skip=$size-1;  else $skip=$line_no-1;  for($line=0;$line<$size;$line++)  if($line!=$skip)  fputs($pipe,$data[$line]);  else  $strip_return=TRUE;  return $strip_return;  }  cutline('records.txt',1); // deletes line 6 in foo.txt //open records file and parse $handle = @fopen("records.txt", "r"); $rectxt1 = "recs.txt"; $handle2 = @fopen("recs.txt", "w+"); $begintable = "<table width=100% border=0 cellspacing=0 cellpadding=0 class=sample>"."<tr>"."<th scope=col>"."<font size=2 color=#FFFFFF>"."When"."</th>"."<th scope=col>"."<font size=2 color=#FFFFFF>"."Map"."</th>"."<th scope=col>"."<font size=2 color=#FFFFFF>"."Who"."</th>"."<th scope=col>"."<font size=2 color=#FFFFFF>"."Time"."</th>"."</tr>"; $endtable = "</table>"; fwrite($handle2, $begintable); if ($handle) {   while (!feof($handle)) {       $buffer = fgets($handle, 4096);   $patterns = '/Record/';   $replacement = '';   $buffer = preg_replace($patterns, $replacement, $buffer);   list($buffer2, $buffer3, $buffer4, $buffer5, $buffer6) = split("]=",$buffer);     list($buffer2, $buffer3, $buffer4, $buffer5, $buffer6) = split(" ",$buffer3);   list($rec1, $rec2, $rec4, $rec14) = split("\t",$buffer2);   list($rec5, $rec6, $rec7, $rec15) = split("\t",$buffer3);   list($rec8, $rec9, $rec10, $rec16) = split("\t",$buffer4);   list($rec11, $rec12, $rec13, $rec17) = split("\t",$buffer5);   $poop = (2000-$rec2);   $poop1 = (2000-$rec6);   $poop2 = (2000-$rec9);   $poop3 = (2000-$rec12);   $time = duration($poop);     $time1 = duration($poop1); $time2 = duration($poop2);   $time3 = duration($poop3);     $rec4 = addslashes($rec4);   $rec7 = addslashes($rec7);   $rec5 = addslashes($rec5);   $rec8 = addslashes($rec8);   $rec11 = addslashes($rec11);   $rec13 = addslashes($rec13);   $rec10 = addslashes($rec10);   //////////////////       $insertBTR = "insert into information(player_name, map_name, map_time, rec_date) values ('" . $rec4 . "', '" . $rec1 . "', '" . $time . "', '" . date("m/d/Y", $rec14) . "')";   $insertBTR1 = "insert into information(player_name, map_name, map_time, rec_date) values ('" . $rec7 . "', '" . $rec5 . "', '" . $time1 . "', '" . date("m/d/Y", $rec15) . "')";   $insertBTR2 = "insert into information(player_name, map_name, map_time, rec_date) values ('" . $rec10 . "', '" . $rec8 . "', '" . $time2 . "', '" . date("m/d/Y", $rec16) . "')";   $insertBTR3 = "insert into information(player_name, map_name, map_time, rec_date) values ('" . $rec13 . "', '" . $rec11 . "', '" . $time2 . "', '" . date("m/d/Y", $rec17) . "')"; if($rec4 != NULL) { $resultBTR = mysql_query($insertBTR); } if($rec7 != NULL) { $resultBTR = mysql_query($insertBTR1); } if($rec10 != NULL) { $resultBTR = mysql_query($insertBTR2); } if($rec13 != NULL) { $resultBTR = mysql_query($insertBTR3); } if (!$resultBTR){ print mysql_error(); exit; } $selectBTR = 'SELECT * FROM `information` LIMIT 0, 30 '; $resultBTR = mysql_query($selectBTR); echo "<table>\n"; while($rowBTR = mysql_fetch_array($resultBTR)){   echo "  <tr>\n";   echo "    <td>" . $rowBTR[rec_date] . "</td>\n";   echo "    <td>" . $rowBTR[map_name] . "</td>\n";   echo "    <td>" . $rowBTR[player_name] . "</td>\n";   echo "    <td>" . $rowBTR[map_time] . "</td>\n";   echo "  </tr>\n"; } echo "</table>\n"; //////////////////////// } } ?> [/code]
  9. I am coming up with an error though, and I am prety sure I know why, I just dunno how to fix it, the reason for the error would be the players name its trying to input "DoN*']['r0p$" and the error i get is Quote You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ']['r0p$ ', 'CTF-BT-PsychoJungle', '4:16', '1150447172')' at line 1 I have my table set up as Code: $sql = "CREATE TABLE information( player_name CHAR(30) NOT NULL, map_name CHAR(60) NOT NULL, map_time CHAR(60) NOT NULL, rec_date CHAR(30) NOT NULL )"; any help would be greatful
  10. I am coming up with an error though, and I am prety sure I know why, I just dunno how to fix it, the reason for the error would be the players name its trying to input "DoN*']['r0p$" and the error i get is Quote You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ']['r0p$ ', 'CTF-BT-PsychoJungle', '4:16', '1150447172')' at line 1 I have my table set up as Code: $sql = "CREATE TABLE information( player_name CHAR(30) NOT NULL, map_name CHAR(60) NOT NULL, map_time CHAR(60) NOT NULL, rec_date CHAR(30) NOT NULL )"; any help would be greatful
  11. ok so yeah I have a database setup, btrecords, and a user and pass, this is where I get lost so I need four values, "date" "user" "map" "time_completed" per line, so i dunno how to do it, just give me a base script on inserting these into tables and i think i can figure it out. only thing is I need the output to look like http://www.evilbunnytracks.net/btrecords/107.php which is how the script outputs now
  12. someone's gotta be able to help:P
  13. So I wrote a PHP script, works fine, but I would rather store the output in a mySQL database, rather then in another text file. The script works but I just need some help,first seeing if it is possible and secondly the output into html So here is the script [code]<? /////////////////Server Info $ftp_server = "****" $ftp_user = "*****" $ftp_pass = "*****" $local_file = 'records.txt'; $server_file = 'BTRecords.ini'; // set up a connection or die $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); // try to login ftp_login($conn_id, $ftp_user, $ftp_pass); ftp_chdir($conn_id, "System"); // try to download $server_file and save to $local_file if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) // close the connection ftp_close($conn_id); /////////////////////////DURATION FUNCTION function duration($timestamp) { $years=floor($timestamp / (60*60*24*365)); $timestamp%=60*60*24*365; $weeks=floor($timestamp / (60*60*24*7)); $timestamp%=60*60*24*7; $days=floor($timestamp / (60*60*24)); $timestamp%=60*60*24;     $hrs=floor($timestamp / (60*60)); $timestamp%=60*60;     $mins=floor($timestamp / 60); $secs=$timestamp % 60;     $str=""; if ($years >= 1) { $str.="{$years} years "; }   if ($weeks >= 1) { $str.="{$weeks} weeks "; }   if ($days >= 1) { $str.="{$days} days "; }   if ($hrs >= 1) { $str.="{$hrs} hours "; }   if ($mins >= 1) { $str.="{$mins}"; }   // Checks if there are only seconds.   if ($years < 1 && $weeks < 1 && $days < 1 && $hrs < 1 && $mins < 1)       {$str = "0";}   if ($secs >= 10) { $str.=":{$secs}"; }   if ($secs < 10) { $str.=":0{$secs}"; }     return $str; } ////////////////////////Removes Firstline from $local_file function cutline($filename,$line_no=-1) {  $strip_return=FALSE;  $data=file("records.txt");  $pipe=fopen("records.txt",'w');  $size=count($data);  if($line_no==-1) $skip=$size-1;  else $skip=$line_no-1;  for($line=0;$line<$size;$line++)  if($line!=$skip)  fputs($pipe,$data[$line]);  else  $strip_return=TRUE;  return $strip_return;  }  cutline('records.txt',1); // deletes line 6 in foo.txt //open records file and parse $handle = @fopen("records.txt", "r"); $rectxt1 = "recs.txt"; $handle2 = @fopen("recs.txt", "w+"); $begintable = "<table width=100% border=0 cellspacing=0 cellpadding=0 class=sample>"."<tr>"."<th scope=col>"."<font size=2 color=#FFFFFF>"."When"."</th>"."<th scope=col>"."<font size=2 color=#FFFFFF>"."Map"."</th>"."<th scope=col>"."<font size=2 color=#FFFFFF>"."Who"."</th>"."<th scope=col>"."<font size=2 color=#FFFFFF>"."Time"."</th>"."</tr>"; $endtable = "</table>"; fwrite($handle2, $begintable); if ($handle) {   while (!feof($handle)) {       $buffer = fgets($handle, 4096);   $patterns = '/Record/';   $replacement = '';   $buffer = preg_replace($patterns, $replacement, $buffer);   list($buffer2, $buffer3, $buffer4, $buffer5, $buffer6) = split("]=",$buffer);     list($buffer2, $buffer3, $buffer4, $buffer5, $buffer6) = split(" ",$buffer3);   list($rec1, $rec2, $rec4, $rec14) = split("\t",$buffer2);   list($rec5, $rec6, $rec7, $rec15) = split("\t",$buffer3);   list($rec8, $rec9, $rec10, $rec16) = split("\t",$buffer4);   list($rec11, $rec12, $rec13, $rec17) = split("\t",$buffer5);   $poop = (2000-$rec2);   $poop1 = (2000-$rec6);   $poop2 = (2000-$rec9);   $poop3 = (2000-$rec12);   $time = $poop;     $time1 = $poop1; $time2 = $poop2;   $time3 = $poop3; if (strlen($rec5) >= 1) { $re1 = "<tr>"."<td>"."<font size=2 color=#FFFFFF>".date("m/d/Y", $rec14)."</td>"."<td>"."<img src=/btrecords/images/$rec1.jpg width=40 heigth=40>"."<font size=2 color=#FFFFFF>".$rec1."<td>"."<font size=2 color=#FFFFFF>".$rec4."</td>"."<td>"."<font size=3 color=#597B96>"."<b>".duration($time)."</b>"."</td>"."</tr>"; fwrite($handle2, $re1); }   if (strlen($rec5) >= 3) { $re2 = "<tr>"."<td>"."<font size=2 color=#FFFFFF>".date("m/d/Y", $rec15)."</td>"."<td>"."<img src=/btrecords/images/$rec5.jpg width=40 heigth=40>"."<font size=2 color=#FFFFFF>".$rec5."<td>"."<font size=2 color=#FFFFFF>".$rec7."</td>"."<td>"."<font size=3 color=#597B96>"."<b>".duration($time1)."</b>"."</td>"."</tr>"; fwrite($handle2, $re2); } if (strlen($rec8) >= 3) { $re3 = "<tr>"."<td>"."<font size=2 color=#FFFFFF>".date("m/d/Y", $rec16)."</td>"."<td>"."<img src=/btrecords/images/$rec8.jpg width=40 heigth=40>"."<font size=2 color=#FFFFFF>".$rec8."<td>"."<font size=2 color=#FFFFFF>".$rec10."</td>"."<td>"."<font size=3 color=#597B96>"."<b>".duration($time2)."</b>"."</td>"."</tr>"; fwrite($handle2, $re3); } if (strlen($rec11) >= 3) { $re4 = "<tr>"."<td>"."<font size=2 color=#FFFFFF>".date("m/d/Y", $rec17)."</td>"."<td>"."<img src=/btrecords/images/$rec11.jpg width=40 heigth=40>"."<font size=2 color=#FFFFFF>".$rec11."<td>"."<font size=2 color=#FFFFFF>".$rec13."</td>"."<td>"."<font size=3 color=#597B96>"."<b>".duration($time3)."</b>"."</td>"."</tr>"; fwrite($handle2, $re4); }   }   fwrite($handle2, $endtable);       fclose($handle);   fclose($handle2); } [/code] What I would like is to be able to get each out put above to go to the database then output it  with pagination and a search function. I can handle the search function and I think i can do the pagination feature, just need help with the mySQL Thanks all ;D
  14. I have output coming from a readfile("$var") any way that i can get it sorted from like 25 lines ?
  15. [!--quoteo(post=388464:date=Jun 27 2006, 06:58 AM:name=hvle)--][div class=\'quotetop\']QUOTE(hvle @ Jun 27 2006, 06:58 AM) [snapback]388464[/snapback][/div][div class=\'quotemain\'][!--quotec--] what do you mean by organize all this by unixdate code? [/quote] well organize by date, each unixdate code has a date associated with it ie 6/26/2006(date(mdY)) so is there anyway to get the most recent dates on top of the list and later ones towards the bottom
  16. ok so say that I got a txt file with a bunch of lines like the one below [code] Record[0]=CTF-BT-Athletic1000    1955    trs|McN                      1150150175 CTF-BT-Lego    1908    Hazen_Blazen                 1150285451 CTF-BT-w00tw00t_fix    1964    jumper                       1150200327 CTF-BT-andACTION    1989    trs|DieSucker                1150749074[/code] and then I am spliting each line first at the "=" so then i have just [code] CTF-BT-Athletic1000    1955    trs|McN                      1150150175 CTF-BT-Lego    1908    Hazen_Blazen                 1150285451 CTF-BT-w00tw00t_fix    1964    jumper                       1150200327 CTF-BT-andACTION    1989    trs|DieSucker                1150749074[/code] then spliting it at "\t" so basically i end up with [code] CTF-BT-Athletic1000 1955 trs|MCN 1150150175 CTF-BT-Lego 1908 Hazen_Blazen 1150285451 [/code] so is there anyway to organize all his by unixdate code?
  17. thanks alot, forgot the $ in min and hours, but got it workin, thanks alot :D
  18. So i have this duration code [code] function duration($timestamp) {          $years=floor($timestamp / (60*60*24*365));     $timestamp%=60*60*24*365;          $weeks=floor($timestamp / (60*60*24*7));     $timestamp%=60*60*24*7;          $days=floor($timestamp / (60*60*24));     $timestamp%=60*60*24;          $hrs=floor($timestamp / (60*60));     $timestamp%=60*60;          $mins=floor($timestamp / 60);     $secs=$timestamp % 60;       $str="";    if ($years >= 1) { $str.="{$years} years "; }    if ($weeks >= 1) { $str.="{$weeks} weeks "; }    if ($days >= 1) { $str.="{$days} days "; }    if ($hrs >= 1) { $str.="{$hrs} hours "; }    if ($mins >= 1) { $str.="{$mins}"; }    if ($secs >= 10) { $str.=":{$secs}"; }    if ($secs < 10) { $str.=":0{$secs}"; }       return $str; }[/code] which I am using for unixdate. Right now the out put would be like "1:45" and for just seconds it would output ":45" my problem is how do I get it to add "00" before the colon if the duration is just seconds Any ideas?
  19. any help from anyone would be greatly appreciated
  20. Thanks for the reply shorty, the output is perfectly ok, cause the file from where I am pulling the names a blank line is 2 long accrding to sterlen, my problem is getting the output in varibals so that way I can get it to be called to in a tpl file like {USERNAME] {MAP} ect you can see the output @ [a href=\"http://www.evilbunnytracks.net/records\" target=\"_blank\"]http://www.evilbunnytracks.net/records[/a] but what I would like is for it to output into a 4colum table in a template like the base one @ [a href=\"http://www.evilbunnytracks.net\" target=\"_blank\"]http://www.evilbunnytracks.net[/a] (where the updates are is where the tables would go) i can make the template fine, just can't figure out how to set them to varibals to call upon if u can help and dont wanna reply here u can MSN me @ diesucker@evilbunnytracks.net
  21. [!--quoteo(post=386735:date=Jun 21 2006, 11:58 PM:name=legohead6)--][div class=\'quotetop\']QUOTE(legohead6 @ Jun 21 2006, 11:58 PM) [snapback]386735[/snapback][/div][div class=\'quotemain\'][!--quotec--] ok..i am trying to figure out a way to replace swears from my forum into **** what happens is i insert into my database the word and replacement(works fine) and then im trying to use str_replace() to do the rest but its only replacing the last word like that(if there is more then one!, with one it works fine!) I have made a test sentance but i took out the words to post it here and replaced with (swear) heres the code! $[code]lang = array(); $query = "SELECT * FROM words"; $result = mysql_query($query); while($row = mysql_fetch_row($result)){ $lang[$row[1]] = "$row[2]"; } foreach($lang as $id => $value){ $par2 = str_replace("$id","$value","What the (swear1) (swear2)"); } echo "$par2";[/code] Please help! [/quote] maybe try preg_replace [a href=\"http://us2.php.net/manual/en/function.preg-replace.php\" target=\"_blank\"]http://us2.php.net/manual/en/function.preg-replace.php[/a]
  22. So I am also new to this PHP stuff, but I have written a script and need help with the output the code below is sloopy i know, but best i can do. So I am also new to this PHP stuff, but I have written a script and need help with the output the code below is sloopy i know, but best i can do. script here, too big to put on here [a href=\"http://www.evilbunnytracks.net/recs.txt\" target=\"_blank\"]PHP Script[/a] The last few lines are the output. I actually would like to get these to output on a tpl file that I have but i am totally lost when it comes to the Template class and such. If anyone can help I know this will take alot of work but it would be much appreciated and i will give credit for help on script he last few lines are the output. I actually would like to get these to output on a tpl file that I have but i am totally lost when it comes to the Template class and such. If anyone can help I know this will take alot of work but it would be much appreciated and i will give credit for help on script
×
×
  • 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.