scootstah
Staff Alumni-
Posts
3,858 -
Joined
-
Last visited
-
Days Won
29
Everything posted by scootstah
-
First Google result: http://www.howtoplaza.com/how-to-use-custom-fonts-on-your-website-with-css
-
Firefox+Firebug freeze when debugging an onResize function
scootstah replied to jhsachs's topic in Javascript Help
So, I tested your script and got the same results: if I set a break point, Firefox locks up and I get the horizontal-resize cursor. I did a bit of Googling and it seems to be a known problem with using breakpoints on "onResize". From my limited research it appears to be an issue in the way Windows handles resizing, or something. Basically, you can't use breakpoints. I did however find two errors in your script, on this line: var mainDiv = getElementById('mainDiv'); Your div has an ID of "MainDiv", not "mainDiv", and you need to put document. before the getElementById() method. So in the end it should be: var mainDiv = document.getElementById('MainDiv'); -
Firefox+Firebug freeze when debugging an onResize function
scootstah replied to jhsachs's topic in Javascript Help
Try removing the alert's, or replacing them with console.log() -
So why not use is_int?
-
It can be anywhere in the code as long as it is before any output. But, the top of the script is a good place for it. Make sure multiple URL's are comma-separated.
-
:after isn't supported by IE <= 7, so you'll have to use the ugly method if those versions concern you.
-
Change onchange="this.empselect.submit()" to onchange="empselect.submit()"
-
I'm having trouble understanding what exactly you're trying to do, but I THINK you're talking about AJAX.
-
You need to be using .innerHTML, not .value
-
Firefox+Firebug freeze when debugging an onResize function
scootstah replied to jhsachs's topic in Javascript Help
It could be an infinite loop. Does it only freeze when using Firebug with breakpoints? I can't really do anything other than guess without seeing any code. For the record, Firefox 14.0.1 is the most recent version. -
urlencode() isn't meant to prevent XSS, so no. You could use htmlentities() if you wanted, but if it is going to be numeric it's easier to just typecast it. There's no point having sanitized data if it isn't valid data.
-
track last five maps played on a server
scootstah replied to dodgeitorelse3's topic in PHP Coding Help
Yeah, you'd probably need a cron job for accurate results. Ping the script once a minute or so, or whatever feels right. As for the database, if you only want to ever have 5 rows then you'd simply need to delete the oldest when inserting a 5th. You can determine the oldest with either a timestamp or by using the lowest auto-incremented ID. -
It's a matter of slow AND using a good algorithm. MD5 and SHA1 were never meant to be used for password security. They are used for utilities, like checksums. They are very fast and don't have a lot of entropy. It is relatively easy to brute force or find collisions. So, what you need is something that is meant for storing passwords, and that is bcrypt. If you don't want to use bcrypt, you can also be pretty safe using PBKDF2 with SHA512, and 10k iterations or so. An easy way to do that is to use phpass: http://www.openwall.com/phpass/ And a tutorial (ignore any use of the 'global' keyword in the examples, and instead pass your parameters through the argument list): http://www.openwall.com/articles/PHP-Users-Passwords Another option is phpseclib. It supports bcrypt and PBKDF2, and has a whole bunch of other useful utilities. Probably not as lightweight as PHPass, though.
-
No, then you are repeating a ton of code. wiredesignz' widget plugin might be a good solution here.
-
ClanCMS uses CodeIgniter, which I am familiar with. Is "squads" a model? I don't believe you can access models in that way from a view. You really shouldn't be anyway though, you should be getting that stuff in the controller and then passing it to the view.
-
It's a matter of slow AND using a good algorithm. MD5 and SHA1 were never meant to be used for password security. They are used for utilities, like checksums. They are very fast and don't have a lot of entropy. It is relatively easy to brute force or find collisions. So, what you need is something that is meant for storing passwords, and that is bcrypt. If you don't want to use bcrypt, you can also be pretty safe using PBKDF2 with SHA512, and 10k iterations or so.
-
Any PHP errors? Is error reporting turned on? To make sure, put this at the top of your script: error_reporting(-1); ini_set('display_errors', 1);
-
So what is the issue here?
-
The only thing I can see being a problem is running utilities which need to fetch all of the files in the directory, like ls.
-
You should just be assigning roles and permissions in the database, and then use PHP to figure out which menus they can access based on the aforementioned roles and permissions. Check out this article: http://phpmaster.com/role-based-access-control-in-php/
-
I just ran a script that copied a file called "this & that.txt" using copy() and there was no problems. Post the rest of your code please.
-
It shouldn't if it is declared outside the function first. That's true for Javascript, but not PHP. To make it work the way you are saying, you'd have to use g*****. Ahhhhhhh! You said the G word!! Keep in mind that I wasn't necessarily saying that you should use globals, just that you would have to in order to modify out-of-scope variables within a function without using a return. This wouldn't work: $foo = 'bar'; function f() { $foo = 'foobar'; } f(); echo $foo; // 'bar' It would have to be like this: $foo = 'bar'; function f() { global $foo; $foo = 'foobar'; } f(); echo $foo; // 'foobar'; Or, as xyph pointed out, like this: (but I don't know if this is any better than using global) $foo = 'bar'; function f() { $GLOBALS['foo'] = 'foobar'; } f(); echo $foo; // 'foobar';
-
Because with output buffering, PHP basically "holds on to" any output until the end of script execution (or until the output buffering is otherwise ended). It is common practice to omit the closing PHP tag (?>) to prevent any accidental white-space. The closing tag is not required.
-
How to display data from a mysql table in rows of 4?
scootstah replied to Stalingrad's topic in PHP Coding Help
Something like... $i = 1; while($row = mysql_fetch_array($info)) { $myname = $row['name']; $myid = $row['itemid']; $myimage = $row['image']; $mydesc = $ow['description']; $myrarity = $row['rarity']; echo "<div style=\"float:left;\">$myname<br><img src=/images/items/$myimage></div>"; if ($i % 4 == 0) { echo '<br style="clear:both;" />'; } $i++; } -
It will probably work, but it's not the best solution.