Jump to content

burtybob

Members
  • Posts

    105
  • Joined

  • Last visited

Everything posted by burtybob

  1. Hi, I think I understand this but want to check. If I have files register, user.class and dbconnect. If both register and user.class use require_once dbconnect will the dbconnect still only be required on the first time? Ben
  2. As far as I know there is no way to do this in PHP as PHP is executed server side. However, you can do the same with javascript.
  3. hmm That is a good idea to have a tile class. It would definantly make it easier. I have problems with OOP sometimes as when I first started programming they taught us procedural and I am now trying to learn OOP style. Thank you for the advice. Doing it with a tile class also means there is no worrying about the syntax error.
  4. I am wanting to create a game and this is the only thing that I have found hard. The map is of an area of land. Each tile will hold information like what is on that tile such as whether is a building and if so what building or if it doesn't have a building on it then does it have building rights. The first index would be the tile ID and then the second one would be the actual stuff there. So like: map[] = {true,none, false}; where the first value is if it is owned, the second is what is built there and the final one is the status of building rights. Hope that makes sense. I have a horrible tendancy to waffle and make no sense.
  5. I am guessing that I did confuse everyone Here is what i have been playing with: Object map[mapSize][]; for(int i=0;i<mapSize;i++) { map[i][] = {"Element 1","Object 2","Item 3"}; } But the code errors at the map[] ={...}; bit. The error is "Syntax error, insert "}" to complete Block" Hope that clarifies things now.
  6. Firstly I shall presume that you have put "mysite.com" to prevent spam and that in your real shell script you have put the proper one. My second question, although maybe obvious, is does the file exist inside the folder? "No such file or directory" is generally when a file or folder is not located where you tell it to be? So have you tried navigating to that file manually? If that works then I am lost Also the folder being 777 doesn't mean the file is 777
  7. This is probably a really newbie question but what is the best way to do a map that has to contain two arrays. I will try to clarify. I have a map that is X squares wide and X squares high (X = a variable passed to it which can change). I was thinking that the easiest way would be something like an array or vector with X*X elements and then each element having an array of what the map tile holds but different map tiles can hold different amounts of data. I have two vectors: mapArray and mapSquare. I add elements to mapSquare (a and b plus the number the loop is on) so a0 and b0 then a1,b1 etc. The only problem is that every element in the primary array/vector is the exact same if I do .clear() on the vector. If i don't do .clear() on the mapSquare then the mapSquare works but has the previous elements plus all the new ones so a0,b0 even when I want the mapSquare to contain only like a1,b1. Oh dear I don't think anyone is going to be able to understand this . I will try to clarify any bits that anyone is still confused on.
  8. Ok so my mate telnets to the server fine on port 90. grrr I can't do external testing but at least I know it works *yay* Thank you corbin for all the help.
  9. Yeah I did but then it connected to the routers web interface. I shall do a test with a couple of friends later when they are online and see if I can get the client to connect to the server on there machine and then I will post back the results
  10. To add to the confusion: Server running: Website says it can connect and the server does acknowledge it. Server not running: Website says it can't connect. I love creating the impossible problem. Thanks for the huge amount of time you have given to trying to help me with this.
  11. Did that and it then connects to the routers web interface which also runs on port 80. surely if port 90 was blocked then then website wouldn't be able to connect to the server program I had written?
  12. I have apache running on port 80 and so I thought for a laugh I will see if it can connect to it via the outside IP. So changed the port to 80. Hit run. No errors. That is where I got confused because it would appear that neither server OR client are at fault. The router can be ruled out to some degree because the apache port with apache running works. An outside website can connect to the server code. Internal IPs work as well which pushes the blame onto the router but then how does the apache one work. Disabled my firewall, anti virus both together. Nada. Then disabled one and left the other enabled. Nada. Tried changing the ports to no avail . Thanks for your time. ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=90] <= Server socket. Couldn't get I/O for the connection to: xx.xxx.xx.xxx Connection refused: connect <= The clients I/O error message if that is any help. I googled it but couldn't find any help as everyone else with this said the error was that the server wasn't running and they had proved it by using other means like the website to see .
  13. Also telnet can connect via localhost 90 but not my global IP 90. Could it be something to do with the router?
  14. The Server package main; import java.net.*; import java.io.*; public class KnockKnockServer { public static void main(String[] args) throws IOException { ServerSocket serverSocket = null; Socket clientSocket = null; try { serverSocket = new ServerSocket(90); System.out.println(serverSocket); } catch (IOException e) { System.err.println(e.getMessage()); System.exit(1); } try { clientSocket = serverSocket.accept(); System.out.println(clientSocket); } catch (IOException e) { System.err.println("Accept failed."); System.exit(1); } PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); String inputLine, outputLine; KnockKnockProtocol kkp = new KnockKnockProtocol(); outputLine = kkp.processInput("hi"); out.println(outputLine); while ((inputLine = in.readLine()) != null) { outputLine = kkp.processInput(inputLine); out.println(outputLine); } out.close(); in.close(); clientSocket.close(); serverSocket.close(); } } The Client package main; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; public class EchoClient { public static void main(String[] args) throws IOException { String host = "88.108.76.198"; //host = "192.168.0.2"; Socket echoSocket = null; PrintWriter out = null; BufferedReader in = null; try { echoSocket = new Socket(host, 90); out = new PrintWriter(echoSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(echoSocket.getInputStream())); } catch (UnknownHostException e) { System.err.println("Don't know about host: "+host+"."); System.exit(1); } catch (IOException e) { System.err.println("Couldn't get I/O for the connection to: "+host); System.err.println(e.getMessage()); System.exit(1); } BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); String userInput; while ((userInput = stdIn.readLine()) != null) { out.println(userInput); System.out.println("echo: " + in.readLine()); } out.close(); in.close(); stdIn.close(); echoSocket.close(); } } These are both from the suns tutorial.
  15. I have two parts of java code one part connects to a server and the other is the server. I start the server part. Ouput in the console in eclipse confirms this. I then start the client with localhost as the connection host and it works again confirmed by no output in the console. I stop both restart the server and try starting the client with localhost replaced with my global IP and it can't connect. The server is definatley running as if I goto can you see me dot org and put in the port (90) it says the port is open and connectable and the server tells me that it recieved the connection. Then I try to connect the client to my HTTP port (80) via the global IP address and it works fine. This has thoroughly confused me. Does anyone have any ideas?
  16. Hi, I don't know if this should be here or in the regex help section so if it is in the wrong section please move it. I have this preg_match("/\/warn (.*)/",$shout,$matches) I understand almost everything in there except the ""/\/warn (.*)/"" section... It takes input from a shoutbox input. So you put in "/warn burtybob" and it will warn burtybob and I understand all the rest of the script that does that. I would like to know what the "/\" is for, I presume it is something to do with character escaping. I would like to know what the "(.*)/" stuff does as well. I would like to say thanks in advance for explaning this to me. Thanks in advance, Ben
  17. echo "<script type='javascript'>openRequestedPopup();</script>"; Why do you have this in the php page? Why not have an onClick="javascript: openRequestedPopup;" on the submit button or are you doing checking in the php page of whether to show the popup or not? Also the <script type='javasscript'></script> tags are not needed around the function call. All you are doing is echoing the name of the function. You need to put it in an attribute eg <body onload=""> or onClick or onUnload etc. Hope that helps.
  18. Hi all, I am trying to get it so that if i insert data into form field 4 then radio box 4 is automatically slept, however i can not find the right bit of code, the code i am using now works but it requires a lot more manual work from the user and i wish to do this so that A The user does not need to do as much to do the same job AND it lowers the chance of mistakes. Please can any one help? Thanks everyone, Ben
  19. Wow someone agrees with me *recovers from fainting*, im so rarely agreed with.
  20. <?php $entry = str_replace('[img]','<img src=image.php?id='.$id.'>',$entry); ?> I just added the 2 full stops and a quote around the $id so it does a similiar job or at least it does for me.
  21. The locking up might not be anti-cheat but rather the fact that the processor cant deal with the larger amounts or the flash cant deal with it rather then well desgined protection.
  22. Woops didnt mean to put complex in there ahh well. Umm id like to head in the direction of desktop programming.
  23. Ok thats a long title. I am interested in progressing from moderate PHP into more complex and "useful" programming and i am interested in knowing what you guys think of ALL the different languages out there from ASP to JAVA why you think that language is best and the best way to learn eg dive in on some opensource or get a book/tutorial.
  24. Cheers ill disassemble it and look at how it all fits togehter cheers
  25. Hmm this is very true i dont know how to do this securely however this is something i will have to learn and considering looking at a fair few of the users of this forum i see that i may have a couple of years in which to catch up there expertise in this area, however going back to the point i AM willing to put in the time to both learn HOW to do this and how to do this SECURELY. Whichever way around i need to learn these two items i will and please if you know of tutorial(s) that will help in either or both of these please post a link. Thanks again in advance, Burtybob
×
×
  • 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.