Get TempPath of Server !?

Just starting out? Need help? Post your questions and find answers here.
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Get TempPath of Server !?

Post by Ralf »

Still wrote a program with licence for any pc-station. The program will be installed on the server. User can start the prog direct from the server! Now i have following prob, still want that only one or two or more user can start the prog at same time (due fact of which licence they buyed)!

Due fact that the programm is installed to Program/ folder on the server, the users dont have any write access to the program directory... Sure the admin could change this but i still want a program that the admin of any company dont have to change any user settings!

So my question is, how can i get the path of Temp/ dir or AllUsers/ i.e of the server... So i can write into a ini file on the sever how often the program is startet atm!? Source would be fine.

Or have someone a better way? Thanks
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

I'm not sure I understand exactly what it is you're asking but if you want to know how to get the path to the temp folder it's :

Code: Select all

temp_dir$ = Space(512)
            
GetEnvironmentVariable_("temp",@temp_dir$,512)
... there are no per-user temp directories that I know of (could be wrong about that)..

Here is a post about preventing an application from starting twice -
viewtopic.php?p=24945

Hope that helps a bit...
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Post by Ralf »

For example we will have one company server and 200 computers! My program will be installed on the server only not on any local computer! IF the company will have a licence for 5 computers only, they can only run the program 5times at the same time!!!

Here my problem start. How can i check how often the program is running? Best way would be to use a ini file and set a variable how often the program is running atm and save the ini to the programfolder where the program is installed... Problems:

1. How to get the programfolder where we started the app from (server) ?
2. How and where to save the ini file on server. AS you normaly dont have any write permission if admin hasnt changed it! I still want to use the temp or AllUser folder for this... but how to get the path and a working methode?
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

viewtopic.php?t=4876

Almost all your questions are answered in the beginner FAQ.. I'm not sure if the check to see if your app is running more than once would work if they're running the app on the server.. Hopefully someone else can comment on that..

Good luck!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
User avatar
blueb
Addict
Addict
Posts: 1118
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Post by blueb »

There may be many ways to solve your problem.

I'd have the program create a small preference file (and encrypt it if required) on the server.

When a remote user starts the server program, the program writes the user's name in the preference file. Once you have filled up the amount of users you desire, stop the program from starting. Of course you'll have to handle users who walk away from their machines and leave your program running, broken connections, etc.

Writing this has given me an idea. Why not devise a small 'universal' program that maintains users? Everyone who wants such a restriction, can simple use RunProgram() and have their program use this extra program only when they need it's features.

Hmmm....seems like I've got some work to do..... :idea:


blueb
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Post by Skipsy »

Hi
If I understand you want to have a file with the number of connected
users in. If a new user wants to use the app you can test with that
file if the max number is reached... :?:

Why don't you create a shared folder with read/write authorisation on the
server ? I can be anywhere on the server...

Not necessary to mount a drive letter. Your app could read/write the file
using UNC command like \\server_name\shared_folder\licence.txt.
I have never checked UNC with PB but it should work.

:wink: Hope this help,
WW
Beware of the man who has the solution before he understands the problem...
Post Reply