Jump to content

RobertP

Members
  • Posts

    287
  • Joined

  • Last visited

Everything posted by RobertP

  1. ok, i have it working correctly, here it is function unzip($file,$dir = null){ if(!is_readable($file)) return 'File \''.$file.'\' not found.'; if(!$dir) $dir = dirname($file); if(!is_dir($dir)) mkdir($dir,0755,true); $resource = zip_open($file); if(!is_resource($resource)) return 'File \''.$file.'\' is corrupt.'; while($entry = zip_read($resource)){ $size = zip_entry_filesize($entry); $name = zip_entry_name($entry); $unzipped = fopen($dir._DS.$name,'wb'); while($size>0){ $chunkSize = ($size>102400)?10240:$size; $size -= $chunkSize; $chunk = zip_entry_read($entry,$chunkSize); if($chunk!==false) fwrite($unzipped,$chunk); } fclose($unzipped); } return true; }
  2. IMO you should parse the xml and add to some kind of database. if you parse the xml for each page load, especially with the file size you are describing, you will lag like a mother fucker..
  3. I am create a function the will unzip a simple archive. My function works, but if the file is larger them 1KB, then it will 'cut' the file to 1KB. Here is my function. define('_DS',DIRECTORY_SEPARATOR); function unzip($file,$dir = null){ if(!is_readable($file)) return 'File \''.$file.'\' not found.'; if(!$dir) $dir = dirname($file); if(!is_dir($dir)) mkdir($dir,0755,true); $resource = zip_open($file); if(!is_resource($resource)) return 'File \''.$file.'\' is corrupt.'; while(($entry = zip_read($resource))!==false){ $entry_file = $dir._DS.zip_entry_name($entry); if($entry_size = zip_entry_filesize($entry)==0){ mkdir($entry_file); continue; } elseif(!is_dir($entry_dir = dirname($file))) mkdir($entry_dir,0755,true); file_put_contents($entry_file,zip_entry_read($entry,$entry_size)); } zip_close($resource); return true; }
  4. then use htmlspecialchars on the message just before inserting it into the database.
  5. use stripslashes when you echo out your message from your database
  6. first thing i noticed is that when i go to /profile.php and there is no id set, it should default to my id, example /profile.php?id=17 xss -> /profile.php?id=17 open directory http://facepalmz.comli.com/memberFiles/ http://facepalmz.comli.com/search.php not displaying anything
  7. RobertP

    BBcode

    regex will be your new best friend. ill give you a push in the right direction. $string = '[b]this[/b] is [b]a[/b] very [b]boldy[/b] message. [url=http://www.google.ca/]click here[/url] or this [url]http://www.google.ca/[/url]'; $bbc = array( 'b'=>array( 'expression'=>'/\[b\](.*?)\[\/b\]/', 'result'=>'<span style=font-weight:bold;>\\1</span>', ), 'url2'=>array( 'name'=>'Link', 'display_in_commands'=>false, 'expression'=>'/\[url=(.*?)\](.*?)\[\/url\]/', 'result'=>'<a href="\\1" target="_blank">\\2</a>', ), 'url'=>array( 'name'=>'Link', 'display_in_commands'=>true, 'expression'=>'/\[url\](.*?)\[\/url\]/', 'result'=>'<a href="\\1" target="_blank">\\1</a>', ) ); $expressions = $results = array(); foreach($bbc as $tag => $code){ $expressions[] = $code['expression']; $results[] = $code['result']; } $string = preg_replace($expressions,$results,$string); $string = str_replace("\r\n",'<br />',$string);//convert line breaks. echo $string; you should be able to extend with more tags now, enjoy
  8. i think your whole class will be needed for use to help
  9. 1. email address validation is missing, i created an account with email = 11 2. possible to register LINK while you are logged in. 3. xss (true) http://projecta.ulmb.com/news.php?NUID=11 4. possible to comment on posts that do not exist, and check the length of comments. http://projecta.ulmb.com/news.php?NUID=9999 5. on link http://projecta.ulmb.com/admin/ your refresh meta is not inside the head tag, so it dosnt work. well i am using chrome. <meta http-equiv="refresh" content="2 url='../'"/>
  10. just checking to see if this is the correct cache method to use? var serverCache = []; $(document).ready(function(){ $(".tooltip").tooltip({ bodyHandler:function(){ serverName = $(this).html(); if(serverCache[serverName]){ $("#tooltip").html(serverCache[serverName]); } else{ $("#tooltip").html("Loading..."); $.ajax({ url:"index.php?sub=serverInfo&server="+serverName, context:$("#tooltip"), success:function(data){ serverCache[serverName] = data; $("#tooltip").html(serverCache[serverName]); } }); } return ""; }, showURL:false, track:true, delay:0 }); });
  11. increase the width for that <td> example <td style="width:400px;">lots of data blablablalba blablalblalbla</td>
  12. i have this working thank you everyone for your help. function secondsToTime($seconds){ $hours = floor($seconds/(60*60)); $days = floor($hours/24); if($days>0) $hours = floor($hours-($days*24)); $weeks = floor($days/7); if($weeks>0) $days = floor($days-($weeks*7)); $months = floor($weeks/4); if($months>0) $weeks = floor($weeks-($months*4)); $years = floor($months/12); if($years>0) $months = floor($months-($years*12)); $minuteDivisor = $seconds%(60*60); $minutes = floor($minuteDivisor/60); $secondDivisor = $minuteDivisor%60; $seconds = ceil($secondDivisor); return array( 'y'=>(int)$years, 'n'=>(int)$months, 'w'=>(int)$weeks, 'd'=>(int)$days, 'h'=>(int)$hours, 'm'=>(int)$minutes, 's'=>(int)$seconds, ); } function timeToString($seconds){ $time = secondsToTime($seconds); if($time['y']>0) $string[] = $time['y'].' Years(s)'; if($time['n']>0) $string[] = $time['n'].' Months(s)'; if($time['w']>0) $string[] = $time['w'].' Weeks(s)'; if($time['d']>0) $string[] = $time['d'].' Day(s)'; if($time['h']>0) $string[] = $time['h'].' Hour(s)'; if($time['m']>0) $string[] = $time['m'].' Minute(s)'; if($time['s']>0) $string[] = $time['s'].' Second(s)'; return (count($string)>0) ? trim(implode(', ',$string)) : 'n/a'; }
  13. large numbers results in timeToString(9392042)=108 Day(s), 16 Hour(s), 155574 Minute(s), 2 Second(s)
  14. i am having an issue with a function, seems it dose work, but at the same time it does not. sad i need to turn a number, (seconds count) into a string. here is what i have function timeToString($seconds){ $seconds = ceil($seconds); $string = array(); $days = floor($seconds/60/60/24); $hours = floor(($seconds-($days*60*60*24))/60/60); $mins = floor(($seconds-($hours*60*60))/60); $secs = floor(($seconds-($mins*60+$hours*60*60))); if($days>0) $string[] = $days.' Day(s)'; if($hours>0) $string[] = $hours.' Hour(s)'; if($mins>0) $string[] = $mins.' Minute(s)'; if($secs>0) $string[] = $secs.' Second(s)'; return (count($string)>0) ? trim(implode(', ',$string)) : 'n/a'; } example: timeToString(12)=12 Second(s) timeToString(60)=1 Minute(s) timeToString(121)=2 Minute(s), 1 Second(s) timeToString(333)=5 Minute(s), 33 Second(s) timeToString(9999)=2 Hour(s), 46 Minute(s), 39 Second(s) timeToString(9392042)=108 Day(s), 16 Hour(s), 155574 Minute(s), 2 Second(s)
  15. http://vibe.l2earth.ca/index.php?style=mobile
  16. well you can put the log in form in your html, however you will need to use php (or if you know another server side language) to process your form. but we will need more information about your 'situation' before we can help you.
  17. so, i am looking for a list of user-agents / hosts / ip for popular spiders. i have found lists containing bots i have never herd of, i am interested in ones like google, yahoo, msn, alexa, ask jeeves, bing, you know .. anyone have one they know of?
  18. i believe this has been fixed, sorry seems i misunderstood the issue.
  19. http://php.net/manual/en/function.htmlspecialchars.php
  20. Thank you very much! All have been fixed along with a few other similar bugs.
  21. When i was asked- or decided to write a new web application, i almost always started out writing the exact code. So i have decided to create a cms i can use as a base for future projects. Current Features: - Module engine build for internal and external modules. - Advanced messaging system with message folders. - Member profiles with profile comments, views and much more. - dbConnector which can support multiple database types. - Advanced style engine. - Possible to change the language in which you view the site. (Currently only english files created) - File manager, BBC, smiley sets. So many more feature, this is what i have on-hand atm. The forums you seen is just a test module i have created to make sure everything is working correctly with the module system.
  22. The messaging folder system is working properly now.
×
×
  • 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.