Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
[SOLVED] How to strip our Accent Characters from text string?
Daniel0 replied to fatmikey's topic in PHP Coding Help
Ø and Å aren't O and A, but OE and AA. Same goes for their lower case variants. There is another problem with your function. If you for instance have the word "Æble" (Apple in Danish) it would be transliterated into Aeble. However, if it's in all caps, ÆBLE, then it would be AEBLE. Your function doesn't take that into account. You would have to figure the case of the other characters out as well. Otherwise you could end up with something like AeBLE or AEble, but of which look stupid. The same goes for all the other letters that stand for more than one letter. Niel and CV, it could be the case that he needs it in a URL (e.g. /user/Daniel). In that case he might only want the letters A-Z without any sort of diacritics. -
[SOLVED] Still get the same session id after I log out
Daniel0 replied to alluoshi's topic in PHP Coding Help
Try to do it the way the manual says. If it still does not work, there is, as the manual says, a function called session_regenerate_id. -
Just figured I would drop in to respond on some of the things mentioned. I rarely visit this board so I hadn't seen this topic yet. I'm not too concerned about that. As you see, it's either because you're validating CSS 3.0 attributes against the CSS 2.1 specification or it's the vendor specific implementation of these aforementioned attributes. Until there is full support amongst all browsers for CSS 3.0 there isn't much to do about it. You could apply it using Javascript, but you would still be using invalid CSS. The only difference would be that the validator can't see it. Therefore, you might as well just put them directly in the stylesheet. The extra whitespace doesn't really matter. It'll just say something like "give me 50 transparent pixels over the next 10 rows", so to speak. Yeah maybe. Many of the images are user uploaded though. They'll get cached anyway, so I think think it's much of a concern. I think these things should be handled on server level and not on application level. In that way you'll get everything (i.e. also static media like images, CSS and Javascript) and not just only the HTML. Unfortunately, that was not possible using Dave's host. On the dev site on my VPS I get all As using Yslow. The only penalty is for not using a CDN, but I don't count that as a problem for small sites. That file is so small I didn't bother with it. Using packer, you would only save about 200 byte, which I don't think is worth it for having to work on two copies. It could of course be packed on runtime, but the extra overhead doesn't outweigh the savings.
-
You can load the file as an array (one line per element) using file. To delete a line you can just delete its element, and to change a line you can iterate over the array until you find the one you need (if it's a large file then you probably do not want to do this as this kind of searching will run in linear time). You can then join them together. You could also use regular expressions to delete and edit.
-
[SOLVED] Still get the same session id after I log out
Daniel0 replied to alluoshi's topic in PHP Coding Help
Rumor has it that reading the manual often helps: -
[SOLVED] search for big letter and ignore the small letter
Daniel0 replied to sungpeng's topic in MySQL Help
You need to set the collation to a case-sensitive one. E.g. utf8_general_cs. -
It's called object oriented programming, not class oriented programming. Something tells me you do not know what OOP is. OOP is not procedural programming with classes instead of functions. It has nothing to do with security against hackers. The protection is against other code. You do not have variables in the global scope which may accidentally be overwritten by your own code or third party libraries. Also, by restricting access to an objects properties you control how they're used. I'd suggest you to read up on OOP. It really is quite a too large subject to explain in one topic. There are written several books on OOP after all. I understand your confusion though. A lot of people claim to be using OOP when in fact they are rather just using classes as a sort of namespace (like the people who create an enormous class called just database).
-
Sort of depends on what you want to resell, don't you think?
-
It's only a security risk if you allow random people access to the filesystem. You would obviously store such files above the document root.
-
$date = '2009-04-22'; $parts = explode('-', $date); if (count($parts) != 3 || !checkdate($parts[1], $parts[2], $parts[0])) { echo 'Invalid'; } else { echo 'Valid'; } Better than regex because it checks that it's actually a real date.
-
On the phone... A: Foo Bar, Inc. car repair service. How can I help you? B: Hi, my car is broken. How long time will it take for you to repair it and how much will it cost?
-
You can read about those operators here: http://php.net/operators.bitwise & is bitwise AND. It "flips on" the bits that are "on" in both the left and the right operands. E.g. 11002 & 10012 = 10002 >> means "shift right". It essentially shifts the bits in the left operand the number of the times the right operand specifies. E.g 00112 << 210 = 11002
-
You could do this: $base = 614; $exponent = 17; $mod = 5063; for ($res = 1; $exponent > 0; $exponent >>= 1) { if (($exponent & 1) == 1) { $res = $res * $base % $mod; } $base = $base * $base % $mod; } echo $res;
-
I'm not really sure what you're trying to do. Are you trying to do what in PHP equates to pow(614, 17) % 5063? In that case you can just do bcmod(bcpow(614, 17), 5063).
-
It would be $bgks[array_rand($bkgs,1)]. However, seeing as you cannot use index 0 and 1 (they are the current and parent directory, respectively), you could do something like this: $bgks[mt_rand(2, count($bgks) - 1)]
-
array_rand() returns the index of the randomly chosen element, it doesn't return the element itself.
-
Can't you just make a new stylesheet for the print media type? <link rel="stylesheet" href="css/print.css" media="print" type="text/css">
-
Set the user to your user and set the group to the httpd's group. Then give owner and group identical permissions.
-
It's because he is including it multiple times. The error message says that (the filenames and line numbers are identical).
-
I am sure it is still true. But that does not mean that D3 will be free to play online...I mean I bet they will make it a subscription service. As far as WoW sucks from jackpf. Do you think a 10 day trial period of your low level character give you an actual idea of the game? Doubtful, most low level toons are alternate characters and all those people care about is getting their toon to level 80 as fast as they can to do those PvPs. As they say, you do not judge a book by it's cover. But WoW is not for everyone as well, I am just simply saying, you cannot get the full experience from a 10day trial, especially without a higher level toon to try it on. Well, then the trial sucks, doesn't it? I'm not into marketing, but it seems sort of counter-intuitive to showcase the most boring aspects of a product to potential customers...
-
You cannot have numbers above 2,147,483,648 for a 32-bit signed integer. You need to use something like BCMath.
-
You think deliberately putting syntax errors in your document is the "best method of programming"? That seems a bit odd to me.