Search Results

Search found 150 results on 6 pages for 'referrer'.

Page 3/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Please explain this Rails method to me like I'm a little kid.

    - by Senthil
    I found this in Ryan Bates' railscast site, but not sure how it works. #models/comment.rb def req=(request) self.user_ip = request.remote_ip self.user_agent = request.env['HTTP_USER_AGENT'] self.referrer = request.env['HTTP_REFERER'] end #blogs_controller.rb def create @blog = Blog.new(params[:blog]) @blog.req = request if @blog.save ... I see he is saving the user ip, user agent and referrer, but am confused with the req=(request) line. Any help is appreciated. Thanks

    Read the article

  • Faulting DLL (ISAPI Filter)...

    - by Brad
    I wrote this ISAPI filter to rewrite the URL because we had some sites that moved locations... Basically the filter looks at the referrer, and if it's the local server, it looks at the requested URL and compared it to the full referrer. If the first path is identical, nothing is done, however if not, it takes the first path from the full referrer and prepends it to the URL. For example: /Content/imgs/img.jpg from a referrer of http://myserver/wr/apps/default.htm would be rewritten as /wr/Content/imgs/img.jpg. When I view the log file, everything looks good. However the DLL keeps faulting with the following information: Faulting application w3wp.exe, version 6.0.3790.3959, faulting module URLRedirector.dll, version 0.0.0.0, fault address 0x0002df25. Here's the code: #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <httpfilt.h> #include <time.h> #include <string.h> #ifdef _DEBUG #define TO_FILE // uncomment out to use a log file #ifdef TO_FILE #define DEST ghFile #define DebugMsg(x) WriteToFile x; HANDLE ghFile; #define LOGFILE "W:\\Temp\\URLRedirector.log" void WriteToFile (HANDLE hFile, char *szFormat, ...) { char szBuf[1024]; DWORD dwWritten; va_list list; va_start (list, szFormat); vsprintf (szBuf, szFormat, list); hFile = CreateFile (LOGFILE, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { SetFilePointer (hFile, 0, NULL, FILE_END); WriteFile (hFile, szBuf, lstrlen (szBuf), &dwWritten, NULL); CloseHandle (hFile); } va_end (list); } #endif #endif BOOL WINAPI __stdcall GetFilterVersion(HTTP_FILTER_VERSION *pVer) { /* Specify the types and order of notification */ pVer->dwFlags = (SF_NOTIFY_ORDER_HIGH | SF_NOTIFY_SECURE_PORT | SF_NOTIFY_NONSECURE_PORT | SF_NOTIFY_PREPROC_HEADERS | SF_NOTIFY_END_OF_NET_SESSION); pVer->dwFilterVersion = HTTP_FILTER_REVISION; strcpy(pVer->lpszFilterDesc, "URL Redirector, Version 1.0"); return TRUE; } DWORD WINAPI __stdcall HttpFilterProc(HTTP_FILTER_CONTEXT *pfc, DWORD NotificationType, VOID *pvData) { CHAR *pPhysPath; PHTTP_FILTER_URL_MAP pURLMap; PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo; CHAR szReferrer[255], szServer[255], szURL[255], szNewURL[255]; DWORD dwRSize = sizeof(szReferrer); DWORD dwSSize = sizeof(szServer); DWORD dwUSize = sizeof(szURL); int iTmp, iTmp2; CHAR *pos, tmp[255], *tmp2; switch (NotificationType) { case SF_NOTIFY_PREPROC_HEADERS : pHeaderInfo = (PHTTP_FILTER_PREPROC_HEADERS)pvData; if (pfc->GetServerVariable(pfc, "HTTP_REFERER", szReferrer, &dwRSize)) { DebugMsg(( DEST, "Referrer: %s\r\n", szReferrer )); if (pfc->GetServerVariable(pfc, "SERVER_NAME", szServer, &dwSSize)) DebugMsg(( DEST, "Server Name: %s\r\n", szServer )); if (pHeaderInfo->GetHeader(pfc, "URL", szURL, &dwUSize)) DebugMsg(( DEST, "URL: %s\r\n", szURL )); iTmp = strnstr(szReferrer, szServer, strlen(szReferrer)); if(iTmp > 0) { //Referred is our own server... strcpy(tmp, szReferrer + iTmp); DebugMsg(( DEST, "tmp: %s - %d\r\n", tmp, strlen(tmp) )); pos = strchr(tmp+1, '/'); DebugMsg(( DEST, "pos: %s - %d\r\n", pos, strlen(pos) )); iTmp2 = strlen(tmp) - strlen(pos) + 1; strncpy(tmp2, tmp, iTmp2); tmp2[iTmp2] = '\0'; DebugMsg(( DEST, "tmp2: %s\r\n", tmp2)); if(strncmp(szURL, tmp2, iTmp2) != 0) { //First paths don't match, create new URL... strncpy(szNewURL, tmp2, iTmp2-1); strcat(szNewURL, szURL); DebugMsg(( DEST, "newURL: %s\r\n", szNewURL)); pHeaderInfo->SetHeader(pfc, "URL", szNewURL); return SF_STATUS_REQ_HANDLED_NOTIFICATION; } } } break; default : break; } return SF_STATUS_REQ_NEXT_NOTIFICATION; } /* simple function to compare two strings and return the position at which the compare ended */ static int strnstr ( const char *string, const char *strCharSet, int n) { int len = (strCharSet != NULL ) ? ((int)strlen(strCharSet )) : 0 ; int ret, I, J, found; if ( 0 == n || 0 == len ) { return -1; } ret = -1; found = 0; for (I = 0 ; I <= n - len && found != 1 ; I++) { J = 0 ; for ( ; J < len ; J++ ) { if (toupper(string[I + J]) != toupper(strCharSet [J])) { break; // Exit For(J) } } if ( J == len) { ret = I + (J); found = 1; } } return ret; }

    Read the article

  • Efficient Method for Preventing Hotlinking via .htaccess

    - by Michael Robinson
    I need to confirm something before I go accuse someone of ... well I'd rather not say. The problem: We allow users to upload images and embed them within text on our site. In the past we allowed users to hotlink to our images as well, but due to server load we unfortunately had to stop this. Current "solution": The method the programmer used to solve our "too many connections" issue was to rename the file that receives and processes image requests (image_request.php) to image_request2.php, and replace the contents of the original with <?php header("HTTP/1.1 500 Internal Server Error") ; ?> Obviously this has caused all images with their src attribute pointing to the original image_request.php to be broken, and is also the wrong code to be sending in this case. Proposed solution: I feel a more elegant solution would be: In .htaccess If the request is for image_request.php Check referrer If referrer is not our site, send the appropriate header If referrer is our site, proceed to image_request.php and process image request What I would like to know is: Compared to simply returning a 500 for each request to image_request.php: How much more load would be incurred if we were to use my proposed alternative solution outlined above? Is there a better way to do this? Our main concern is that the site stays up. I am not willing to agree that breaking all internally linked images is the best / only way to solve this. I refuse to tell our users that because of something WE changed they must now manually change the embed code in all their previously uploaded content.

    Read the article

  • How do I disable nginx sending messages to syslog?

    - by altman
    My nginx sends lots of messages to syslog, but I don't need them. In my nginx.conf: error_log /var/log/nginx-error.log notice; ...... server { access_log off; location / { .... } } but, in my /var/log/message you see Nov 22 23:25:09 cache3 nginx: 2011/11/22 23:25:09 [error] 3437#0: *32172530 kevent() reported about an closed connection (60: Operation timed out) while reading response header from upstream, client: , server: , request: "GET http://www.igoido012.com//vk HTTP/1.1", upstream: "http:////vk", host: "www.igoido012.com", referrer: "http://www.baidu.com/" Nov 22 23:25:09 cache3 nginx: 2011/11/22 23:25:09 [error] 3437#0: *32099531 upstream timed out (60: Operation timed out) while reading response header from upstream, client: , server: , request: "GET http://t.web2.qq.com/channel/poll?msg_id=0&clientid=431509&t=1321975433305 HTTP/1.1", upstream: "http://:80/channel/poll?msg_id=0&clientid=431509&t=1321975433305", host: "t.web2.qq.com", referrer: "http://t.web2.qq.com/proxy.html?v=20110331001" How can I prevent nginx sending messages to my syslog?

    Read the article

  • Awstats showing strange 404 referrers

    - by Marco Demaio
    When I look at Awstats 404 errors I see sometimes strange referrers. For example on www.mydomain.com I might see a 404 error reported in Awstats that says: URL (not found) Referrers some-file.jpg http://www.mydomain.com/some-page.html some-file.jpg is a file that does not exist, so it's not strange that if someone tried to reach it got back a 404 from server. The strange part is that the referring page DOES NOT EXIST TOO, I mean http://www.domain.com/some-page.html DOES NOT EXIST, so how could it be the referrer? Is it some client cheating the referrer? Thanks!

    Read the article

  • nginx errors: upstream timed out (110: Connection timed out)

    - by Sparsh Gupta
    Hi, I have a nginx server with 5 backend servers. We serve around 400-500 requests/second. I have started getting a large number of Upstream Timed out errors (110: Connection timed out) Error string in error.log looks like 2011/01/10 21:59:46 [error] 1153#0: *1699246778 upstream timed out (110: Connection timed out) while reading response header from upstream, client: {IP}, server: {domain}, request: "GET {URL} HTTP/1.1", upstream: "http://{backend_server}:80/{url}", host: "{domain}", referrer: "{referrer}" Any suggestions how to debug such errors. I am unable to find a munin plugin to keep a check on number of upstream errors. Sometime the number of errors per day is way too high and somedays its a more decent 3 digit number. A munin graph would probably help us finding out any pattern or correlation with anything else How can we make the number of such error as ZERO

    Read the article

  • Complex SQL query help on aggregating values for nested subquery

    - by François Beausoleil
    Hi! I have people, companies, employees, events and event kinds. I'm making a report/followup sheet where people, companies and employees are the rows, and the columns are event kinds. Event kinds are simple values describing: "Promised Donation", "Received Donation", "Phoned", "Followed up" and such. Event kinds are ordered: CREATE TABLE event_kinds ( id, name, position); Events hold the actual reference to the event: CREATE TABLE events ( id, person_id, company_id, referrer_id, event_kind_id, created_at); referrer_id is another reference to people. It is the person which sent the information/tip along, and is an optional field, although I sometimes want to filter on an event_kind that has a specific referrer, while I don't for other event kinds. Notice I don't have an employee ID reference. The reference exists, but is implied. I have application code to validate that person_id and company_id really reference an employee record. The other tables are pretty basic: CREATE TABLE people ( id, name); CREATE TABLE companies ( id, name); CREATE TABLE employees ( id, person_id, company_id); I'm trying to achieve the following report: Referrer Phoned Promised Donated Francois Feb 16th Feb 20th Mar 1st Apple (Steve Jobs) Steve Ballmer Mar 3rd IBM Bill Gates Mar 7th The first row is a people record, the 2nd is an employee, and the 3rd is a company. If I asked for referrer Bill Gates for Phoned event kinds, I'd only see the 3rd row, while asking for Steve and Phoned would return no rows. Right now, I do 3 queries, one for companies, one for people and a last one for employees. I want the event kind columns to be ordered, but I do that in application code and show it properly there. Here's where I'm at so far: SELECT companies.id, companies.name, (SELECT events.id FROM events WHERE events.referrer_id = 1470 AND events.company_id = companies.id AND events.person_id IS NULL AND events.event_kind_id = 9 ORDER BY created_at DESC LIMIT 1) event_kind_9, (SELECT events.id FROM events WHERE events.company_id = companies.id AND events.person_id IS NULL AND events.event_kind_id = 10 ORDER BY created_at DESC LIMIT 1) event_kind_10, (SELECT events.created_at FROM events WHERE events.referrer_id = 1470 AND events.company_id = companies.id AND events.person_id IS NULL AND events.event_kind_id = 9 ORDER BY created_at DESC LIMIT 1) event_kind_9_order FROM "companies" SELECT people.id, people.name, (SELECT events.id FROM events WHERE events.referrer_id = 1470 AND events.company_id IS NULL AND events.person_id = people.id AND events.event_kind_id = 9 ORDER BY created_at DESC LIMIT 1) event_kind_9, (SELECT events.id FROM events WHERE events.company_id IS NULL AND events.person_id = people.id AND events.event_kind_id = 10 ORDER BY created_at DESC LIMIT 1) event_kind_10, (SELECT events.created_at FROM events WHERE events.referrer_id = 1470 AND events.company_id IS NULL AND events.person_id = people.id AND events.event_kind_id = 9 ORDER BY created_at DESC LIMIT 1) event_kind_9_order FROM "people" SELECT employees.id, employees.company_id, employees.person_id, (SELECT events.id FROM events WHERE events.referrer_id = 1470 AND events.company_id = employees.company_id AND events.person_id = employees.person_id AND events.event_kind_id = 9 ORDER BY created_at DESC LIMIT 1) event_kind_9, (SELECT events.id FROM events WHERE events.company_id = employees.company_id AND events.person_id = employees.person_id AND events.event_kind_id = 10 ORDER BY created_at DESC LIMIT 1) event_kind_10, (SELECT events.created_at FROM events WHERE events.referrer_id = 1470 AND events.company_id = employees.company_id AND events.person_id = employees.person_id AND events.event_kind_id = 9 ORDER BY created_at DESC LIMIT 1) event_kind_9_order FROM "employees" I rather suspect I'm doing this wrong. There should be an "easier" way to do it. One other filter criteria would be to filter on people/company names: WHERE LOWER(companies.name) LIKE '%apple%'. Note that I'm ordering by the dates of event_kind_9 here, and a secondary sort is by person/company name. To summarize: I want to paginate the result set, find the latest event for each cell, order the result set by the date of the latest event, and by company/person name, filter by referrer in some event kinds, but not others. For reference, I'm using PostgreSQL, from Ruby, ActiveRecord/Rails. The solution is pure SQL though.

    Read the article

  • Ad Server does not serve ads in Firefox, but works fine in Chrome, IE, & Safari!?

    - by HipHop-opatamus
    I'm having a strange (likely JavaScript) related issue. I'm running Open X Ad Server ( http://www.openx.org ) which serves ads to the website http://upsidedowndogs.com . The ads load fine every time when visiting the site via Chrome, IE, or Safari, but sometimes don't load at all in FireFox - Hence, it is a client side issue, which leads me to believe its something up with the javascript. The fact that the problem is intermittent, and does not through any error codes to FireBug, also doesn't make it any easier to diagnose and address. Any ideas how to diagnose / address this issue? Thanks! Here is the code generated by OpenX (it goes in the page header - additional code is then used in each ad unit, as seen on the page) if (typeof(OA_zones) != 'undefined') { var OA_zoneids = ''; for (var zonename in OA_zones) OA_zoneids += escape(zonename+'=' + OA_zones[zonename] + "|"); OA_zoneids += '&amp;nz=1'; } else { var OA_zoneids = escape('1|2|3|4'); } if (typeof(OA_source) == 'undefined') { OA_source = ''; } var OA_p=location.protocol=='https:'?'https://ads.offleashmedia.com/server/www/delivery/spc.php':'http://ads.offleashmedia.com/server/www/delivery/spc.php'; var OA_r=Math.floor(Math.random()*99999999); OA_output = new Array(); var OA_spc="<"+"script type='text/javascript' "; OA_spc+="src='"+OA_p+"?zones="+OA_zoneids; OA_spc+="&amp;source="+escape(OA_source)+"&amp;r="+OA_r; OA_spc+=(document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : '')); if (window.location) OA_spc+="&amp;loc="+escape(window.location); if (document.referrer) OA_spc+="&amp;referer="+escape(document.referrer); OA_spc+="'><"+"/script>"; document.write(OA_spc); function OA_show(name) { if (typeof(OA_output[name]) == 'undefined') { return; } else { document.write(OA_output[name]); } } function OA_showpop(name) { zones = window.OA_zones ? window.OA_zones : false; var zoneid = name; if (typeof(window.OA_zones) != 'undefined') { if (typeof(zones[name]) == 'undefined') { return; } zoneid = zones[name]; } OA_p=location.protocol=='https:'?'https://ads.offleashmedia.com/server/www/delivery/apu.php':'http://ads.offleashmedia.com/server/www/delivery/apu.php'; var OA_pop="<"+"script type='text/javascript' "; OA_pop+="src='"+OA_p+"?zoneid="+zoneid; OA_pop+="&amp;source="+escape(OA_source)+"&amp;r="+OA_r; if (window.location) OA_pop+="&amp;loc="+escape(window.location); if (document.referrer) OA_pop+="&amp;referer="+escape(document.referrer); OA_pop+="'><"+"/script>"; document.write(OA_pop); } var OA_fo = ''; OA_fo += "<"+"script type=\'text/javascript\' src=\'http://ads.offleashmedia.com/server/www/delivery/fl.js\'><"+"/script>\n"; document.write(OA_fo);

    Read the article

  • REST and redirecting the response

    - by Duane Gran
    I'm developing a RESTful service. Here is a map of the current feature set: POST /api/document/file.jpg (creates the resource) GET /api/document/file.jpg (retrieves the resource) DELETE /api/document/file.jpg (removes the resource) So far, it does everything you might expect. I have a particular use case where I need to set up the browser to send a POST request using the multipart/form-data encoding for the document upload but when it is completed I want to redirect them back to the form. I know how to do a redirect, but I'm not certain about how the client and server should negotiate this behavior. Two approaches I'm considering: On the server check for the multipart/form-data encoding and, if present, redirect to the referrer when the request is complete. Add a service URI of /api/document/file.jpg/redirect to redirect to the referrer when the request is complete. I looked into setting an X header (X-myapp-redirect) but you can't tell the browser which headers to use like this. I manage the code for both the client and the server side so I'm flexible on solutions here. Is there a best practice to follow here?

    Read the article

  • Massive 404 attack with non existent URLs. How to prevent this?

    - by tattvamasi
    The problem is a whole load of 404 errors, as reported by Google Webmaster Tools, with pages and queries that have never been there. One of them is viewtopic.php, and I've also noticed a scary number of attempts to check if the site is a WordPress site (wp_admin) and for the cPanel login. I block TRACE already, and the server is equipped with some defense against scanning/hacking. However, this doesn't seem to stop. The referrer is, according to Google Webmaster, totally.me. I have looked for a solution to stop this, because it isn't certainly good for the poor real actual users, let alone the SEO concerns. I am using the Perishable Press mini black list (found here), a standard referrer blocker (for porn, herbal, casino sites), and even some software to protect the site (XSS blocking, SQL injection, etc). The server is using other measures as well, so one would assume that the site is safe (hopefully), but it isn't ending. Does anybody else have the same problem, or am I the only one seeing this? Is it what I think, i.e., some sort of attack? Is there a way to fix it, or better, prevent this useless resource waste? EDIT I've never used the question to thank for the answers, and hope this can be done. Thank you all for your insightful replies, which helped me to find my way out of this. I have followed everyone's suggestions and implemented the following: a honeypot a script that listens to suspect urls in the 404 page and sends me an email with user agent/ip, while returning a standard 404 header a script that rewards legitimate users, in the same 404 custom page, in case they end up clicking on one of those urls. In less than 24 hours I have been able to isolate some suspect IPs, all listed in Spamhaus. All the IPs logged so far belong to spam VPS hosting companies. Thank you all again, I would have accepted all answers if I could.

    Read the article

  • HttpPost works in Java project, not in Android

    - by dave.c
    I've written some code for my Android device to login to a web site over https and parse some data out of the resulting pages. An HttpGet happens first to get some info needed for login, then an HttpPost to do the actual login process. The code below works great in a Java project within Eclipse which has the following Jar files on the build path: httpcore-4.1-beta2.jar, httpclient-4.1-alpha2.jar, httpmime-4.1-alpha2.jar, commons-logging-1.1.1.jar. public static MyBean gatherData(String username, String password) { MyBean myBean = new MyBean(); try { HttpResponse response = doHttpGet(URL_PAGE_LOGIN, null, null); System.out.println("Got login page"); String content = EntityUtils.toString(response.getEntity()); String token = ContentParser.getToken(content); String cookie = getCookie(response); System.out.println("Performing login"); System.out.println("token = "+token +" || cookie = "+cookie); response = doLoginPost(username,password,cookie, token); int respCode = response.getStatusLine().getStatusCode(); if (respCode != 302) { System.out.println("ERROR: not a 302 redirect!: code is \""+ respCode+"\""); if (respCode == 200) { System.out.println(getHeaders(response)); System.out.println(EntityUtils.toString(response.getEntity()).substring(0, 500)); } } else { System.out.println("Logged in OK, loading account home"); // redirect handler and rest of parse removed } }catch (Exception e) { System.out.println("ERROR in gatherdata: "+e.toString()); e.printStackTrace(); } return myBean; } private static HttpResponse doHttpGet(String url, String cookie, String referrer) { try { HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); client.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8"); HttpGet httpGet = new HttpGet(url); httpGet.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); httpGet.setHeader(HEADER_USER_AGENT,HEADER_USER_AGENT_VALUE); if (referrer != null && !referrer.equals("")) httpGet.setHeader(HEADER_REFERER,referrer); if (cookie != null && !cookie.equals("")) httpGet.setHeader(HEADER_COOKIE,cookie); return client.execute(httpGet); } catch (Exception e) { e.printStackTrace(); throw new ConnectException("Failed to read content from response"); } } private static HttpResponse doLoginPost(String username, String password, String cookie, String token) throws ClientProtocolException, IOException { try { HttpClient client = new DefaultHttpClient(); client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); client.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8"); HttpPost post = new HttpPost(URL_LOGIN_SUBMIT); post.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1); post.setHeader(HEADER_USER_AGENT,HEADER_USER_AGENT_VALUE); post.setHeader(HEADER_REFERER, URL_PAGE_LOGIN); post.setHeader(HEADER_COOKIE, cookie); post.setHeader("Content-Type","application/x-www-form-urlencoded"); List<NameValuePair> formParams = new ArrayList<NameValuePair>(); formParams.add(new BasicNameValuePair("org.apache.struts.taglib.html.TOKEN", token)); formParams.add(new BasicNameValuePair("showLogin", "true")); formParams.add(new BasicNameValuePair("upgrade", "")); formParams.add(new BasicNameValuePair("username", username)); formParams.add(new BasicNameValuePair("password", password)); formParams.add(new BasicNameValuePair("submit", "Secure+Log+in")); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams,HTTP.UTF_8); post.setEntity(entity); return client.execute(post); } catch (Exception e) { e.printStackTrace(); throw new ConnectException("ERROR in doLoginPost(): "+e.getMessage()); } } The server (which is not under my control) returns a 302 redirect when the login was successful, and 200 if it fails and re-loads the login page. When run with the above Jar files I get the 302 redirect, however if I run the exact same code from an Android project with the 1.6 Android Jar file on the build path I get the 200 response from the server. I get the same 200 response when running the code on my 2.2 device. My android application has internet permissions, and the HttpGet works fine. I'm assuming that the problem lies in the fact that HttpPost (or some other class) is different in some significant way between the Android Jar version and the newer Apache versions. I've tried adding the Apache libraries to the build path of the Android project, but due to the duplicate classes I get messages like: INFO/dalvikvm(390): DexOpt: not resolving ambiguous class 'Lorg/apache/http/impl/client/DefaultHttpClient;' in the log. I've also tried using a MultipartEntity instead of the UrlEncodedFormEntity but I get the same 200 result. So, I have a few questions: - Can I force the code running under android to use the newer Apache libraries in preference to the Android versions? - If not, does anyone have any ideas how can I alter my code so that it works with the Android Jar? - Are there any other, totally different approaches to doing an HttpPost in Android? - Any other ideas? I've read a lot of posts and code but I'm not getting anywhere. I've been stuck on this for a couple of days and I'm at a loss how to get the thing to work, so I'll try anything at this point. Thanks in advance.

    Read the article

  • Should I log my website's 404 errors?

    - by Ivan Zlatanov
    I have an ASP.NET website, but this question isn't really about technology, it is rather about practice. Should we log our 404 errors? My reasoning: This is a potential vulnerable point because a simple unfriendly user may fill up your hard drive in no time just by requesting wrong URLs! Some browsers often request resources up front - like for example favicon.ico, even if its not there. This is really annoying. But really I would like to know about a broken link if there exists one in my websites. Should I depend on the URL referrer? The problem with the URL referrer is that I cannot distinguish my internal redirect which may be broken with an unfriendly one from outside. What does the practice suggest?

    Read the article

  • Hacking "Contact Form 7" code to Add A "Referred By" field

    - by Scott B
    I've got about 6 subdomains that have a "contact us" link and I'm sending all these links to a single form that uses "Contact Form 7". I add ?from=site-name to each of the links so that I can set a $referredFrom variable in the contact form. The only two things I'm missing are (1) the ability to insert this referredFrom variable into the email that I get whenever someone submits the form and (2) The ability to redirect the user back to the site they came from (stored in $referredFrom) Any ideas? Here's a bit of code from includes/classes.php that I thought might be part of the email insert but its not doing much... function mail() { global $referrer; $refferedfrom = $referrer; //HERE IS MY CUSTOM CODE $fes = $this->form_scan_shortcode(); foreach ( $fes as $fe ) { $name = $fe['name']; $pipes = $fe['pipes']; if ( empty( $name ) ) continue; $value = $_POST[$name]; if ( WPCF7_USE_PIPE && is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) { if ( is_array( $value) ) { $new_value = array(); foreach ( $value as $v ) { $new_value[] = $pipes->do_pipe( $v ); } $value = $new_value; } else { $value = $pipes->do_pipe( $value ); } } $this->posted_data[$name] = $value; $this->posted_data[$refferedfrom] = $referrer; //HERE IS MY CUSTOM CODE } I'm also thinking that I could insert the referredFrom code somewhere in this function as well... function compose_and_send_mail( $mail_template ) { $regex = '/\[\s*([a-zA-Z][0-9a-zA-Z:._-]*)\s*\]/'; $callback = array( &$this, 'mail_callback' ); $mail_subject = preg_replace_callback( $regex, $callback, $mail_template['subject'] ); $mail_sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] ); $mail_body = preg_replace_callback( $regex, $callback, $mail_template['body'] ); $mail_recipient = preg_replace_callback( $regex, $callback, $mail_template['recipient'] ); $mail_headers = "From: $mail_sender\n"; if ( $mail_template['use_html'] ) $mail_headers .= "Content-Type: text/html\n"; $mail_additional_headers = preg_replace_callback( $regex, $callback, $mail_template['additional_headers'] ); $mail_headers .= trim( $mail_additional_headers ) . "\n"; if ( $this->uploaded_files ) { $for_this_mail = array(); foreach ( $this->uploaded_files as $name => $path ) { if ( false === strpos( $mail_template['attachments'], "[${name}]" ) ) continue; $for_this_mail[] = $path; } return @wp_mail( $mail_recipient, $mail_subject, $mail_body, $mail_headers, $for_this_mail ); } else { return @wp_mail( $mail_recipient, $mail_subject, $mail_body, $mail_headers ); } }

    Read the article

  • In rails whats the best way to get the site that a user came from? I am getting conflicting info.

    - by kidbrax
    If i enter a url directly into the address bar of the browser, i get the following results: logger.debug ENV['HTTP_REFERER'] // => logger.debug request.referrer // => / So the first one gives me a blank result which is what I expected but the second gives me the root? Is this correct? It seems from the docs (http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html#M000478) that they should return the same thing. And secondly, why does it return the root, if there was no referrer.

    Read the article

  • Uknown nginx Error Messages

    - by Sparsh Gupta
    Hello, I am getting some nginx errors as I can see them in my error.log which I am unable to understand. They look like: ERRORS: 2011/03/13 21:48:21 [crit] 14555#0: *323314343 open() "/usr/local/nginx/proxy_temp/0/95/0000000950" failed (13: Permission denied) while reading upstream, client: XX.XX.XX.XX, server: , request: "GET /abc.jpg 2 HTTP/1.0", upstream: "http://192.168.162.141:80/abc.jpg", host: "example.com", referrer: "http://domain.com" 2011/03/13 22:00:07 [crit] 14552#0: *324171134 open() "/usr/local/nginx/proxy_temp/1/95/0000000951" failed (13: Permission denied) while reading upstream, client: XX.XX.XX.XY, server: , request: "GET mno.png HTTP/1.1", upstream: "http://192.168.162.141:80/mno.png", host: "example.com", referrer: "http://domain2.com" I also looked at these locations but found that there is no file by this name. root@li235-57:/var/log/nginx# /usr/local/nginx/proxy_temp/1/ 00/ 01/ 02/ 03/ 04/ 05/ 06/ 07/ 08/ 09/ 10/ 11/ 12/ 13/ 14/ 15/ 16/ 17/ 18/ 19/ 20/ 21/ 22/ 23/ 24/ 25/ 26/ 27/ 28/ 29/ 30/ 31/ 32/ 33/ 34/ 35/ 36/ 37/ root@li235-57:/var/log/nginx# ls /usr/local/nginx/proxy_temp/0/ 01/ 02/ 03/ 04/ 05/ 06/ 07/ 08/ 09/ 10/ 11/ 12/ 13/ 14/ 15/ 16/ 17/ 18/ 19/ 20/ 21/ 22/ 23/ 24/ 25/ 26/ 27/ 28/ 29/ 30/ 31/ 32/ 33/ 34/ 35/ 36/ 37/ Can someone help me whats going on / how can I debug this more and better fix this Thanks

    Read the article

  • Passenger connection reset by peer issue

    - by user887372
    I am new to ruby on rails. I am using passenger 3.0.17 to deploy my ruby 3.2.6 project. My project is working fine but i got 500 internal error when i try to upload files on server. I checked my passenger log and found: [ pid=20654 thr=140394143790848 file=ext/nginx/HelperAgent.cpp:933 time=2012-11-01 09:29:57.82 ]: Uncaught exception in PassengerServer client thread: exception: write() failed: Connection reset by peer (104) backtrace: in 'void Client::forwardResponse(Passenger::SessionPtr&, Passenger::FileDescriptor&, const Passenger::AnalyticsLogPtr&)' (HelperAgent.cpp:705) in 'void Client::handleRequest(Passenger::FileDescriptor&)' (HelperAgent.cpp:859) in 'void Client::threadMain()' (HelperAgent.cpp:952) 2012/11/01 09:29:27 [crit] 20691#0: *431 mkdir() "/tmp/passenger-standalone.20640/proxy_temp/2" failed (2: No such file or directory) while reading upstream, client: 124.172.71.55, server: _, request: "GET /assets/jquery.js?body=1 HTTP/1.1", upstream: "passenger:unix:/passenger_helper_server:", host: "test.com:3000", referrer: "http://test.com:3000/" 2012/11/01 09:29:33 [crit] 20691#0: *435 mkdir() "/tmp/passenger-standalone.20640/proxy_temp/3" failed (2: No such file or directory) while reading upstream, client: 124.172.71.55, server: _, request: "GET /assets/background.png HTTP/1.1", upstream: "passenger:unix:/passenger_helper_server:", host: "test.com:3000", referrer: "http://test.com:3000/" [ pid=20654 thr=140394115462912 file=ext/nginx/HelperAgent.cpp:933 time=2012-11-01 09:29:33.543 ]: Uncaught exception in PassengerServer client thread: exception: write() failed: Connection reset by peer (104) backtrace: in 'void Client::forwardResponse(Passenger::SessionPtr&, Passenger::FileDescriptor&, const Passenger::AnalyticsLogPtr&)' (HelperAgent.cpp:705) in 'void Client::handleRequest(Passenger::FileDescriptor&)' (HelperAgent.cpp:859) in 'void Client::threadMain()' (HelperAgent.cpp:952) Please guide me regarding the issue. I am unable to find the reason of this peer reset and failied mkdir(). Thanks in advance

    Read the article

  • Nginx + PHP-FPM Timeouts, almost zero load consumption?

    - by javipas
    I've got a server running on a Linode with Ubuntu 10.04 LTS, Nginx 0.7.65, MySQL 5.1.41 and PHP 5.3.2 with PHP-FPM. There is a WordPress blog on it, updated to WordPress 3.2.1 recently. I have made no changes to the server (except updating WordPress) and while it was running fine, a couple of days ago I started having downtimes. I tried to solve the problem, and checking the error_log I saw many timeouts and messages that seemed to be related to timeouts. The server is currently logging this kind of errors: 2011/07/14 10:37:35 [warn] 2539#0: *104 an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/2/00/0000000002 while reading upstream, client: 217.12.16.51, server: www.mydomain.com, request: "GET /page/2/ HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "www.mydomain.com", referrer: "http://www.mydomain.com/" 2011/07/14 10:40:24 [error] 2539#0: *231 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 46.24.245.181, server: www.mydomain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.mydomain.com", referrer: "http://www.google.es/search?sourceid=chrome&ie=UTF-8&q=mydomain" and even saw this previous serverfault discussion with a possible solution: to edit /etc/php/etc/php-fpm.conf and change request_terminate_timeout=30s instead of ;request_terminate_timeout= 0 The server worked for some hours, and then broke again. I edited the file again to leave it as it was, and restarted again php-fpm (service php-fpm restart) but no luck: the server worked for a few minutes and back to the problem over and over. The strange thing is, although the services are running, htop shows there is no CPU load (see image) and I really don't know how to solve the problem. The config files are on pastebin The php-fpm.conf file is here The /etc/nginx/nginx.conf is here The /etc/nginx/sites-available/www.mydomain.com is here Please help :(

    Read the article

  • Creating a multidimensional array

    - by Jess McKenzie
    I have the following response and I was wanting to know how can I turn it into an multidimensional array foreach item [0][1] etc Controller $rece Response: array(16) { ["digital_delivery"]=> int(1) ["original_referrer"]=> string(11) "No Referrer" ["shop_rule_us_state_code"]=> string(1) "0" ["subtotal_ex_vat"]=> string(4) "9.99" ["subtotal_inc_vat"]=> string(4) "9.99" ["tax_amount"]=> string(4) "0.00" ["delivery_price"]=> string(4) "0.00" ["discount_deduction"]=> string(4) "0.00" ["currency_code"]=> string(3) "GBP" ["total"]=> string(4) "9.99" ["paid"]=> int(1) ["created"]=> string(19) "2013-10-31 21:03:44" ["website_id"]=> string(2) "64" ["first_name"]=> string(3) "Joe" ["last_name"]=> string(5) "Blogs" ["email"]=> string(17) "[email protected]" } array(16) { ["digital_delivery"]=> int(1) ["original_referrer"]=> string(11) "No Referrer" ["shop_rule_us_state_code"]=> string(1) "0" ["subtotal_ex_vat"]=> string(4) "9.99" ["subtotal_inc_vat"]=> string(4) "9.99" ["tax_amount"]=> string(4) "0.00" ["delivery_price"]=> string(4) "0.00" ["discount_deduction"]=> string(4) "0.00" ["currency_code"]=> string(3) "GBP" ["total"]=> string(4) "9.99" ["paid"]=> int(1) ["created"]=> string(19) "2013-10-31 21:03:44" ["website_id"]=> string(2) "64" ["first_name"]=> string(3) "Joe" ["last_name"]=> string(5) "Blogs" ["email"]=> string(13) "[email protected]" } array(16) { ["digital_delivery"]=> int(1) ["original_referrer"]=> string(11) "No Referrer" ["shop_rule_us_state_code"]=> string(1) "0" ["subtotal_ex_vat"]=> string(4) "9.99" ["subtotal_inc_vat"]=> string(4) "9.99" ["tax_amount"]=> string(4) "0.00" ["delivery_price"]=> string(4) "0.00" ["discount_deduction"]=> string(4) "0.00" ["currency_code"]=> string(3) "GBP" ["total"]=> string(4) "9.99" ["paid"]=> int(1) ["created"]=> string(19) "2013-10-31 21:03:44" ["website_id"]=> string(2) "64" ["first_name"]=> string(3) "Joe" ["last_name"]=> string(5) "Blogs" ["email"]=> string(15) "[email protected]" } Controller: foreach ($this->receivers as $rece) { $order_data['first_name'] = $rece[0]; $order_data['last_name'] = $rece[1]; $order_data['email'] = $rece[2]; $order_id = $this->orders_model->add_order_multi($order_data, $order_products_data); $this-receivers function: public function parse_receivers($receivers) { $this->receivers = explode( "\n", trim($receivers) ); $this->receivers = array_filter($this->receivers, 'trim'); $validReceivers = false; foreach($this->receivers as $key=>$receiver) { $validReceivers = true; $this->receivers[$key] = array_map( 'trim', explode(',', $receiver) ); if (count($this->receivers[$key]) != 3) { $line = $key + 1; $this->form_validation->set_message('parse_receivers', "There is an error in the %s at line $line ($receiver)"); return false; } } return $validReceivers; }

    Read the article

  • XML parse node value as string

    - by bharathi
    My xml file is look like this . I want to get the value node text content as like this . <property regex=".*" xpath=".*"> <value> 127.0.0.1 </value> <property regex=".*" xpath=".*"> <value> val <![CDATA[ <Valve className="org.tomcat.AccessLogValve" exclude="PASSWORD,pwd,pWord,ticket" enabled="true" serviceName="zohocrm" logDir="../logs" fileName="access" format="URI,&quot;PARAM&quot;,&quot;REFERRER&quot;,TIME_TAKEN,BYTES_OUT,STATUS,TIMESTAMP,METHOD,SESSION_ID,REMOTE_IP,&quot;INTERNAL_IP&quot;,&quot;USER_AGENT&quot;,PROTOCOL,SERVER_NAME,SERVER_PORT,BYTES_IN,ZUID,TICKET_DIGEST,THREAD_ID,REQ_ID"/> ]]> test </value> </property> I want to get text as order they specified in a file . Here is my java code . Document doc = parseDocument("properties.xml"); NodeList properties = doc.getElementsByTagName("property"); for( int i = 0 , len = properties.getLength() ; i < len ; i++) { Element property = (Element)properties.item(i); //How can i proceed further . } Output Expected : Node 1 : 127.0.0.1 Node 2 : val <Valve className="org.tomcat.AccessLogValve" exclude="PASSWORD,pwd,pWord,ticket" enabled="true" serviceName="zohocrm" logDir="../logs" fileName="access" format="URI,&quot;PARAM&quot;,&quot;REFERRER&quot;,TIME_TAKEN,BYTES_OUT,STATUS,TIMESTAMP,METHOD,SESSION_ID,REMOTE_IP,&quot;INTERNAL_IP&quot;,&quot;USER_AGENT&quot;,PROTOCOL,SERVER_NAME,SERVER_PORT,BYTES_IN,ZUID,TICKET_DIGEST,THREAD_ID,REQ_ID"/> test Please suggest your views .

    Read the article

  • How do I Extend Blogengine.Net to collect statistics of visitors?

    - by Stefan
    I love BlogEngine. But from what I can se it does not collect the standard information about the visitors I would like to see (referrer, browser-type and so on). When I log in as Admin I have a menu item named "Referrer". I can choose a weekday and then I'll be presented with 1 or 2 rows with "google.com 4 hits, "itmaskinen.se 6 hits" and so on, But that's not what I want to se, I want to se where my visitors come from, country, IP if possible, how many visitors and so on. If someone of you are familiar with Blogengine.Net and can point me in the right direction to where I would put my own log-code or if you know any visitor-statistic-extension that can do it for me, I would be really happy to know. I prefer an extension, because if I make changes myself to BlogEngine it may break later updates I install. Blogengine.Net is a blog software made in .Net found here: http://www.dotnetblogengine.net/ And yes, I prefer to take this question here rather then in the Blogengine.Net forum, you know why. ;) (Anyone, feel free to edit my (bad) english in this post and after that delete this sentence)

    Read the article

  • Email Tracking - GMail

    - by Abs
    Hello all, I am creating my own email tracking system for email marketing tracking. I have been able to determine each persons email client they are using by using the http referrer but for some reason GMAIL does not send a HTTP_REFERRER at all! So I am trying to find another way of identifying when gmail requests a transparent image from my server. I get the following headers print_r($_SERVER);: DOCUMENT_ROOT = /usr/local/apache/htdocs GATEWAY_INTERFACE = CGI/1.1 HTTP_ACCEPT = */* HTTP_ACCEPT_CHARSET = ISO-8859-1,utf-8;q=0.7,*;q=0.3 HTTP_ACCEPT_ENCODING = gzip,deflate,sdch HTTP_ACCEPT_LANGUAGE = en-GB,en-US;q=0.8,en;q=0.6 HTTP_CONNECTION = keep-alive HTTP_COOKIE = __utmz=156230011.1290976484.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=156230011.422791272.1290976484.1293034866.1293050468.7 HTTP_HOST = xx.xxx.xx.xxx HTTP_USER_AGENT = Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10 PATH = /bin:/usr/bin QUERY_STRING = i=MTA= REDIRECT_STATUS = 200 REMOTE_ADDR = xx.xxx.xx.xxx REMOTE_PORT = 61296 REQUEST_METHOD = GET Is there anything of use in that list? Or is there something else I can do to actually get the http referrer, if not how are other ESPs managing to find whether gmail was used to view an email? Btw, I appreciate it if we can hold back on whether this is ethical or not as many ESPs do this already, I just don't want to pay for their service and I want to do it internally. Thanks all for any implementation advice. Update Just thought I would update this question and make it clearer in light of the bounty. I would like to find out when a user opens my email when sent to a GMail inbox. Assume, I have the usual transparent image tracking and the user does not block images. I would like to do this with the single request and the header details I get when the transparent image is requested.

    Read the article

  • Permission denied while reading upstream

    - by user68613
    We have deployed our rails application on on nginx and passenger.Intermittently pages of application get loaded partially.There is no error in application log.But nginx error log shows the following : 2011/02/14 05:49:34 [crit] 25389#0: *645 open() "/opt/nginx/proxy_temp/2/02/0000000022" failed (13: Permission denied) while reading upstream, client: x.x.x.x, server: y.y.y.y, request: "GET /signup/procedures?count=0 HTTP/1.1", upstream: "passenger:unix:/passenger_helper_server:", host: "y.y.y.y", referrer: "http://y.y.y.y/signup/procedures"

    Read the article

  • Is there a way to download all google webfonts in web font formats

    - by wayne
    They simple just have ttf in the repository and i am looking for a less painful way then just do change the browser referrer and download them one by one. As far as i understand it the conversation, as described in the google wiki takes effort and steps to reduce filesize ... so i just can't batch convert them. I simple want the exact files that google serves browsers for localhost (without internet) use. woff, sot, svg ...

    Read the article

  • Permission denied while reading upstream

    - by user68613
    We have deployed our rails application on on nginx and passenger.Intermittently pages of application get loaded partially.There is no error in application log.But nginx error log shows the following : 2011/02/14 05:49:34 [crit] 25389#0: *645 open() "/opt/nginx/proxy_temp/2/02/0000000022" failed (13: Permission denied) while reading upstream, client: x.x.x.x, server: y.y.y.y, request: "GET /signup/procedures?count=0 HTTP/1.1", upstream: "passenger:unix:/passenger_helper_server:", host: "y.y.y.y", referrer: "http://y.y.y.y/signup/procedures"

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >