Welcome to Celestialcoding!

A simple rule

1. Be polite and professional

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.
Info
Info

 Shoutbox

Hello, Guest
Please login or register.

 
 
 

Did you miss your activation email?
GenierO
March 18, 2015

Goliathsboy
March 5, 2015

Jake
February 18, 2015

Re: My First Program
Posted by: Nathan in Tutorial Support on March 16, 2015, 09:13:00 PM

Quote
system(anything) uses more resources then just getting it done more pure

Sure - but also keep in mind system("pause") won't work on Mac OS and Linux.

Code: [Select]
@mysql01:~$ pause
bash: pause: command not found
Re: My First Program
Posted by: Jake in Tutorial Support on March 15, 2015, 03:37:24 AM

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.

Code: C++
  1. #include <iostream>
  2. #include <vector>
  3. #include <stdio.h>
  4. #include <string>
  5. using namespace std;
  6.  
  7. string getinput()
  8. {
  9.     string dataline;
  10.    
  11.     string name;
  12.     cout << "Enter Name: ";
  13.     getline(cin, name);
  14.    
  15.     string number;
  16.     cout << "Enter Number: ";
  17.  

Re: A PHP Solution
Posted by: Celestialkey in Tutorial Support on March 05, 2015, 09:04:41 PM


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

Re: A PHP Solution
Posted by: Jake in Tutorial Support on March 01, 2015, 03:52:49 PM

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

Re: A PHP Solution
Posted by: Nathan in Tutorial Support on March 01, 2015, 08:47:26 AM

Well...

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


  •  Total Members: 85
  •  Total Posts: 11154
  •  Total Topics: 1695
  •  Total Categories: 4
  •  Total Boards: 75
  • users Users: 0
  • guests Guests: 15
  • hidden Hidden: 0
  • spiders Spiders: 0