Simple IP Ban System Doesn't Seem To Work.

Alright i have this;
import java.io.*;
public class security {
public static final String[] ip_bans = {"82.25.128.xxx", "127.0.0.1"};
public static boolean is_ip_banned(String a) {
     for (int i = 0; i < ip_bans.length; i++) {
          if (ip_bans[i] == a) {
               return true;
     return false;
}(xxx is actually numbers, blocked it out for security reasons).
Which i put together to hopefully check for ip bans, now i have this:
public void run() {
     try {
     shutdown_client_handler = false;
     client_listener = new java.net.ServerSocket(server_port, 1, null);
     misc.cmd_message("Server was succesfully started.");
     misc.cmd_message("Server is operating on port: "+client_listener.getLocalPort()+"");
     while (true) {
          java.net.Socket s = client_listener.accept();
          String connecting_host = s.getInetAddress().getHostAddress();
          s.setTcpNoDelay(true);
          if(true && !security.is_ip_banned(connecting_host)) {
                    misc.cmd_message("A connection from "+connecting_host+" was accepted.");
                    player_handler.new_player_client(s, connecting_host);
          } else {
               misc.cmd_message("A connection from "+connecting_host+" was declined.");
               s.close();
     } catch (Exception e) {
          Exception!
          if(!shutdown_client_handler) {
               misc.cmd_message("There was an error opening the port.");
               misc.cmd_message("The port "+server_port+" may already be in use.");
          } else {
               misc.cmd_message("The client handler was shut down.");
}However, it still accepts the connect even though my ip is in the ip ban string.
Help please :).

Ryan_Stanyer wrote:
I changed it to
if (ip_bans.equals("a")) {
however it still allows me to connect as if my ip wasn't in the string[].
No, it is saying the String literal "a" was not found in the Strings array ip_bans.
It never checks the value you pass in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • I can't hear anything from my mac air .. the sound system doesn't seem to work, i can't hear anything from my mac air .. the sound system doesn't seem to work

    what do i do to fix this ??

    Have you checked System Preferences/Sound/Output to see  if it is set to Internal Speakers and to make sure the Mute checkbox isn't checked?

  • I would like to cancel my subscription for Adobe ExportPDF Subscription that I have just signed up for as it doesn't seem to work with my system. How do I do this ?many thanks suslucie

    I would like to cancel my subscription for Adobe ExportPDF Subscription that I have just signed up for as it doesn't seem to work with my system. How do I do this ?many thanks suslucie

    Hi Susan,
    I checked using the email you provided, and there's no history of any orders under that email address. (Then, I removed your email address from you post, since this is a public forum and it's best not to broadcast contact information.)
    I'll message you privately, and you can send along your email from Adobe if you'd like.
    Best,
    Sara

  • I used to be able to download files from the Harddrive of my Sony Handycam, but now it won't let me import them while going through "log and transfer."  I have tried to update my settings, but this doesn't seem to work.  Any help would be much appreciated

    I used to be able to download files from the Harddrive of my Sony Handycam, but now it won't let me import them while going through "log and transfer."  I have tried to update my settings, but this doesn't seem to work.  Any help would be much appreciated

    Hard Drive:  The Hard Drive is on my camera (Sony Handycam)
    Just needed some info on what is going on with your particular system.
    Knowing the exact camera model will also assist us.
    If this camera is standard AVCHD you should be able to connect with USB to Mac with FCE open and use Log and Transfer without all the fiddling around converting etc.
    What FCE does during ingest is convert files to AIC. (Apple Intermediate Codec)
    FCE cannot read the individual files in the BDMV folder, that's why all the converting is required when you use that method.
    BTW: regards formatting drives/cards/memory on cameras; it is wise to use the actual device to format rather than a computer. This is a prime cause of read/write goof ups with solid state media. This applies to still or video cameras.
    Keeping the COMPLETE card/memory structure in tact is vital for successful transfers.
    Try here for some trouble shooting tips:
    https://discussions.apple.com/message/12682263#12682263
    Al

  • Oraenv doesn't seem to work

    Version : 11.2.0.3
    Platform : Oracle Linux 6.3
    oraenv doesn't seem to work as shown below. I haven't set ORACLE_SID in the .bash_profile as this server is going to have multiple DBs in future. So, I need to use oraenv script to set env variables.
    Trying to source oraenv file.
    $ . oraenv
    ORACLE_SID = [oracle] ?
    Ideally, it should prompt the SID listed in /etc/oratab file. So, in this case it should be something like
    $ . oraenv
    ORACLE_SID = [oracle] ? GRCFMS
    Here are the contents of my /etc/oratab file and .bash_profile
    # su - oracle
    $
    $
    $
    $
    $
    $
    $ whoami
    oracle
    $ pwd
    /home/oracle
    $ cat .bash_profile
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    # User specific environment and startup programs
    #PATH=$PATH:$HOME/bin
    #export PATH
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
    #export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export PATH=$PATH:$ORACLE_HOME/bin:/usr/bin:/bin
    $
    My oratab file
    $ cat /etc/oratab
    # This file is used by ORACLE utilities.  It is created by root.sh
    # and updated by either Database Configuration Assistant while creating
    # a database or ASM Configuration Assistant while creating ASM instance.
    # A colon, ':', is used as the field terminator.  A new line terminates
    # the entry.  Lines beginning with a pound sign, '#', are comments.
    # Entries are of the form:
    #   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
    # The first and second fields are the system identifier and home
    # directory of the database respectively.  The third filed indicates
    # to the dbstart utility that the database should , "Y", or should not,
    # "N", be brought up at system boot time.
    # Multiple entries with the same $ORACLE_SID are not allowed.
    GRCFMS:/u01/app/oracle/product/11.2.0.3/dbhome_1:N
    $
    $
    $

    Max wrote:
    Version : 11.2.0.3
    Platform : Oracle Linux 6.3
    oraenv doesn't seem to work as shown below. I haven't set ORACLE_SID in the .bash_profile as this server is going to have multiple DBs in future. So, I need to use oraenv script to set env variables.
    Trying to source oraenv file.
    $ . oraenv
    ORACLE_SID = [oracle] ?
    Ideally, it should prompt the SID listed in /etc/oratab file. So, in this case it should be something like
    $ . oraenv
    ORACLE_SID = [oracle] ? GRCFMS
    Here are the contents of my /etc/oratab file and .bash_profile
    # su - oracle
    $
    $
    $
    $
    $
    $
    $ whoami
    oracle
    $ pwd
    /home/oracle
    $ cat .bash_profile
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    # User specific environment and startup programs
    #PATH=$PATH:$HOME/bin
    #export PATH
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=/u01/app/oracle/product/11.2.0.3/dbhome_1
    #export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export PATH=$PATH:$ORACLE_HOME/bin:/usr/bin:/bin
    $
    My oratab file
    $ cat /etc/oratab
    # This file is used by ORACLE utilities.  It is created by root.sh
    # and updated by either Database Configuration Assistant while creating
    # a database or ASM Configuration Assistant while creating ASM instance.
    # A colon, ':', is used as the field terminator.  A new line terminates
    # the entry.  Lines beginning with a pound sign, '#', are comments.
    # Entries are of the form:
    #   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
    # The first and second fields are the system identifier and home
    # directory of the database respectively.  The third filed indicates
    # to the dbstart utility that the database should , "Y", or should not,
    # "N", be brought up at system boot time.
    # Multiple entries with the same $ORACLE_SID are not allowed.
    GRCFMS:/u01/app/oracle/product/11.2.0.3/dbhome_1:N
    $
    $
    $
    if in fact you did exactly as posted above, the su - oracle established a new process which knows nothing about the previous invocation of oraenv
    BTW - never use OS "root" when dealing with Oracle DB

  • SetDocument doesn't seem to work correctly

    I'm obviously using the setDocument method for my JTextField incorrectly, but how? The DocumentSizeFilter works correctly, allowing only the number of characters I specify, but the DigitDocument.insertString(...) doesn't seem to work at all (it should allow for only digits to be entered into the JTextField).
              AbstractDocument doc;
              pafTextField = new JTextField();
              pafTextField.setDocument(new DigitDocument());
              pafTextField.setPreferredSize(new Dimension(30, height));
              doc = (AbstractDocument)pafTextField.getDocument();
              doc.setDocumentFilter(new DocumentSizeFilter(2));The DigitDocument class:
    public class DigitDocument extends PlainDocument{
         public DigitDocument(){
              super();
         public void insertString(int offs, String str, AttributeSet a) throws BadLocationException, NumberFormatException{
              try{
                   System.out.println("String str = " + str);
                   int i = Integer.parseInt(str);
                   super.insertString(offs, str, a);
              catch(NumberFormatException e){
                   // do nothing because a user input was not a digit
                   Toolkit.getDefaultToolkit().beep();
    }the DocumentSizeFilter code:
    http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/DocumentSizeFilter.java

    didn't try the abstract doc, but why not combine the two
    something like this
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.text.*;
    class Testing extends JFrame
      public Testing()
        setLocation(400,300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JTextField tf = new JTextField(new DigitDocument(2),"",10);
        JPanel p = new JPanel();
        p.add(tf);
        getContentPane().add(p);
        pack();
      public static void main(String[] args){new Testing().setVisible(true);}
    class DigitDocument extends PlainDocument{
      int maxChars;
      public DigitDocument(int chars){
        super();
        maxChars = chars;
      public void insertString(int offs, String str, AttributeSet a) throws BadLocationException, NumberFormatException{
        try{
          System.out.println("String str = " + str);
          if(this.getLength()+str.length() > maxChars) throw new NumberFormatException();//<----
          int i = Integer.parseInt(str);
          super.insertString(offs, str, a);
        catch(NumberFormatException e){
          // do nothing because a user input was not a digit
          Toolkit.getDefaultToolkit().beep();
    }

  • Using a jQuery list box placed onto a tab control doesn't seem to work for posting?

    Hello,
    I developed a U.I. in Dreamweaver for a  product and have several list boxes that use the onChange modifier to collect what the user selects from the list. I use the onChange=this.form.submit() function to grab the user's selection from the list box..
    When this dropdown list box code is placed onto a form, it posts properly and I can retrieve the user's list selection.  If however I place the list box code onto a Tab page from a jQuery Tab Control, developed in Dreamweaver, the posting doesn't seem to work.
    I must be missing something because identical code is working fine when the list box code is placed on a form yet when the code is repeated from within a Tab, it isn't working.
    The code is simple, and shown below).  The list values are coming from a MySQL table.
    $MyQuantity_query="SELECT * FROM Quantity_Table";
    $MyQuantity_Result=mysqli_query($cxn,$MyQuantity_query) or Die ("Cannot connect");
    echo"<select name='ThisQuantity[$RowCounter]' value='ThisQuantity[$Rowcounter]' onChange='this.form.submit()'><option value='-1' selected>Qty</option>";
    While($MyQuantity_Row=mysqli_fetch_assoc($MyQuantity_Result))
       extract($MyQuantity_Row);
       echo"<option value='$Qty_Number'>$Qty_Number</option>";
    echo"</select>";
    Any suggestions would be appreciated.  Thanks.
    Joel
    [email protected]

    Thanks you.
    I tried placing the selection list inside of
    tags but posting still doesn’t seem to be working? 
    Regards,
    Joel

  • Please help URGENT : Chinese handwriting doesn't seem to work on Lion OSX. the handwriting trackpad appears but anything i write in Chinese doesn't appear in word, chrome,..... HELP PLEASE

    please help URGENT : Chinese handwriting doesn't seem to work on Lion OSX. the handwriting trackpad appears but anything i write in Chinese doesn't appear in word, chrome,..... HELP PLEASE
    And in system prefs/language and text/input languages, simplified chinese and traditional chinese are ticked as usual with handwriting options on !!!!

    Please search the forum for "chinese" to find the many other earlier posts about your issue, like
    https://discussions.apple.com/message/15746805#15746805

  • USB Numeric Pad doesn't seem to work in "Screen Sharing" app.

    I have a MacBook Pro running Mountain Lion. Recently, purchased a new Targus AKP10AP USB Numeric Pad however, it doesn't seem to work in "Screen Sharing" app but seems to work fine in other apps. Screen\ Sharing.app doesn't seem to be able to recognise the numpad. If I connect a regular usb keyboard all seems to work fine - just the numpad doesn't seem to be recognized.

    First and foremost, XP SP2 is EOL on security updates. If possible I would strongly recommend Windows 7 instead.
    When you install XP, or Windows, fully upgrade first, then add Apple drivers, get it working fine. They say that 15 minutes is enough time to compromise a default XP install, and used as a "honey pot" to test what malware is circulating.
    I don't know about McAfee (I guess Google must) but for now or next time, try with just MS Security Essentials, free and gets high marks, it works.
    There are probably a lot of things to learn on a daily basis.
    But make sure what you install is current and compatible. And have backups and restore points so you can go back to earlier stable system state.
    And yes seems like the Windows partition or OS is not functional.

  • Copy items to the iPhoto Library option doesn't seem to work

    Hi, I'm using 7.1.1 and if I:
    1. De-select the create "Copy items to the iPhoto Library" option in Preferences/Advanced
    2. Create a new library
    It doesn't seem to work. The images are still being copied into the library -- that is, if I show the package contents of the library, the data directory has the photos. Additionally, if I do something like open, modify in photoshop and save one of the imported files, it doesn't show up in iPhoto. Likewise if I modify the file in iPhoto and then look at the photo in the file system using Preview or Photoshop, the iPhoto changes don't appear.
    Is this a bug? Is it not supposed to work like this? I believe that if I say "don't copy the files into the library" it means that it uses my original photos in their original location and that changes I make in iPhoto modify and manipulate the original files.
    I've tried this on two different machines and get the same results. Anyone have any ideas?
    Thanks!

    markand:
    Welcome to the Apple Discussions. It's not a bug. You don't understand correctly how iPhoto works in the "referenced" library mode. The Data folder contains the thumbnail files that iPhoto creates and needs to operate. The Originals folder will contain alias files linked to the source files at their location. Any edits, by iPhoto or by Photoshop configured correctly will result in a modified file in the Modified folder of iPhoto. *You should not open, rename, move or edit any file in the library package from the Finder.*
    Using Photoshop to edit photos in iPHoto must be done by selecting PS as the editor to use in iPhoto's General Preferences section. Then follow the instructions below to edit photos correctly:
    Using Photoshop (or Photoshop Elements) as Your Editor of Choice in iPhoto.
    1 - select Photoshop as your editor of choice in iPhoto's General Preference Section's under the "Edit photo:" menu.
    2 - double click on the thumbnail in iPhoto to open it in Photoshop. When you're finished editing click on the Save button. If you immediately get the JPEG Options window make your selection (Baseline standard seems to be the most compatible jpeg format) and click on the OK button. Your done.
    3 - however, if you get the navigation window that indicates that PS wants to save it as a PS formatted file. You'll need to either select JPEG from the menu and save (top image) or click on the desktop in the Navigation window (bottom image) and save it to the desktop for importing as a new photo.
    This method will let iPhoto know that the photo has been editied and will update the thumbnail file to reflect the edit..
    If you want to use both iPhoto's editing mode and PS without having to go back and forth to the Preference pane, once you've selected PS as your editor of choice, reset the Preferences back to "Open in main window". That will let you either edit in iPhoto (double click on the thumbnail) or in PS (Control-click on the thumbnail and seledt "Edit in external editor" in the Contextual menu). This way you get the best of both worlds
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • Numbers application on Ipad, the 'VALUE' function doesn't seem to work correctly on the string/text I want to convert to a value.

    Hi, I would appreciate if someone could assist with the following.  On the Numbers application on my Ipad, the 'VALUE' function doesn't seem to work correctly on the string/text which I want to convert to a value.  It gives me an error (in my example: 'VALUE requires a string specifying a number, but found "-14308.65" instead.'
    The exact same document (if converted from Numbers to excel), displays the converted string/text correctly in MS Excel as a value though.

    click on the cell then in the formula bar and use the arrow keys to move the cursor to see if there are any other characters in the cell that could confuse the function.  Also make sure the localization for your country is correct in System Prefs.
    Maybe copy the EXACT contents of the cell and post here.

  • Up next doesn't seem to work properly with multiple speakers over airplay. The status bar on the computer shows the song playing, but not over airplay. When I restart the song it plays, but the same thing happens when the next song cues up. Any ideas?

    Up next doesn't seem to work properly with multiple speakers over airplay. The status bar on the computer shows the song playing, but not over airplay. When I restart the song it plays, but the same thing happens when the next song cues up. Any ideas?

    Hey briannagrace96,
    Welcome to Apple Support Communities! I'd check out the following article, it looks like it applies to your situation:
    iPod: Appears in Windows but not in iTunes
    http://support.apple.com/kb/ts1363
    You'll want to go through the following troubleshooting steps, and for more detail on each step follow the link to the article above:
    Try the iPod troubleshooting assistant:
    If you have not already done so, try the steps in the iPod Troubleshooting Assistant (choose your iPod model from the list).
    If the issue remains after following your iPod's troubleshooting assistant, follow the steps below to continue troubleshooting your issue.
    Restart the iPod Service
    Restart the Apple Mobile Device Service
    Empty your Temp directory and restart
    Verify that the Apple Mobile Device USB Driver is installed
    Change your iPod's drive letter
    Remove and reinstall iTunes
    Disable conflicting System Services and Startup Items
    Update, Reconfigure, Disable, or Remove Security Software
    Deleting damaged or incorrect registry keys
    Take care,
    David

  • My New HP P2015d Printer ($400) doesn't seem to work with New Pavilion Slimeline 64 bit PC !

    My New HP P2015d Printer ($400) doesn't seem to work with New Pavilion Slimeline 64 bit PC ! I need some suggestions. Any help would be appreciated.
    The printer worked for a while and then out of the blue stopped working. We have a virus protection system, so I doubt it is a virus issue.
    *** We already tried to download the latest drivers and that doesn't seem to work ***

    Hi
    Are you trying to find your printer's email address? If so, check out details below
    http://h30434.www3.hp.com/t5/ePrint-Print-Apps-Mobile/how-do-I-find-my-printer-s-email-address/td-p/...
    Although I am an HP employee, I am speaking for myself and not for HP.
    Twitter: @Ciara_B_HP

  • Wacom Tablet doesn't seem to work all of the time?

    I have a Wacom Intuos 3 tablet, not more than a year old. I recently installed it onto my Macbook Pro and it worked fine, but when I unplugged it and came back to work with it later, it doesn't seem to work. The mouse doesn't respond to where I click on the pad.
    So, I've reinstalled this a couple of times and was able to make it work perfectly, but today when I went back to work in photoshop, it doesn't seem to be responding again.
    Does anyone have any tips? I know that Leopard likes you to eject USB devices instead of just pulling them out of the slot, but I don't see anywhere to eject it.
    Does anyone know what's up?

    Downloaded a driver from website, tablet works now.

  • Safari on my iPhone 6 running 8.02 doesn't seem to work right. Some Java scripts don't show correctly and they do on other browsers I have downloaded. I tried almost everything and nothing seems to work to fix it. Please help.

    Some websites like the one of my college uses JavaScripts and they seem to load correctly to a certain point but then not really. For example in one it would say select an option from the left menu. And I do it hut nothing happens. But when I go to the same website in another browser on my phone. The JavaScript works completely and allows me to see whatever I was clickig on that menu. I have seen that there are other websites being affected too. I tried clearing my cookies and data. even restarted my phone. And doesn't seem to work. I don't know how change the configuration any more to make it work like normal. At first I thought it was my school's website but it never got fixed. And now I realized is my safari browser! I wanna keep using it since I am really familiar with It. If someone knows how to fix this please let me know!
    Thanks

    You can reset the SMC and see if that helps. If it's a unibody or Retina, follow the method for "a battery you should not remove yourself."
    http://support.apple.com/kb/ht3964

Maybe you are looking for