+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: How to detect duplicate users?

  1. #1
    lucasvm is offline Junior Member
    Join Date
    Dec 2008
    Posts
    10

    How to detect duplicate users?

    Sorry bad category...
    Last edited by lucasvm; 12-09-2008 at 01:19 PM.

  2. #2
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15
    Quote Originally Posted by lucasvm View Post
    Hello

    I got a form where users singup and they can win a gift, but how can i detect if someone register more than one time?, is there any way to know if there is a duplicate entry? and if there is another users with same email o name dont let them register...sorry my bad bad english im spanish speaker, hope you can help me out...

    So your question is related to code that is working with Salesforce or just a general PHP form question? I need some more information to be able to help you out

    ~Mike

  3. #3
    lucasvm is offline Junior Member
    Join Date
    Dec 2008
    Posts
    10
    im working with salesforce with a form oh php and i need to check that before letting users register to win a gift, sorry my bad english...the form works great and it sends the info to my salesforce database but it doesnt check if it is a duplicate mail or user....

  4. #4
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15
    I see what you are trying to do

    Give me a day or so to think about it and see if I can come up with a resolution for you sir

    Thanks for joining the site by the way

    ~Mike

  5. #5
    lucasvm is offline Junior Member
    Join Date
    Dec 2008
    Posts
    10
    great, thanks for your reply and help.- i really dont get it with the salesforce API...i need to check it in the form made with html/php before they send the info, so if they are already in the database then it wont register...i dont know if my english is good, sorry.
    Last edited by lucasvm; 12-09-2008 at 05:16 PM.

  6. #6
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15

    This maybe a way to check for duplicates

    So if you are wanting to check to see if you have duplicates in the object in Salesforce, you could try something like this:



    PHP Code:

    $wsdl 
    './includes/soapclient/partner.wsdl.xml';
    $userName "myemail@salesforce.com";
    $password "password";
    $client = new SforcePartnerClient();
    $client->createConnection($wsdl);
    $loginResult $client->login($userName$password);

    //check to see if the form has been submitted
    if (isset($_GET['submit']))
    {

         
    //prepare a SOQL statement to Salesforce to check
         //your table in Salesforce to see if the email matches the one coming
         //in from the form

         
    $soql "Select Email FROM Lead where email like '{$_GET['email']}%' ";

         
    $leads get_records($client$soql);
         

         

         
    /*so if  you get something back from the get_records function, that means you have a match of the email in your
           salesforce database.  You can compare the leads object email to your $_GET['email'] and if they match you can 
           render a message back to the user saying something like "you already registered, only one person is allowed to 
           register".*/
           
        
    if($leads->email == $_GET['email'])
        {
            echo 
    "ou already registered, only one person is allowed to register";
        }
        else
        {
            
    //insert the new lead or record into your table here   
        
    }


    }





    function 
    get_records(&$connection$query)
    {
      try
      {
        
    $queryOptions = new QueryOptions(500);
        
    $response $connection->query(($query), $queryOptions);
    // check count to see if we are done
        
    if ($response->size 0)
        {
          
    $accounts $response->records;
    // Cycles through additional responses if the number of records
    // exceeds the batch size
          
    while (!$response->done)
          {
            
    set_time_limit(100);
            
    $response $connection->queryMore($response->queryLocator);
            
    $accounts array_merge($accounts$response->records);
          }
        }
        return 
    $accounts;
      }
      catch (
    exception $e)
      {
    // This is reached if there is a major problem in the data or with
    // the salesforce.com connection. Normal data errors are caught by
    // salesforce.com
        
    echo '<pre>' print_r($etrue) . '</pre>';
        return 
    false;
        exit;
      }

    Hope this makes sense man!

    ~Mike

  7. #7
    lucasvm is offline Junior Member
    Join Date
    Dec 2008
    Posts
    10
    great thanks i will try it, just one question, i got my form sending to a salesforce url, not mine, and i cant add code there, is there a way to add this php code into the form?, <form method="post" action="here i send to a salesforce url" id="form"> what do you think???????????

    i do this to validate fields: onsubmit="return validation4(this); but with javascript...

    Edit:

    mmmm maybe i would add the salesforce url here:

    if($leads->email == $_GET['email'])
    {
    echo
    "ou already registered, only one person is allowed to register"
    ;
    }
    else
    {


    https://www.salesforce.com/servlet/servlet.AFDSFSDFSFS


    }


    what you think?, but the problem is the form heheh
    Last edited by lucasvm; 12-10-2008 at 02:24 PM.

  8. #8
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15

    Unhappy sorry I dont think I know

    oh shoot I thought that this was an external form. You are actually sending the data right into salesforce. So you action is actually some kind of form right on Salesforce?

    I must be a newbie at this because I did not see that or know that you could do that

    I am not sure how you would get this code in there, I mean I know that you cannot add code like PHP into Salesforce, it will not work

    ~Mike

  9. #9
    lucasvm is offline Junior Member
    Join Date
    Dec 2008
    Posts
    10
    oh bad news hehe, i did not make this form...it was another developer...did you read this?

    Edit:

    mmmm maybe i would add the salesforce url here:

    if($leads->email == $_GET['email'])
    {
    echo
    "ou already registered, only one person is allowed to register"
    ;
    }
    else
    {


    https://www.salesforce.com/servlet/servlet.AFDSFSDFSFS


    }


    but i dont know how to change the form, how can i do?

  10. #10
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    557
    Blog Entries
    15
    hey man did you ever get this working or figured out?

    ~Mike

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.1