Search Results

Search found 21001 results on 841 pages for 'spelling check'.

Page 88/841 | < Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >

  • PHP check http referer for form submitted by AJAX, secure?

    - by Michael Mao
    Hi all: This is the first time I am working for a front-end project that requires server-side authentication for AJAX requests. I've encountered problems like I cannot make a call of session_start as the beginning line of the "destination page", cuz that would get me a PHP Warning : Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\comic\app\ajaxInsert Book.php:1) in C:\xampp\htdocs\comic\app\common.php on line 10 I reckon this means I have to figure out a way other than checking PHP session variables to authenticate the "caller" of this PHP script, and this is my approach : I have a "protected" PHP page, which must be used as the "container" of my javascript that posts the form through jQuery $.ajax(); method In my "receiver" PHP script, what I've got is: <?php define(BOOKS_TABLE, "books"); define(APPROOT, "/comic/"); define(CORRECT_REFERER, "/protected/staff/addBook.php"); function isRefererCorrect() { // the following line evaluates the relative path for the referer uri, // Say, $_SERVER['HTTP_REFERER'] returns "http://localhost/comic/protected/staff/addBook.php" // Then the part we concern is just this "/protected/staff/addBook.php" $referer = substr($_SERVER['HTTP_REFERER'], 6 + strrpos($_SERVER['HTTP_REFERER'], APPROOT)); return (strnatcmp(CORRECT_REFERER, $referer) == 0) ? true : false; } //http://stackoverflow.com/questions/267546/correct-http-header-for-json-file header('Content-type: application/json charset=UTF-8'); header('Cache-Control: no-cache, must-revalidate'); echo json_encode(array ( "feedback"=>"ok", "info"=>isRefererCorrect() )); ?> My code works, but I wonder is there any security risks in this approach? Can someone manipulate the post request so that he can pretend that the caller javascript is from the "protected" page? Many thanks to any hints or suggestions.

    Read the article

  • ASP.NET MVC security: how to check if a controller method is allowed to execute under current user's

    - by Gart
    Given an ASP.NET MVC Controller class declaration: public class ItemController : Controller { public ActionResult Index() { // ... } public ActionResult Details() { // ... } [Authorize(Roles="Admin, Editor")] public ActionResult Edit() { // ... } [Authorized(Roles="Admin")] public ActionResult Delete() { // .. } } I need to reflect a list of methods in this class which may be invoked with the current user's permissions. Please share some ideas of what could be done in this case.

    Read the article

  • How to check what goes wrong in $view->render with Zend Framework?

    - by koko
    Hi, I'm working on a CMS with Widgets. On my localhost the followong code works perfect, but I have no idea what I'm doing wrong ... The neede files exist, I think and I get no error message. As far as I can see, the error occurs in the one before last line of code and I get no error message. $view = new Zend_View(); $view->setScriptPath(APPLICATION_PATH . '/../public/websites/' . My_Cookie::get('alpha_key') . '/views'); $view->headScript()->appendFile($vervang['conf']['jqueryJS']); $view->headLink()->appendStylesheet($vervang['conf']['jqueryCSS']); $view->class = $pluginExtraFinal; $view->vervang = $vervang['data']; $view->moduleName = $moduleName; $parsed = $view->render($vervang['conf']['viewFile']); $inhoud = str_replace($plugin, $parsed, $inhoud); Is there a way to troubleshoot this code? How can I get an error message? What can be wrong? Any suggestions please?

    Read the article

  • How do I check the value of a cooke in other places in my iPhone app?

    - by squeezemylime
    I am setting a cookie to whether a user is logged in or not in my iPhone app. I set it using the following: // Build the cookie. NSHTTPCookie *cookie = [NSHTTPCookie cookieWithProperties:cookieDictionary]; // Store the cookie. [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie]; // Log the Cookie and display it for (cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) { NSLog(@"%@", cookie.value); } However, if I run this loop in other parts of the app (the 'for' loop), it isn't recognized...Is there a simple way I can find the value in other views of the app?

    Read the article

  • I have applied a check for not allowing alphabets.But its not working.....

    - by bhavna raghuvanshi
    import java.util.Scanner; public class Main extends Hashmap{ public static void main(String[] args) { Hashmap hm = new Hashmap(); int x=0; Scanner input = new Scanner(System.in); do{ System.out.print("Enter any integer value between 1 to 12: "); x = input.nextInt(); }while(x<=0 || x>12); Scanner sc = new Scanner(System.in); //int number; do { while (!sc.hasNextInt()) { System.out.println("That's not a number!"); sc.next(); } x = sc.nextInt(); }while(x>=0); String month = hm.getEntry(x); System.out.println(month); } } here I need to restrict user from entering an alphabet.But its not working. pls help...

    Read the article

  • how to check null value of Integer type field in ASP.NET MVC view?

    - by Vikas
    Hi, I have integer type field in database which is having property "Not Null". when i create a view & do a validation, if i left that field blank, it will consider it as 0 so i can not compare it with 0 because if someone insert a value 0 then it will be considered as error! one another problem is that i am using Model error as described in the book "ASP.NET MVC 1.0" @ Scott Gu blog. And I am checking the value in partial class of object (created by LINQ-To-SQL). i.e public partial class Person { public bool IsValid { get { return (GetRuleViolations().Count() == 0); } } public IEnumerable<RuleViolation> GetRuleViolations() { if (String.IsNullOrEmpty(Name)) yield return new RuleViolation("Name is Required", "Name"); if (Age == 0) yield return new RuleViolation("Age is Required", "Age"); yield break; } partial void OnValidate(ChangeAction action) { if (!IsValid) throw new ApplicationException("Rule violations prevent saving"); } } There is also problem with range. Like in database if i declared as smallint i.e. short in c#, now if i exceed that range then it gives error as "A Value is reguired". so finally is there any best way for validation in ASP.NET MVC?

    Read the article

  • Is there a way to force ContourPlot re-check all the points on the each stage of it's recursion algorithm?

    - by Alexey Popkov
    Hello, Thanks to this excellent analysis of the Plot algorithm by Yaroslav Bulatov, I now understand the reason why Plot3D and ContourPlot fail to draw smoothly functions with breaks and discontinuities. For example, in the following case ContourPlot fails to draw contour x^2 + y^2 = 1 at all: ContourPlot[Abs[x^2 + y^2 - 1], {x, -1, 1}, {y, -1, 1}, Contours -> {0}] It is because the algorithm does not go deeply into the region near x^2 + y^2 = 1. It "drops" this region on an initial stage and do not tries to investigate it further. Increasing MaxRecursion does nothing in this sense. And even undocumented option Method -> {Refinement -> {ControlValue -> .01 \[Degree]}} does not help (but makes Plot3D a little bit smoother). The above function is just a simple example. In real life I'm working with very complicated implicit functions that cannot be solved analytically. Is there a way to get ContourPlot to go deeply into such regions near breaks and discontinuities?

    Read the article

  • How can I check if a TTTabItem gets selected?

    - by schoash
    I have several TTTabGrids in my view and now I am stuck with the problem, that I can't figure out, how to detect, when a TTTabItem gets touched. If someone selects an item in one of the TTTabGrids I should upadate some labels. Can someone tell me a way how to detect, when the selection in a TTTabGrid gets changed? My code looks like this: @interface MyTTTabGrid : TTTabGrid @end @implementation MyTTTabGrid - (id)initWithFrame:(CGRect)frame columns:(NSInteger)columns{ if (self = [super initWithFrame:frame]) { self.style = TTSTYLE(tabGrid); _columnCount = columns; } return self; } @end - (void)viewDidLoad { [super viewDidLoad]; _tabBarHours = [[MyTTTabGrid alloc] initWithFrame:CGRectMake(10, _tabBarZone.bottom+10, 300, 0) columns:7]; _tabBarHours.backgroundColor = [UIColor clearColor]; NSMutableArray *tmpHours = [[NSMutableArray alloc] init]; int i=6; while (i<20) { [tmpHours addObject:[[[TTTabItem alloc] initWithTitle:[NSString stringWithFormat:@"%d", i]] autorelease]]; i++; } _tabBarHours.tabItems = tmpHours; [_tabBarHours sizeToFit]; [self.view addSubview:_tabBarHours]; [tmpHours release]; }

    Read the article

  • How can I check the MIME type of an uploaded file using Perl CGI?

    - by FOOM
    I'm trying to get the MIME type of an <input type="file" /> element using Perl, but without actually examining the contents of the file itself, In other words, just using the HTTP headers. I have only been able to get the "multipart/form-type" Content-Type value, but my understanding is that each element will get its own MIME Type? How can I see the sub-MIME types using Perl?

    Read the article

  • How can i check if key is pressed during click event with jquery?

    - by daniel smith
    Hi, I would like to catch a click event with jquery and be able to tell if a key was pressed at the same time so i can fork within the callback function based on the keypress. for example: $("button").click(function() { if([KEYPRESSED WHILE CLICKED]) { do something... } else { do something different... } }); Does anyone know if this is possible at all or how it can be done if it is possible?

    Read the article

  • How do I check if a Linq to SQL entity has grandchildren?

    - by EdenMachine
    How can I find out if a Linq to SQL entity has grandchildren or not? Pseudo-code below: Return From p In dc.Processes Where p.Signers.Count > 0 and p.Signers.Signatures.Count > 0 Obviously I can't run the code above but I need to make sure that all the returning Processes have at least one Signer and that all of those Signers have at least one Signature. TIA!

    Read the article

  • How to check if an SQL query executed without error in ASP?

    - by Sam
    Here's my code: if Request.Form("authorize") <> "" and request.form("delete") <> "true" then post_ids = Request.form("authorize") ids = split(post_ids, ",") For i = LBound(ids) to UBound(ids) sql = "update tbl_comments set authorized = 'true' where comment_id = " & ids(i) pageDB.execute(sql) Next message = "<div id=""succeed""><strong>Updated</strong>: Your comments have been approved.</div>" end if Instead of just setting "message" to the success message i'd like to do something along the lines of... if(pageDB.execute(sql) was succesful) then message = "<div id=""succeed""><strong>Updated</strong>: Your comments have been approved.</div>" else message = "<div id=""error""><strong>Error</strong>: Your comments have not been approved.</div>" end if

    Read the article

  • C#, Can I check on a lock without trying to acquire it?

    - by Biff MaGriff
    Hello, I have a lock in my c# web app that prevents users from running the update script once it has started. I was thinking I would put a notification in my master page to let the user know that the data isn't all there yet. Currently I do my locking like so. protected void butRefreshData_Click(object sender, EventArgs e) { Thread t = new Thread(new ParameterizedThreadStart(UpdateDatabase)); t.Start(this); //sleep for a bit to ensure that javascript has a chance to get rendered Thread.Sleep(100); } public static void UpdateDatabase(object con) { if (Monitor.TryEnter(myLock)) { Updater.RepopulateDatabase(); Monitor.Exit(myLock); } else { Common.RegisterStartupScript(con, AlreadyLockedJavaScript); } } And I do not want to do if(Monitor.TryEnter(myLock)) Monitor.Exit(myLock); else //show processing labal As I imagine there is a slight possibility that it might display the notification when it isn't actually running. Is there an alternative I can use? Edit: Hi Everyone, thanks a lot for your suggestions! Unfortunately I couldn't quite get them to work... However I combined the ideas on 2 answers and came up with my own solution.

    Read the article

  • Forward, redirect, forward!! How do I check parameters being sent?

    - by Arjun
    There's this form that I'm placing on a site. This form submits some parameters to a site which then sends some parameters using "GET" to another site, which then opens the third site. Now the first 2 sites pass so quickly that I can not see what parameters were passed using the URL. I just need a simple tool or hint or firefox addon or ANYTHING ELSE on how to track what parameters were sent to url1, url2 etc. There's got to be some tool for this, only I can't seem to find it! Argh!

    Read the article

  • How can I write a MySQL query to check multiple rows?

    - by Matt
    I have a MySQL table containing data on product features: feature_id feature_product_id feature_finder_id feature_text feature_status_yn 1 1 1 Webcam y 2 1 1 Speakers y 3 1 1 Bluray n I want to write a MySQL query that allows me to search for all products that have a 'y' feature_status_yn value for a given feature_product_id and return the feature_product_id. The aim is to use this as a search tool to allow me to filter results to product IDs only matching the requested feature set. A query of SELECT feature_id FROM product_features WHERE feature_finder_id = '1' AND feature_status_yn = 'y' will return all of the features of a given product. But how can I select all products (feature_product_id) that have a 'y' value when they are on separate lines? Multiple queries might be one way to do it, but I'm wondering whether there's a more elegant solution based purely in SQL.

    Read the article

< Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >