French Server and HTTP Requests - httprequest

I created an application and I have only french users submissions with an SQL server (OVH). No US, UK ... users ! I can see on my Statistic page some foreign downloaders though. Is there any restrictions for people outside my country (I use AsynkTasks, HTTP Requests and SQL server) !
Thank You So Much For Your Answer !
Chris

I just read what "AsynkTasks" is, and I assumed you're working on android, which I know nothing about. I don't know if (or how) this might help you, but if your app can somehow send a request to somewhere that can run this PHP:
http://chir.ag/projects/geoiploc/
It returns the geographical location by requester IP. Hope this helps.

Related

Hacked : How to know the date our server called pirate's url the first time?

Our server have been hacked (injected code). We need to find the first date the pirate's url have been called from our server. Where can we find that ? Is there a way to find this in the log ? We found the pirate url in a piece of code on our payment page.
Thank for your precious help !
If you have a Linux server running apache usually all HTTP logs are written to var/log/httpd/
However, the question is how the URL gets called to find real (if there is any).

BIM 360 field API login issues

Frustrating issue with attempting to use REST to login to the BIM 360 Field API, it was suggested that to use the postman application in order to ensure that my code wasn't an issue, however I'm now getting an unauthorized error, this has been attempted with an admin account and a developer account with the same response (login details are definitely valid), I was wandering if anyone has encountered this problem before or has any idea how would go about getting past this, I need to get the ticket response in order to go any further with developing an application for this, I'm already in contact with someone from Autodesk but due to timezone differences responses are difficult!
I've attached a picture to highlight the simplicity of what I'm attempting to do with no joy!
Thanks in advance
Dan
In case somebody else hits the same issue, FYI -
Dan and I looked at this issue, and we learned (in a hard way) that the base URL for BIM 360 Field in European region is:
https://bim360field.eu.autodesk.com
Notice "eu" in the URL. In the U.S., it is https://bim360field.autodesk.com
I wrote a post about this, too, for future reference:
https://fieldofviewblog.wordpress.com/2016/08/18/base-url-for-bim-360-field-in-european-countries/
I also found it worked when I used https but not http although the examples in the help use http.

Prevention from entire website downloading?

There is one IP (from China) which is trying to download my entire website. It downloads all my pages and loads the server significantly (I have more than 500 000 pages). Looking at the access logs I can tell it's definitely not a Google bot or any other search engine bot.
Temporarily I've banned it (using iptables rules), but it's not a solution for me, because some of my real users also have the same IP, so they are also banned and cannot acces the website.
Is there any way to prevent such kind of "user activity"? Maybe a mechanism which implements captcha if you try to request more than 5 requests a second or something?
P.S. I'm using Yii framework (PHP).
Any suggestions are greatly appreciated.
thank you!
You have answered your own question!
Make captcha appear if the request exceeds certain number per second or per minute!
You should use CCaptchaAction to implement, like this.
I guess the best way to monitor for suspicious user activity is really user session, CWebUser's getState()/setState(). Store current request time in user session, compare it to several previous values, show captcha if user makes requests too often.
Create new component, preload it via CWebApplication::$preload and check user activity in components init() function. This way you'll be able to turn bot check on and off easily.

Connect android to database

I am doing a school project where we need to create an android application which needs to connect to a database. the application needs to gain and store information for people's profiles on the database. But unfortunatly we are a little bit stuck at this point because there are numerous ways to link the application such as http request through apache or through the SOAP/REST protocol.
But it's really hard to find good instructions or tutorials on the problem since I can't really find them. Maybe that's cause i'm probably using the wrong words on google. Unfortunately I have little relevant information. So if anyone can help me with finding relevant links to good online tutorials or howto's than those are very welcome.
I'd recommend using REST and JSON to communicate to a PHP script running on Apache. Don't worry about the database on the Android side of things, just focus on what kinds of queries you might need to make and what data you need returned. Then put together a PHP script to take those queries and generate the necessary SQL to query the database on the server. For example, You need look look up a person by name and show their address in your Android app. A REST Query is just a simple HTTP GET to request data. For example, to look up John Smith, you might request: http://www.example.org/lookup.php?name=John+Smith which will return a short JSON snippet generated by PHP:
{
name: "John Smith",
address: "1234 N Elm St.",
city: "New York",
state: "New York"
}
You can instruct PHP to use the content type text/plain by putting this at the top of your PHP script:
Then you can just navigate to the above URL in your browser and see your JSON response printed out nicely as a page. There should be a good JSON parser written in Java out there you can use with Android. Hopefully, this will get you started.
This tutorial really helped me: http://www.screaming-penguin.com/node/7742

Redirect depending on the Country?

We basically have 2 sites ( Java /JSP / Apache Webserver) :
something.ca & something.com
The .ca is canadian content, and the .com is american content.
We need users to be redirected based on the ip addreess.
We want US users to get the .com site and Canadian users get the .ca site.
What is the best way to do this (at a webserver level or otherwise ) ?
Please elaborate.
In my web surfing experience, most websites - UPS.com for example - ask the user to select their country site rather than trying to figure it out themselves. They remember the selection in a cookie. Much depends on how voluntary your use case requires this redirection to be.
On the implementation side, I'd use a filter that would check the setting and fire a redirect if need be.
I've used GeoIP from Maxmind and it works well. They have a free version GeoCountry Lite That's 99.3% accurate. the Java API is here I would follow google's practice of having a link back to the original version if you do the redirect.
Check out GeoDirection. It may handle what you want through javascript.
http://www.geobytes.com/GeoDirection.htm
Another option would be to grab the culture from the browser environment settings and map those cultures to countries in your application. Depending on what you are actually trying to do this may not work for you as this will not give you the user's physical location, but will get you their preferred culture. So if a Canadian travels to the US they will still get the Canadian site unless they changed their browser settings for some reason.
There are a lot of IP geolocation APIs out there - I don't know if there's anything good out there that you don't have to pay for:
Using culture settings is an option, but doesn't work in some cases. What if you have a German user in the US who likes his dates etc. displayed in the format he's comfortable with? Doesn't change the fact that he's in the US.
I think that's one of the reasons why most companies simply ask the user and then store that information in a cookie (UPS, FedEx and most major airlines do that). Check out www.lufthansa.com. They actually ask for location and language(to account for countries with more than one official language like Switzerland).