Jump to content

floridaflatlander

Members
  • Posts

    671
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by floridaflatlander

  1. What is it, what are you doing? I see ads and subjects for everything. It looks every plain to me. Why would anyone want to go there. Want's your angle? What are you doing?

  2. 10 seconds is not enough time to prevent a double-submit.

    Or even one second

     

    Or you can try

     

    if (isset($_POST['submit'])) {
    
    // Check for a name:
    if (empty($_POST['name'])) {
    $error [] = 1;
    $name_e = '<h5 style="color: red;">* You forgot to enter a name.</h5>';
    } else {
    $name = $_POST ['name'];
    $name = mysqli_real_escape_string($dbc, trim($name));
    }
    
    // The other $_POST
    
    if (!$error) {
    // Run UPDATE query
    
    if ($results){ // Or mysqli_affected_rows might be better
    $name_submitted = ''; // Or any variable that would make sense.
    }
    }
    
    }

     

    <input type="text" name="name" size="90" value="<?php if (!empty($name_submitted)) {echo $name_submitted;} elseif  (!empty($name)) {echo $name;}  ?>" />

  3. Think of forum posts here...

    I see

     

    Can you right it so the check will be for the last 10 seconds?

     

    If they are double clicking it and I think they are I bet the odds are you'll need less than 10 seconds, you may need less than one second.

     

    You may need something like this

    PS - You should also disable your button onclick with javascript to prevent double-submission at the client side
  4. floridaflatlander - some clients use the same email for all their department.

    Is it ok for 2 users with the same email to submit topics at the same time. I just don't want that each one of them will submit the same topice twice...

     

    If that's the case you have to do what ever is unigue. name/title etc.

  5. Hello,

     

    From time to time I found duplicated records (rows) in my database. Its looks like the user double click on the submit button.

    recently its happen more often so I add code that check when the last submit happened (I save the linux time) and check if there is 10 second delay:

     

    $query = mysql_query("SELECT create_date FROM `tkts_topics` WHERE (client = '$client') AND (email = '$email') AND (title = '$title') AND ($date - create_date <= 10) LIMIT 0,1");

    if (mysql_num_rows($query))

    {

     

    }

     

    I don't know why but its not working.

    is there any better way to prevent double submiting?

     

    Roi.

    Okay so all you're doing is checking for duplicates right?

     

    Why do you need to use date in your select, can user name or email and title be enough? Unless I'm wrong it just adds stuff.

     

    Also I'd use either client or email but not both since a member's name and email are both unique(I would think). So I'd try

    $query = "SELECT title FROM tkts_topics WHERE email = '$email' AND title = '$title' ";

    $r = mysqli_query($dbc, $query);

  6. ... I use $member_id.time() for file(picture) names.

     

    Actually I use member id then an underscore and then time

     

    As long as it is UNIQUE and FIXED-WIDTH, I really don't care...

     

    Well, and it shouldn't advertise "non-public" info like "member ID", so maybe I disagree some...

     

     

    Debbie

     

    Okay #113246

  7. What do you mean wont die? A couple of months ago I was doing some stuff with a cookie that would cease when the browser was closed and look and it was still present in name after I closed and reopened the browser however the cookie would not work on the site, it had expired. I can't remember which browser using.

     

    PS. open your browser and click the cookie name, it will tell you when it expires.  If it is a past date or time it is no good, it's just listed in the browser waiting to be deleted.

  8.  

    if (!empty($row[username])) // he got it.

    {

    $_SESSION[username] = $row[username];

    echo "Welcome $_POST[username]! You've been successfully logged in. <a href=\"/index.php\" title=\"Click here to go back to the homepage.\">Home Page</a></li></ul>";;

    exit();

    }

     

    I don't know why you have two semi colons above.

     

    you need session_start(); at the top of every page that you're going to use sessions, it needs to be the first thing on the page after the opening php tag and a few comments if any.

     

    you can

    echo "Welcome {$row['username']}! You've been successfully logged in. <a href=\"/index.php\" title=\"Click here to go back to the homepage.\">Home Page</a></li></ul>";

     

    or

     

    echo "Welcome {$_SESSION[username]} You've been successfully logged in. <a href=\"/index.php\" title=\"Click here to go back to the homepage.\">Home Page</a></li></ul>";

     

    or get rid of all that double quote stuff

     

    echo 'Welcome '.$_SESSION[username].'! You've been successfully logged in. <a href="/index.php" title="Click here to go back to the homepage.">Home Page</a></li></ul>';

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.