All code posted here, unless otherwise specified, is licensed under a BSD 2 Clause license. The only note is that these snippets do not have the BSD copyright notice - so you are exempt from including them.
I found a very good video explaining how computers use the basic transistor component to do multiplication. I'm currently working on a project for college that requires something along these lines. Figured I'd share it since it was such a good video.
I took in a few of these suggestions, and did a little reading. From what I've seen people are saying that using system(anything) uses more resources then just getting it done more pure, so I took a while to find some ways to replace using my system functions, along with adding a remove user function and came up with this.
Next up is how to use php to execute a batch file on my system. I wrote a small batch that essentially executes another program for FastDL sync (as gmod caps DL at 20kb/s) but this program can take a while to complete compressing and copying files. Does something like system("C:\program.bat") work? This particular program requires me to press enter when it is finished, is there a way I could get a program to do this for me? And would the program have to hold up the entire PHP while it takes its 10+ minutes to complete? Any ways around this if it is the case? I feel like all the things I'm trying to do have horri
I'm not using HTTP authentication, but I already have a openid/steam authentication in place before people can access this page. It's part of a larger project. The main thing I wanted was to make sure it would be impossible for anyone to send malicious POST data to transverse the directory tree to somewhere I didn't want them to, even though in theory only authorized users would have access to this resource to start with.
So I could take the realpath substring length of the POSTed directory, and make sure that it is C:\sg\darkrp\garrysmod\addons? And + is the correct concatenation operator? I was using . or something I think... I was also confused why they named the function unlin
This is a topic that is always argued but first off I would recommend using htaccess/IIS to have a basic auth prompt - if it's not using SSL it will be in clear text but it will prevent random people from accessing it.
The options have no value so this as is wouldn't work. And if you are thinking what I think you are thinking - you should set the value options to the subdirectory and do a rrmdir on C:\sg\darkrp\garrysmod\\ + $_POST['file']. Also to check to make sure they aren't trying to traverse through the filesystem you could use http://php.net/manual/en/function.realpath.php to check if $_POST["file"] == realpath($_POST['file']). If it's not equal then you
After a client whined a little while from FTP taking too long to remove his enormous mistakes, I decided to take a shot at writing a php program to quickly remove files from the addons directory of his garrysmod server. My main goal in this is to prevent any bugs, and any possibility to remove files outside of the addons directory using things like ".." I thought I'd post to see if there was any flaws or security exploits that should be fixed.
The code looks good. It is pretty solid. The only suggestions I can make that Nate didn't already cover are pretty much opinionated, so here are some of my opinions.
Lets start here...
for( vector<string>::const_iterator i = data.begin(); i != data.end(); i++)
cout<<*i <<' ';
While this works and accomplishes what you want, it is not very readable. Having to dereference a pointer in order to get it's contents is something you should avoid while being a novice IMHO. It causes uneeded congestion and there are simpler w
I think we should have a support section - but I'll let Justin (Celestialkey) figure that out.
A couple of things:
- Many people argue global variables are bad form ie:
- Shelling out to a system command with system is usually frowned upon because it's platform dependent (arguably there are a lot worse C++ code that you will probably write that will be platform dependent) ie