Jump to content

kathas

Members
  • Posts

    113
  • Joined

  • Last visited

Everything posted by kathas

  1. You could also tell us the output of the conversion. bin2hex(mb_convert_encoding("^à@kol","ucs-2","utf-8")) // 005e00e00040006b006f006c which is correct ucs-2 big endian.
  2. Actually I think the best way to solve this problem is through template inheritance. Template inheritance allows you to extend templates and replace parts of the parent's content. You can see a very good example in Twig's documentation. It is not necessary though to use twig or any template engine, you can implement similar behavior in plain php templates (although not as good looking). For example one could use anonymous functions to achieve similar block based inheritance. --- Template base.php ---- <?php $main = function($head,$body) { ?> <html> <head> <?php $head() ?> </head> <body> <?php $body() ?> </body> </html> <?php } ?> <?php $head = function () { ?> <style> ... </style> <?php } ?> <?php $body = function () { ?> ... body ... <?php } ?> --- Template derived.php --- <?php include ('base.php'); ?> <?php $head = function () use($head) { ?> <?php $head(); ?> <script> ... </script> <?php } ?> <?php $main($head,$body); ?>
  3. Chances are the input string is not utf-8. I would suggest the following print_r( mb_list_encodings() ); and check if ucs-2 is in the list. If it is then probably the input string is not utf-8.
  4. $n = count($all_question)-1; $answers = array(); $answer = array_fill(0,$n,1); $change = $n; while ($change > 0 || $answer[$change]<$all_question[$change]->answer_count) { if ($answer[$change]<$all_question[$change]->answer_count) { $answer[$change]++; $answers[] = implode($answer,','); $change = $n; } else { $answer[$change]=1; $change--; } } I tested it with this output. The first question has 3 answers second has only 1 third 2 4th 3 Array ( [0] => 1,1,1,1 [1] => 1,1,1,2 [2] => 1,1,1,3 [3] => 1,1,2,1 [4] => 1,1,2,2 [5] => 1,1,2,3 [6] => 2,1,1,1 [7] => 2,1,1,2 [8] => 2,1,1,3 [9] => 2,1,2,1 [10] => 2,1,2,2 [11] => 2,1,2,3 [12] => 3,1,1,1 [13] => 3,1,1,2 [14] => 3,1,1,3 [15] => 3,1,2,1 [16] => 3,1,2,2 [17] => 3,1,2,3 )
  5. Correct me if I understood wrong. you need to cover all the cameras with the minimum amount of dvrs ??? if so a loop will do // $qty your variable $dvrs = array(16=>0,8=>0,4=>0); while ($qty > 0) { if ($qty > { $dvr[16]++; $qty-=16; } else if ($qty > 4) { $dvr[8]++; $qty-=8; } else { $dvr[4]++; $qty-=4; } }
  6. How about having three different sections Most Popular - 5 entries New - 5 entries Random - 5 entries So you give a chance for clicks to every result. But seriously i think that this shouldn't be in the Math Help
  7. // one way $string = trim(substr($string, strpos($string,"Dog")+strlen("Dog") , strpos($string,"Date Entered") - strpos($string,"Dog")+strlen("Dog") )); // better way $x = strpos($string,"Dog"); if ($x!==FALSE) { $y = strpos($string,"Date Entered"); if ($y!==FALSE && $y>$x) { $x += strlen("Dog"); $string = trim(substr($string, $x , $y-$x )); } }
  8. What do you think of the site's structure? Sorry i haven't added the English version so i don't expect a lot of comments but i would really appreciate any comment you can think of (colors, images, font, anything) . http://www.skaloeisagogiki.gr/
  9. hey richard we have no idea what the $db object is, now if we take your word for the fact that it works correctly why do you create another object for the update function...? but i guess that is how this object works... now after all these that may not be wrong where do you submit the data to the db update is used to alter already existing records in the db...
  10. $row = $db->sql_fetchrow($query) should be $row = $db->sql_fetchrow($result_table2)
  11. could you try the code below? i opened the file in binary mode and added the length parameter in fwrite so that it will ignore the magic_quotes_runtime configuration option and no slashes will be stripped. <?php function void_case_statement($search_for,$replace_term,$filename){ $search_for = "\"$search_for\""; $replace_term = "\"$replace_term\""; //echo "debug $search_for,$replace_term,$filename<br>"; //read contents and add new text $fh = fopen($filename, 'rb')or die("FAILURE : can't open file"); $content = fread( $fh, filesize( $filename ) ); fclose($fh); //echo $content; $new_content = str_replace($search_for,$replace_term,$content); //echo $new_content; //write new contents to file $fh = fopen($filename, 'wb') or die("FAILURE : can't open file"); //echo $new_content; fwrite($fh, $new_content,strlen($new_content)); fclose($fh); } ?>
  12. There are security issues: XSS: http://www.blconline.co.uk/whois/index.blc?domain=%22%3E%3Cscript%3Ealert%286%29%3C%2Fscript%3E&lookup=%3E%3E i didn't search for more... submit a post in the beta test section if you want your site checked more thourouhly
  13. i would try that too $mail->IsSMTP(TRUE); but i dont think that anything will change... check php mailers website for more help phpmailer.sourceforge.net/
  14. Tried to register as ' with pass ' and full path disclosure plus many other things like i can't think of what would userpwd.txt hold...? (too bad permission is denied...) Warning: fopen(userpwd.txt) [function.fopen]: failed to open stream: Permission denied in /home/users/uks51756/html/games4uonline.com/sites/login/common.php on line 11 Warning: rewind(): supplied argument is not a valid stream resource in /home/users/uks51756/html/games4uonline.com/sites/login/common.php on line 12 Warning: feof(): supplied argument is not a valid stream resource in /home/users/uks51756/html/games4uonline.com/sites/login/common.php on line 14 Warning: fgets(): supplied argument is not a valid stream resource in /home/users/uks51756/html/games4uonline.com/sites/login/common.php on line 15 Warning: feof(): supplied argument is not a valid stream resource in /home/users/uks51756/html/games4uonline.com/sites/login/common.php on line 14 Warning: fgets(): supplied argument is not a valid stream resource in /home/users/uks51756/html/games4uonline.com/sites/login/common.php on line 15 Warning: feof(): supplied argument is not a valid stream resource in /home/users/uks51756/html/games4uonline.com/sites/login/common.php on line 14 Warning: fgets(): supplied argument is not a valid stream resource in /home/users/uks51756/html/games4uonline.com/sites/login/common.php on line 15 and kept coming... on lines 14 - 15
  15. Hi there, I don't know my math (integrals are in the next semester) pal cause i haven't finished school yet but i believe you know yours... so i 've been here... That is how one calculates CMF. If you can calc the integral with php then you can cal CMF... (Although i have a feeling that this integral is supposed to give out a function since it is from minus infinity to x, which is not a calculable (scalar value) area, now can this integral be calculated with php???)
  16. as TEXT maybe ??? besides HTML is plain text.... but databases can actually store anything!!! it can store binary so it can store anything...
  17. I understood the problem before but i cant understand why it still does that... OK let's take the problem from the beginning... <?php $post = $row['post']; preg_match_all("/<(.*)>/", $post, $matches); $matches = $matches[0]; foreach ($matches as $tag) { str_replace($tag,"",$row['post']); } // now $row['post'] is tag free // i see you want each word in an array element so $words = explode(" ",$row['post']); // Let's spell check foreach ($words as $word) { $check = SmartnessCheckWord($word, $row['pid']); if(!$check){ //i.e. if it returns false (word is WRONG) $row['points'] = $row['points'] - 1; // replace word $word_rep = "<sp>".$word."</sp>"; // now replace the words str_replace($word,$word_rep,$post); } // $post is spell checked I havent tested the above code but the logic is correct... Check the regex syntax and everything... It must be right though
  18. Yeah it was just code to show the logic besides he wont be using this function anyway...
  19. Try out <?php function testfunction($a){global $$a;echo $$a['variable'];} // and i you dont need the global declaration for _GET testfunction('_GET'); //that will work of course you can use another var in your func to make it dynamic to check ex.: <?php function testfunction($a,$b=FALSE){global $$a;echo ($b) ? $$a[$b] : $$a;}
  20. Also to make sure that there is no duplicate entry of a specific field in your DB you could declare it as unique... See the DB manual... I have MySQL's linked here ( It has a lot of info but you can find what you need if you look at COLUMN DEFINITIONS )
  21. You could keep the post in another variable and then spellcheck this one... If it finds an error replace it in the other variable... Then use the other variable that is spellchecked and has all the html tags untouched Example.: <?php /* get rid of all the words that are inside HTML tags, while still keeping each word's offset */ $post = $row['post']; // !!Check that line !! // preg_match_all("/[<>]/", $row['post'], $matched, PREG_OFFSET_CAPTURE); $matched = $matched[0]; $opened = array(); foreach($matched as $tag){ if($tag[0] == "<"){ $opened[] = $tag[1]; } else { if(count($opened) > 0){ foreach ($words as $off => $word){ if($off > $opened[count($opened)-1] && $off < $tag[1]){ unset($words[$off]); } if($word == "" || $word == " "){ unset($words[$off]); } } array_pop($opened); } } } /* Now we are left with an array, $words which contains each word and its offset i.e. $words[offset] = word */ /* Spell check each word! */ $i = 0; foreach($words as $off => $word){ $check = SmartnessCheckWord($word, $row['pid']); if(!$check){ //i.e. if it returns false (word is WRONG) $row['points'] = $row['points'] - 1; // replace word $words[$off] = "<sp>".$word."</sp>"; //since you have the wrong word you don't need to replace it // using substr_replace but str_replace instead // so use sth like $post = str_replace($word,"whatever you replace it with",$post); // $post is the assigned var see top //$row['post'] = substr_replace($row['post'], $words[$off], $off+(9*$i), strlen($word)); $i++; } }
  22. you should check the ord() function and the dechex() check them in the manual...
  23. where do you want to pass the info from? If it is the parent page then JavaScript! If it is something else then consider the cookies/sessions/forms methods...
  24. SQL injection: http://www.deanschs.co.uk/controller.php?do=get&mode=showindex&id=3&gid=1234%20or%201=1 http://www.deanschs.co.uk/controller.php?do=get&mode=showindex&id=3&gid= SQL injection: http://www.deanschs.co.uk/controller.php?do=get&mode=showindex&id=' http://www.deanschs.co.uk/controller.php?do=get&mode=showindex&id=1 or 1=1 Full path disclosure + i can include any file on your server (Big hole): http://www.deanschs.co.uk/controller.php?do=./../&mode=index&id=1 Delete this file: http://www.deanschs.co.uk/test.php Good way to DoS the site: http://www.deanschs.co.uk/controller.php?do=account&mode=login
×
×
  • 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.