Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Encryption of code !HELP! (http://www.go4expert.com/forums/encryption-code-help-t29902/)

c_user 13Nov2013 16:27

Encryption of code !HELP!
Hello friends,
I have been asked by my manager to design my code such that when a user types the URL then before loading the script in the browser ; It goes to a different server and checks the url in a particular file. If found then it will send some positive value ; On receiving the positive value the server files loads else it gives an error and nothing happens..
Friends give me ur valuable suggestions how to achieve it!
Thanking You ,
Good Day.:pleased:

David Ledger 14Nov2013 14:54

Re: Encryption of code !HELP!
You need to step back and look at what your manager is asking you to achieve. I presume you mean
"before loading the script on the server" rather than "browser". PHP code never hits the browser (unless its a .html instead of .php), and the browser couldn't follow it anyway.

If what (s)he wants is like passworded access but where the 'password' is the browser's IP address, then that is simple. (Just check for it as a line in a file).

If they are asking you to validate that the requested URL is allowed then they need to learn how the web works. If it doesn't exist the user will get a 404; if it does but is not allowed, it is already too late. It sounds to me that your manager is asking you to write an http server not a web page.



c_user 14Nov2013 15:12

Re: Encryption of code !HELP!
@David Ledger thank you for the reply.
I got what u are saying but may be u misunderstood what i want to convey. Yes i was not descriptive and i m sorry for that.
Say :
I have got my project ready and it is loaded in server and the url is named as xyz.org
when the user types xyz.org at the browser address , the request goes and the php code is executed showing the required .tpl files at the front end.
Now what i want is my code which my company is going to give it to the client should be useful only to them not every one.
Its like the persons who are going to buy the project will only be allowed to execute the code. Even though if the code is leaked to any person the code should not execute.
So can u please tell me ; how i can achieve my required.
Thanking you.

c_user 14Nov2013 15:15

Re: Encryption of code !HELP!
So what i have planned is to make a domain validation so that the list of domain in the file can execute the project code only.

David Ledger 15Nov2013 22:46

Re: Encryption of code !HELP!
If you put all the OK IP addresses line by line into a file which gets loaded into an array you can use a php array function to see it the requester's IP is one of the values. If you make a list of domain names you would have to do a lot more work.



c_user 15Nov2013 23:03

Re: Encryption of code !HELP!
Thank a ton brother ! yup @David Ledger i have planned the same but i was thinking could there be some other way achieving the same !

All times are GMT +5.5. The time now is 21:13.