Check if user is already taken!?

Hi,
can anyone help, I have successfully contacted the database and also been able to add a new row of info. But before I do this, i want to check and see if the username already exists. How do I do this. below is my jsp page for a member registration to process. THANKS in advance.
kramer
<html>
<head>
<title>Register</title>
</head>
<%@ page import="java.sql.*" %>
<body>
Registration Complete
<hr><br>
<%
String user = request.getParameter("username");
String pass = request.getParameter("password");
String email = request.getParameter("email");
String url = request.getParameter("url");
%>
<%
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:testdb");
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String sqlStatement = "INSERT INTO users(username,password,email,url,cr_earned,cr_used) VALUES ('"+user+"','"+pass+"','"+email+"','"+url+"',"+100+","+0+")";
stmt.executeUpdate(sqlStatement);
con.close();
%>
<br>
Your account was successfully setup.
</body>
</html>

This is precisely what i want to do. The purpose here is to sign up a user, but I don't want two users with the same username. So I just want it to check and see if that username is already taken. If it is taken, it can print something or reject then back to the signup page. If the username is not taken, if will add the row. Really simple. Here is my updated working code that still needs the if satement, i just don't kow how to do it....
<%
String user = request.getParameter("username");
String pass = request.getParameter("password");
String email = request.getParameter("email");
String url = request.getParameter("url");
%>
<%
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:testdb");
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String sql = "SELECT * FROM users WHERE username = '" + user + "'";
final ResultSet rs = stmt.executeQuery(sql);
String sqlStatement = "INSERT INTO users(username,password,email,url,cr_earned,cr_used) VALUES ('"+user+"','"+pass+"','"+email+"','"+url+"',"+100+","+0+")";
stmt.executeUpdate(sqlStatement);
con.close();
%>

Similar Messages

  • I tried to download a movie on my iPod touch but due to limited space, it did not download.  Then, I checked my credit card online, and I found the money was already taken.  How will I get it to download on another device with the same account?

    I tried to download a movie on my iPod touch but due to limited space, it did not download.  Then, I checked my credit card online, and I found the money was already taken.  How will I get it to download on another device with the same account? Also, I was wondering why they took my money even when it did not finish downloading let alone get downloaded?

    Welcome to the Apple Community.
    You can re-download content purchased from the iTunes store (availability varies depending on location) using the purchased option from the Quick Links section in the top right corner of the iTunes homepage in your iTunes application on your computer.
    You can re-download content purchased from the iTunes store (availability varies depending on location) using the purchased option which is revealed in the iTunes app on your iOS device by tapping the more button at the bottom of the screen.

  • Is it possible to restore Gamecenter after update and restore?? After update, tried logging into Gamecenter and it says that the user name is already taken. Yeah, I know..... by me!!!

    One of my kids ipods needed an update. It wouldn't let me do it via the itouch (like the other 2 itouches did). I had to connect to the PC, sync, update and then restore. Once I did, the apps could be downloaded again via icloud (which wasn't on the itouch before) but progress on games that were through Gamecenter did not transfer. Tried logging into Gamecenter and it states the user name is already taken. Yeah, I know it's already taken, BY MY DAUGHTER!!! Apparently she has a dragon game app that she manages through Gamecenter that she has worked her way to level 22 and now it is all gone. It wants her to restart from level 1. I know this isn't life or death and not like losing work data etc. But to a 9 year old who has spent $40 of her own money on gems, coins etc....... this is the end of the world. LOL. I do want to try to help her, I just don't know how.

    Thank you. After posting I started to search for Backflip studios and found this support id. I had meanwhile created a new nickname, very similar to the original one, and requested that they swap the advanced world to the new id. I sent this last Saturday evening. This morning (so effectively on their first workday after my request!) I received a kind response from Rachael that they had swapped the parks. Like your daughter my son couldn't believe his eyes. Thank you for your post, original and reply, I hope others will find it too and that Rachael can keep up such excellent support. It means a lot...

  • How can I tell if a user has already authenticated against AD?

    Sorry to begin with if this has been dealt with in another thread already. Ive taken a look around and cant see something that answers my questions exactly. If such a thread exists, please point me in that direction.
    We have a product that needs to be installed on a customer site. Its a windows based, web fronted application with a client program on the user's pc and a server side component that handles requests for data. What I need to do is to check if the user has already authenticated against active directory. If so then I dont need to ask for authentication (single sign on).
    This is my first look at jndi so Im in the dark about how this should be done. Is there a way to use the user's credentials (is there a token?) to check or do I need a specific login for my application to access the customer AD?
    Any tips would be very welcome,
    Mark

    You may want to refer to the Java Security forum at http://forum.java.sun.com/forum.jspa?forumID=545 for information on Kerberos & JAAS.
    There is a also a post in this forum, outlining how to utilise Kerberos, JAAS with JNDI to access Active Directory. JNDI, Active Directory and Authentication (Part 1) (Kerberos)
    at http://forum.java.sun.com/thread.jspa?threadID=579829&tstart=300
    Possibly the part you are looking for is the functionality included in the class that implements java.security.PrivilegedAction
    Good luck.

  • WLS 12.1.2.0.0 : Another user (admin2) already owns the lock.

    hi
    Please consider a WebLogic Server 12.1.2.0.0 that is NOT in Production Mode (so in Development Mode).
    When is a button like "Take Lock & Edit" (ever) to be expected?
    Or messages like :
    - "admin2 is currently making changes."
    - "Another user (admin2) already owns the lock. You will need to either wait for the lock to be released, or take the lock."
    If both users "admin1" and "admin2" are in the "Administrators" group,
    the following scenario (sc1) seems to be reproducible:
    - (sc1-a) start a first browser session and login on the WLS admin-server console using "admin1"
    - (sc1-b) start a second browser session and login on the WLS admin-server console using "admin2"
    - (sc1-c) in the second browser session, click Deployments
    - (sc1-d) in the first browser session, click Deployments and see the "Take Lock & Edit" button and messages
    -- "admin2 is currently making changes."
    -- "Another user (admin2) already owns the lock. You will need to either wait for the lock to be released, or take the lock."
    The scenario (sc1) is included in the screencast
    at http://screencast.com/t/Yw3k3EI1
    - (q1) Is the lock message in scenario (sc1) intended behavior?
    It could be that these "locks" are causing our Jenkins jobs (doing an Ant wldeploy task) to fail when someone is "browsing" using the WebLogic Server console, with
    weblogic.management.provider.EditWaitTimedOutException: Waited 0 milliseconds
        at weblogic.management.provider.internal.EditLockManager.getEditLock(EditLockManager.java:259)
        at weblogic.management.provider.internal.EditAccessImpl.acquireLock(EditAccessImpl.java:266)
        at weblogic.management.provider.internal.EditAccessImpl.startEdit(EditAccessImpl.java:297)
        at weblogic.deploy.internal.adminserver.EditAccessHelper.startEditSession(EditAccessHelper.java:72)
        at weblogic.deploy.internal.adminserver.operations.AbstractOperation.execute(AbstractOperation.java:236)
        at weblogic.management.deploy.internal.DeployerRuntimeImpl$2.run(DeployerRuntimeImpl.java:846)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.management.deploy.internal.DeployerRuntimeImpl.performDeployerActions(DeployerRuntimeImpl.java:840)
        at weblogic.management.deploy.internal.DeployerRuntimeImpl.deploy(DeployerRuntimeImpl.java:418)
    many thanks
    Jan Vervecken

    The answer to this "(q1) Is the lock message in scenario (sc1) intended behavior?" you already know. Just for good measure see the documentation on managing locks (5 Managing a Domain's Configuration with JMX). Note that in development mode the locking in the admin console is automatic, you can change this in Admin Console - click the preferences link, User Preferences tab, here you can change the 'Automatically Acquire Lock and Activate Changes' option.
    WebLogic provides a ConfigurationManagerMBean (http://docs.oracle.com/middleware/1212/wls/WLMBR/mbeans/EditServiceMBean.html?skipReload=true#ConfigurationManager) that provides methods for safely starting an edit session. You can use haveUnactivatedChanges (http://docs.oracle.com/middleware/1212/wls/WLMBR/mbeans/ConfigurationManagerMBean.html?skipReload=true#haveUnactivatedChanges) to check if there are any pending changes (this gives you an indication if someone that has taken a lock is doing some actual changes to the system, such that the ANT job can decide not to start an edit session). If there is an edit session going on and there are no pending changes you can call undoUnactivatedChanges (http://docs.oracle.com/middleware/1212/wls/WLMBR/mbeans/ConfigurationManagerMBean.html?skipReload=true#undoUnactivatedChanges) - now the ANT job can start a new edit session.
    The following example shows the use of the ConfigurationManager (in Java with JMX)
                            Object[] unactivatedChanges = (Object[]) editConnection.getAttribute(configManager, "UnactivatedChanges");
                            if (unactivatedChanges.length > 0) {
                                System.out.println("ACTIVATING CHANGES");
                                editConnection.invoke(configManager, "activate",
                                        new Object[] { new Long(120000) }, new String[] { "java.lang.Long" });
                            } else {
                                System.out.println("CANCEL EDIT SESSION");
                                editConnection.invoke(configManager, "cancelEdit", null, null);
    More information can be found on using the EditService and ConfigurationManager can be found here: Middleware Snippets: Automatic Scaling an Application Using WebLogic (and the references therein).

  • Says Email is already taken, cannot find that email

    Only one server. I'm on my desktop connecting through web URL. Only one server

    Usually when it says an email is already taken, it is in Inactive People. However this time it is not there this time. I checked high and wide and cannot find it. 
    Yes, this used to be a user, however someone change/messed up their email address to something different. I fully deleted that entry (I cleared it out of Inactive People) and still it says the email is taken when I try to re-create that user.
    This topic first appeared in the Spiceworks Community

  • Commenting via iPod in iTunes store: lost text if nickname already taken

    I'd like to report a bug that really bugs me. I'll also send this to some Apple support address but would like to inform the community as well. Also to see if I'm the only one or if I'm doing sth wrong.
    On my iPod Touch 3G (3.1.3, Darn!), when I want to comment on or rate an app or a podcast in the iTunes store, after logging in I'm asked for an alias prior to the headline and text of the comment. I choose one, then I write my comment, slowly and painfully on the small touch screen keyboard. When I send it, the store tells me the nickname is already taken and ... deletes my comment!
    WHY?
    Could the store please check beforehand if the name is ok or at least not delete the comment? I have to rewrite the whole thing and try another name.
    Is this a bug or am I doing sth wrong? Is anybody else annoyed by this?

    Well,
    A Jason from the Apple support has answered my mail. It's obviously not a bug but sth that could be enhanced in future versions of the store/ iTunes.
    I wonder why nobody else has so far had this problem.

  • How to check whether User is alreadylogged in or not

    Hi..I want to check whether Particular User is already logged in or not ?? I had userid,password and status in my database.
    If anybody shows me how to implement it ??
    Reggards
    Chintan

    If you want to prevent multiple logins happening, use a profile on the database server that limits a login to a set number of simultaneous connections.
    If you just ant to check which users are logged in, the v$session table will have that information.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to check if the file already exists in the client directory

    Hi all.
    I'm on devsuite 10g. I'm using webutil to download files from DB using webutil function db_to_client.
    What I need is to check if the file already exists in the client directory and if yes to display a message to ask the user if he wants to overwrite or no. How can I make this???
    Here is the code that I'm using to download the file.
    Thanks all for the collaboration.
    Fabrizio
    declare
    file_path varchar2(2000) := null;
    BEGIN
    /** I ask where saving the file on the client machine **/
    file_path:= webutil_file.file_selection_dialog
    (directory_name => null,
    file_name => :bin_docs.name,
    file_filter => '',
    title => 'Saving file',
    dialog_type => save_file, --save_file
    select_file => TRUE);
    /** I download the file from DB to client **/
    if webutil_file_transfer.DB_To_Client_With_Progress
    ( file_path ,
    'BIN_DOCS',
    'DOC' ,
    'doc_id = '||:bin_docs.doc_id,
    'Downloading file',
    ' '||:bin_docs.name) then
    msg_alert('Download del file avvenuto con successo','I',false);
    else
    msg_alert('Si è verificato il seguente errore in fase di download '||SQLERRM,'I',false);
    end if;
    end;

    How about something like the below:
    Note: I have a yes/no alert to asking if they want to over-write the existing file.
    DECLARE
    file_path VARCHAR2(2000) := null;
    over_write BOOLEAN := TRUE;
    BEGIN
    /** I ask where saving the file on the client machine **/
    file_path:= webutil_file.file_selection_dialog
    (directory_name => null,
    file_name => :bin_docs.name,
    file_filter => '',
    title => 'Saving file',
    dialog_type => save_file, --save_file
    select_file => TRUE);
    IF webutil.file_exists(file_path) THEN
    /** check a file by the same name exists in the selected directory **/
    IF show_alert('Ask_overright') != alert_button1 THEN
    /** If we say no then set over_write value to false **/
    over_write := FALSE;
    END IF;
    END IF;
    IF over_write THEN
    /** I download the file from DB to client **/
    IF webutil_file_transfer.DB_To_Client_With_Progress
    ( file_path ,
    'BIN_DOCS',
    'DOC' ,
    'doc_id = '||:bin_docs.doc_id,
    'Downloading file',
    ' '||:bin_docs.name) then
    msg_alert('Download del file avvenuto con successo','I',false);
    ELSE
    msg_alert('Si è verificato il seguente errore in fase di'
    ||' download '||SQLERRM,'I',false);
    END IF
    END IF;
    END;
    cheers
    Q

  • Nickname is already taken

    I'm new to Mac and am already frustrated. I just wanted to play a game to kill some time. When I go into the game center, it asks for my apple id and password. No problem there. But then it wants my age. What if I don't want to give it?  It also asks for a nickname. So I give it one. But its already taken. I don't really care, I don't want to interact on line, I just want to play a game. I don't want anything made public. So what if there are a million on us with the same nickname. I know a lot of people with the same nickname. Would you change your nickname if someone at your new job has the same one? Probably not.
    So the questions is, can I get into game center without a nickname? Is it even worth the effort or should I just go get my own games?
    Thanks
    Clifford

    Nick --
    Go to the Apple Store and check out all the games there.  Personally, I have no interest in playing with other people.  I found lots of free games, puzzles, and fun stuff to do when bored.

  • Executing a powershell script for checking duplicate users while creating a AD user throug ADUC console.

    Hi,
    I have a text file in which some SamAccountNames are present.I need to check the file while creating a new users through ADUC console.If a username that is going to create through ADUC console is present in the file, then it should prompt a message
    that the user is already present in the text file.
    Is there any possibility of contacting the powershell script from the ADUC console.If so, then while creating a new user through ADUC console, what is the proceedure for executing that powershell script.
    please provide me the approriate solutions.
    Thanks
    Prasanthi k

    Run the below Powershell Script for users are exist or not in AD. Later you can create the users.
    #Find Users exist in AD or Not?
    #Biswajit Biswas
    $users = get-content c:\users.txt
    foreach ($user in $users) {
    $User = Get-ADUser -Filter {(samaccountname -eq $user)}
    If ($user -eq $Null) {"User does not exist in AD ($user)" }
    Else {"User found in AD ($user)"}
    Active Directory Users attributes-Powershell
    http://gallery.technet.microsoft.com/scriptcenter/Getting-Users-ALL-7417b71d
    Regards~Biswajit
    Disclaimer: This posting is provided & with no warranties or guarantees and confers no rights.
    MCP 2003,MCSA 2003, MCSA:M 2003, CCNA, MCTS, Enterprise Admin
    MY BLOG
    Domain Controllers inventory-Quest Powershell
    Generate Report for Bulk Servers-LastBootUpTime,SerialNumber,InstallDate
    Generate a Report for installed Hotfix for Bulk Servers

  • SU53 message "Check for user _SYSTEM"

    Hello All,
    We have been facing issues lately during some imports with BPC environments from D to Q.
    The team sent me the SU53 screenshot as attached below.
    The user who sent me the screenshot has the missing object access already, i noticed the entry : Check for User _SYSTEM.
    We are unable to identify which user could it be as we dont have a user called _SYSTEM in our system.
    Is there a way to find out the User for which this access is being checked?

    Very interesting case...
    AUTHORITY-CHECK statement has the capability to check foreign user access although you are running the program. See docs on the statement in tcode ABAPDOCU.
    In this case, the FOR USER variable is either hardcoded or coming from some customizing.
    What you need to do is get the user to run this SU53 and then hit the save button. Then go to table USR07 for than user and the check and at the end of the table fields you will see the program context and line at which it happened. Then go to SE80 to display that code and look to see what happens before the AUTHORITY-CHECK statement (particularly where the FOR USER variable is coming from).
    99 times out of 100 it is a configuration problem (very strange one...) caused by not reading the documentation or there is no documentation....
    Good luck and let us know what you find. It is an interesting problem which I have also seen increasing recently. Makes it very confusing for security admins and application support when trouble shooting and they expect SU53 to tell the truth, but the feature itself is very cool if used correctly and you take note of the "reason codes" for the check.
    Cheers,
    Julius

  • Check current user exist people or group column

    How to check current logged in user name already exist in people or group column of share-point custom list 2013 using c#?
    Note: People or group column contains multiple items.
    Thanks in advance

    You can use javascript to get current user and then perform vlookup on the field
    Current use
    function CallClientOM()
    var context = new SP.ClientContext.get_current();
    this.website = context.get_web();
    this.currentUser = website.get_currentUser();
    context.load(currentUser);
    context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
    function onQuerySucceeded(sender, args)
    alert(currentUser.get_loginName());
    function onQueryFailed(sender, args)
    alert('request failed ' + args.get_message() + '\n'+ args.get_stackTrace());
    http://spjsblog.com/2010/03/18/vlookup-type-rollup-for-sharepoint/
    If this helped you resolve your issue, please mark it Answered

  • How to access apple support forum on "This username - is already taken, please choose another. Another has been provided" message?

    Sorry I could not find a better user forum for this question....
    See screenshots: This username "*" is already taken, please choose another. Another has been provided.
    If I enter a different forum username it tells me that the account is already associated with another user ID (I suspect the first one I tried). 
    How am I supposed to continue? 

    you'll see that I am prevented from choosing another name.
    Ah! But no, that's not a bug, either. Once you create a user account, that name is locked. You can't change it. For this particular name, all you can do is ignore it. It will eventually be archived off the servers, never to be seen again.
    To start over, you have to fool your web browser into believing you've never been here before. Launch Safari, but do not navigate to these forums. Open Safari's preferences and click on the Privacy tab. Where it says Cookies and other website data, click on the Details button. The trouble is figuring out which one to remove. I think it's apple.com . Try removing that cookie and then come here. If you got rid of the right one, you'll be able to create a new account.

  • How to check SSO user from database?

    Hi:
    I've posted this topic in Forms forum:
    How to check SSO user from database?
    then as I've been told, it's better to post it here, so ...... here is the question:
    I'm writing a "before delete trigger" to insert into log table before delete. Is there a way that I know from database the current SSO user when SSO users share one database user?
    Just like in Oracle Application Express there is v('APP_USER') to know the current user.
    Saad,

    End users are manipulating data through Oracle Forms(and SSO through portal) and the thing I need is to trace the SSO username from database without modifying forms, I mean purely from database taking into consideration that SSO users are sharing one database user. Is it possible?
    Saad,

Maybe you are looking for

  • How do I redeem a gift card in the South African storefront?

    How do I redeem a gift card in the South African storefront?

  • T420 - Intel Wireless and Windows XP issue?

    Has anyone else seen any issues with using the Intel Wireless Advanced-N 6205 card on Windows XP? I have a 4178-6UU and it will work for a while, then just stop receiving packets, but will not disconnect even though it doesn't work and I am no longer

  • How can i make sure the graphic file from my subcontract create is really llegal?

    how can i make sure the graphic file from my subcontract create is really llegal? They have creat the PNG file which creat from Adobe Illustrator CS5. I have try checking on Metadata In Adobe Bridge, and it seem to be blank. So i would likt to know h

  • Dev. 6.0 java reports

    After opening RunReportTester.html in IE4.0, entering fields and pressing trun reportv button nothing happens and no reports in report server queue. FROM JAVA CONSOLE Exception occurred during event dispatching: java.lang.NoClassDefFoundError: oracle

  • Migration from Single Node to RAC Node

    Hi, We are planning to migrate the Database from Single-Node to RAC Node. Are there any checklist list to be considered regarding Performance, System and Database ( or any other topic), before migrating to RAC. Thanks