kathas
Members-
Posts
113 -
Joined
-
Last visited
Contact Methods
-
Website URL
http://www.yourse.gr/
Profile Information
-
Gender
Not Telling
kathas's Achievements
Newbie (1/5)
0
Reputation
-
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.
-
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); ?>
-
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.
-
Math/Statistics - All possible combinations of a survey's answers :(
kathas replied to shlomikalfa's topic in PHP Coding Help
$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 ) -
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; } }
-
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
-
// 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 )); } }
-
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/
-
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...
-
$row = $db->sql_fetchrow($query) should be $row = $db->sql_fetchrow($result_table2)
-
Find and replace in text file - last characters missing
kathas replied to deanes02's topic in PHP Coding Help
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); } ?> -
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
-
[SOLVED] PHPMailer not using smtp information
kathas replied to severndigital's topic in PHP Coding Help
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/ -
[SOLVED] PHPMailer not using smtp information
kathas replied to severndigital's topic in PHP Coding Help
$mail->Mailer = "SMTP"; -
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