Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to create a simple protection system for my php scripts.
My plan is two hard-code a varibale which allows code snippets to execute.
I want to have some kind of system were I have a database with the domain and a license key. They key will be entered in the admin panel and then every time someone visits the site the php code gets executed and will send the key with the domain. A script on my server will check if the two variables match and return "VALID" or "ERROR".
If it returns VALID the code on the client side gets executed. If it returns "ERROR" some kind of advertisment or error message will be displayed.
At this point of time I can really code anything, BUT the connection between the servers.
I guess I cannot use some kind of $_GET or $_POST since I don' t wanna any kind of redirect. I cannot directly connect to the db since this would be a BIG security issue.
Any ideas? Thx ya.
Well, the problem with this is that if the client can see it -- they can modify it.
However, you can just use
$result = file_get_contents('http://mywebsite.com/check.php?license=' . $license);
if(trim(strtolower($result)) == 'valid') {
// it's valid
} else {
// display ad
}
Or you can use cURL.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to make sure visitors to my site can't see the PHP code that's generating the page. Here is a reference: http://may.edu.np/tmp/
Can anyone explain to me how server-side scripts are interpreted and how the result is delivered to the end user?
If I understand your question correctly, no one should be able to access your source code so long as they don't have access to the server. When a browser makes a request for a .php file to the server, the server knows that it must first interpret the script and then send the output from your echo statements and/or inline HTML. As far as I know, there's no way for the user to "trick" the server into sending it as plain text, so I wouldn't worry about that. Also, as long as you disable error reporting, no one should even know you're running php, as there's no ".php" in the URL. Hope this helps :)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a project that needs me to store a group feed of one of my Facebook groups that I want to store locally (MySQL). I have used PHPs Facebook SDK to successfully retrieve and store the first 24 posts. The rest are paginated like, as seen in the response:
"paging": {
"previous": "https://graph.facebook.com/v2.1/197349856967661/feed?limit=25&since=1413803847&__paging_token=enc_Aezfg88j7xOEW28BENBXvchQql9OYz00t6siBT2MviwZdOCcIFV8nyMyBmrUu39eOHbve68h6yUWLb0Lc12v_HD7k4_q299PnvIq7gz4BAZMZA",
"next": "https://graph.facebook.com/v2.1/197349856967661/feed?limit=25&until=1413803553&__paging_token=enc_AeyKAdBaClRXLJ7nBulYeqDEfzW1ovuAXSuDkPMSnbmIxpPXKh24vli0tOpF_OOtnFCXZLNTZki3j2umR8WKKyo3nLmZtICF1zfq7ZASIk2PdQ"
}
I wanted to know if there was a way in which I can loop the same piece of code until all the entries have been stored in my database. I am thinking is there a way to detect if there is a next page and execute another request using the "next" URL? Please do help me. I will highly appreciate it.
Disclaimer: I am going to give you the procedure not the code, you can code it based on what you need.
login.
make the first request. //don't handle just yet.
if (![paging][next]) escapeLoop =1;
do //using do .. while
if (escapeLoop ==1) break; //exits loop if all posts are received in one page
handle the request //insert to DB
make the new request using the link provided in the response.
while ([paging][next]);
handle the last request & requests with one page response.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
How can I go about implementing a database like search form into an HTML website? For example, there is a form to enter your zip code and after entering the zip code, it searches a .txt file (for example) and returns results that fall under that specific zip code.
Any help would be greatly appreciated.
Thank you
There are many approaches you could take. It's a very broad question.
As an example solution, you would need to have both client and server side code. The client would submit the form to a server. The server code could be written in a multitude of languages, PHP, ASP, JAVA etc.
The server side code would take the request parameters sent by the form, read the file, calculate any result and pass it back in the http response to the front end, which could be dealt with by displaying a new page or as part of an AJAX refresh.
As you can appreciate though, this is a very broad topic and there are many possible solutions.
Also as #Dagon points out, if you are not restricted to using a text file (although your title probably suggests you are) then using a MySQL or other such database could be a better solution, maybe even Solr as an indexing solution, depending on what you are searching for.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have hmvc-codeigniter I would like to know what the best way is to show one of my views/controller pages for maintenance mode. Where I can view website but any one else that is not on my ip bets directed to this certain view/controller.
I have tried many htaccess codes but non seem to work the way I am after. They still block me from viewing my own website when working on in maintenance mode.
is there a proper function that can add in to index.php in codeingiter that can do what I am after.
CodeIgniter features the Front Controller paradigm, so everything passes through index.php. I don't know how you set your website in "maintenance mode", whether it's through a relational database or if it's just through code.
The idea above ensures that if we add code to index.php, then we know for sure that it's the entry point to our application. A quick fix would be to add the following to index.php:
if($_SERVER['REMOTE_ADDR'] != 'xxx.xxx.xxx.xxx') {
die('Application is currently in maintenance mode. Please return shortly.');
}
While the fix above does resolve the issue, it's never a good idea to remove content unless you have an emergency situation (hacks, DB failure, etc.). You may want to setup a different staging server, work any updates on that server, and the apply them to production.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm using php and curl to get the content of various websites. Some sites require post values. I want to check if the site expect any post values to be sent.
You cannot do that, unless sites specifically tell you in their response headers what they are expecting (and they rarely, if ever, do). Best you can do is take a look at returned headers from the request. You cannot automate this process.
Not entirely sure what you're asking here OP. But when creating scripts in cURL to automate interaction with other websites you generally have to investigate manually to find out what parameters need to be passed to get to the information you want...
It'll be a case of using tools such as Source Code View, and the firefox addon which allows you to modify post information (forgotten what its called) to see whats actually happening when you visit the site.