brechtjah 16 Junior Poster in Training

Hello everyone
I'm currently following a course "Game Development" where we learn everything from design to 3d drawing to programming. The language we use is C++, however I'd like to learn Java as well and have there for decided to create a large project (together with a number of other students) in this programming language.
Since we're mostly all beginners I wanted to begin with simple basics but have quick results to keep motivation high. What I mean is, for example implementing the models we create in 3DS MAX in Java and use those. Though I should note that we haven't reached this chapter yet for C++ in our course.
I started gathering information yesterday around the internet and combined several tutorials into one little Java program, and after succesfully importing a model I made from 3DS MAX I started to play around with it a little more (camera, lights). I noticed that it wasn't textured though so I moved on to that and started Googling. Currently I have this code, which I've taken mostly from this site:
https://users.cs.jmu.edu/bernstdh/web/common/lectures/slides_java3d-texture-mapping.php
However, in the slides there does appear to be a shortage of information. I'm missing two array variables: vertices and faces. If anyone has any idea on how these variables should look like it would be a great help.

TD;DR: I'm missing two array variables, vertices and faces. Having no idea what they should look like.

This is my current source:

/** …
brechtjah 16 Junior Poster in Training

Hey thanks, that's great! It now creates extra instances of the same class. What I'd like to do next is for this to go automatically, say every 5 seconds or so an extra instance gets created of of every microbe. So it starts growing exponentially.

I now have this code:

/*
 * main.js
 * 
 * */

function cMicrobe() {
	var prInterval = 1.2;
	var prNumber = 1;
	
    this.puX = 50;
    this.puY = 50;
    
    this.move = function() {
        this.puX += Math.floor(Math.random()*11);
        this.puY += Math.floor(Math.random()*11);
        
        this.paint();
    }
    
    this.reproduce = function(name) {
		prNumber += prNumber;
		
		window[name+prNumber] = new cMicrobe();
	}
	
	this.paint = function() {
		document.write("<div style=\"position: absolute; margin: "+ this.puX +"px 0px 0px "+ this.puY +"px; \"><img src=\"bug.png\" /></div>");
	}
}

oMicrobe = new cMicrobe();
oMicrobe.move();


oMicrobe.reproduce("Microbe");
Microbe2.move();

oMicrobe.reproduce("Microbe");
Microbe3.move()
Microbe2.reproduce("Microbe");
Microbe4.move();

I can't really use setInterval(), is there anything I can use for this?

brechtjah 16 Junior Poster in Training

Hey there everyone
I'm a bit troubled with something I'm trying to construct, I'm trying to create an object that can reproduce itself, creating more objects that can be accessed also, to reproduce themselves. Each object would then be given a random name like: object1, object2 so they can be accessed to create object3, object4, object5 and object6.

I've come up with the following code, which has some segments that you might find weird but those are just testing.

function cMicrobe() {
	var prInterval = 1.2;
	var prNumber = 1;
	
    this.puX = 50;
    this.puY = 50;
    
    this.move = function() {
        this.puX += Math.floor(Math.random()*11);
        this.puY += Math.floor(Math.random()*11);
    }
    
    this.reproduce = function(name) {
		prNumber += prNumber;
		
		name = new cMicrobe();
	}
	
	this.report = function() {
		document.write("x: " + this.puX + "<br />y: " + this.puY + "<br /> <br />");
	}
}

oMicrobe = new cMicrobe();
oMicrobe.report();
oMicrobe.move();
oMicrobe.report();


oMicrobe.reproduce("test");
test.report();

I'm quite stuck here, I don't know the keywords to search on Google for this so I can't figure out how I can make an additional object, named test. If I can make test I can make object2, etc.

I'd appreciate some help on this,
thanks

brechtjah 16 Junior Poster in Training

Hi
So... I've been reading up a little bit about cookies and security. Only to find that you should encrypt the data in them and that they can be hacked by using javascript code.
Is this really the only way to hack/steal cookies? In my quest to create a safe login system I would use cookies for storing a token (encrypted), because unlike sessions, one cannot "ride" the session with the ID. You would have to hack/steal the cookie and duplicate it.
So basically I want to know if all I have to protect my cookies from is XSS, by filtering the URI input.

Thanks :)

brechtjah 16 Junior Poster in Training

Hi
I'm stuck wanting to create a dropdown, only supported by CSS. This is my current code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
		<style type="text/css">
			html, body {
				margin: 0px;
			}
			body {
				background-image: url('img/bottombackground.png');
			}
			div.topbackground {
				width: 100%;
				height: 300px;
				background-image: url('img/topbackground.png');
			}
			div.container {
				width: 750px;
				height: 600px
				background-color: #ddd;
				margin: -300px auto 0px auto;
			}
			div.top {
				width: 100%;
				height: 25px;
			}
			div.top img.topleft, div.top img.topright {
				height: 25px;
				width: 11px;
				float: left;
			}
			div.top div.topmiddle {
				float: left;
				height: 25px;
				width: 728px;
				text-align: center;
				background-image: url('img/top_middle.png');
			}
			div.top div.topmiddle a:link, div.top div.topmiddle a:visited {
				font-family: Arial, Verdana;
				font-size: 11px;
				color: #7c7c7c;
				padding: 0px 15px;
				text-decoration: none;
			}
			div.top div.topmiddle a:hover {
				font-family: Arial, Verdana;
				font-size: 11px;
				color: #5e7381;
				text-decoration: underline;
			}
			div.header {
				position: relative;
				margin: -30px 0px 0px 10px;
				width: 730px;
				height: 75px;
			}
			div.header img {
				position: absolute;
			}
			div.header p {
				padding: 15px 0px 0px 20px;
				font-family: Arial, Verdana;
				font-size: 32px;
				font-weight: bold;
				color: #5e5e5e;
			}
			img.arrow {
				height: 10px;
				width: 10px;
			}
			img.topleft {
				top: 0px;
				left: 0px;
			}
			img.topright {
				top: 0px;
				right: 0px;
			}
			img.bottomleft {
				bottom: 0px;
				left: 0px;
			}
			img.bottomright {
				bottom: 0px;
				right: 0px;b
			}
			img.flowers_top {
				height: 45px;
				width: 310px;
				bottom: 0px;
				right: 25px;
			}
			div.contenttop {
				width: 750px;
				height: 11px;
			}
			img.contenttopleft, img.contenttopright{
				width: 10px;
				height: 11px;
				float: left;
			}
			div.contenttopmiddle {
				background-image: url('img/content_topmiddle.png');
				width: 730px;
				height: 11px;
				float: left;
			}
			div.contentmiddle {
				background-image: …
brechtjah 16 Junior Poster in Training

So pretty much you are wanting a tree like the one you have in pieces, to be expandable so it won't have to be in pieces?

If so, I have a basic idea on how I would do it. I would like to know if I understood your question right before I type all of it.

Well no not really, sorry. Eventually it's meant as a map for players to walk around on it, it has layers just to customize it.
I'm just wondering if I'm handling this correctly or if there's a more efficient approach to it. Is this explanation clear? Don't hesitate to ask a question, thanks for reading :)

brechtjah 16 Junior Poster in Training

Hi everyone,
because I've recently decided to try making a webgame, I've begun scripting an editor for it. However, I'm quite stuck on the little project and would like some help.

The script works as follows, a directory of tiles is being read via PHP (however not alphabetically). These tiles are being put in a div element and are clickable. If you click a tile, that tile is being used to paint the map. This way you can create a world very easily, but...

It requires me to click on every x,y coord to paste the tile there, I can't figure out how to drag tiles over multiple x,y coordinates.
Also I don't know how to start on the SQL query that would upload the created map into the database, I could use an ajax based approach here, but I believe this would be too slow for instance when clicking too fast you would have to wait.
The structure of the table with the map is as follows:

CREATE TABLE IF NOT EXISTS `map` (
  `id` int(200) NOT NULL AUTO_INCREMENT,
  `y` int(20) NOT NULL,
  `x` int(20) NOT NULL,
  `background` varchar(50) NOT NULL,
  `layer1` varchar(50) NOT NULL,
  `layer2` varchar(50) NOT NULL,
  `layer3` varchar(50) NOT NULL,
  `foreground` varchar(50) NOT NULL,
  `event` varchar(60) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

[table explanation]
an x and y to identify each coordinate
a background and foreground layer, together with three more layers for content

brechtjah 16 Junior Poster in Training

http://www.google.nl/search?hl=nl&c2coff=1&q=intercepting+HTTP+requests&btnG=Zoeken&meta=
This is the link that is mentioned in a thread about postback hacking. It's a dutch thread so I'll just say what's mentioned there:
"Hackers are able to intercept data you send to the server. If they get to intercept the postback (see notes) then the password is openly in front of them. How do we solve this? By hashing the password on the client."
I guess that it's a downside that the method of encryption is visible, however, all they have is the encryption method and the encrypted password. And to decrypt it, that's another something.

My intentions are not to make you feel bad about your post, I'm just explaining why I used the javascript method. According to the thread I used about login systems; which method would you use? I don't know anything about this stuff that's why I looked it up. Maybe you can elaborate on how I'm giving them a key.
And the login will just require javascript to be turned on, if not they will get a message saying it's not.

Anyway, thanks for all the replies, hope to get one soon again.

brechtjah 16 Junior Poster in Training

why are you using javascript at all in the login process? I mean, only use it for basic validation not hashing. That in itself is a security flaw because attackers can see how you are encrypting a password, which helps them to crack it.

What if a user has javascript turned off? Then what. You should have php handle everything.

I use javascript for client side hashing before the data is posted because I read somewhere that the postback or something could be hacked. I don't have the link on me but I might find it

brechtjah 16 Junior Poster in Training

mysql_num_rows:
Retrieves the number of rows from a result set. This command is only valid for statements like SELECT or SHOW that return an actual result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or DELETE query, use mysql_affected_rows().

My guess would be that you're passing a fetched result like an array of the query.

brechtjah 16 Junior Poster in Training

Ok this is the code I have now, I haven't fully checked it yet so there could be some errors in it, but I doubt this. What I'm more interested in is are the holes in the code for a user to hack it. Well... if it's quite secure, or if there are improvements to be made.
It works the same as before, with some changes. The function renew() should be called on every page load as suggested here.

login_BackEnd.php

<?php
	/*
	 * Error Codes
	 * 0: Success
	 * 1: User does not exist in DB
	 * 2: User is already logged in
	 * 3: Hash in form is not equal to server side created hash
	 * 4: An error occured while creating the session in the DB
	*/
	session_start();
	srand(time());
	
	if(!isset($_SESSION['RND'])) {
		$_SESSION['RND'] = sha1(rand()%1000001);
	}
	
	if(!isset($_SESSION['authINF1'], $_SESSION['authINF2'], $_SESSION['authINF3'])) {
		$_SESSION['authINF1'] = sha1($_SERVER['HTTP_USER_AGENT']);
		$_SESSION['authINF2'] = sha1($_SERVER['HTTP_ACCEPT_LANGUAGE']);
		$_SESSION['authINF3'] = sha1($_SERVER['REMOTE_ADDR']);
	}
	
	function authenticate() {
		if(!isset($_SESSION['conSession'], $_SESSION['chSession'])) {
			// Get information from form
			$username = htmlentities($_POST['username'], ENT_QUOTES);
			$hash = htmlentities($_POST['hash'], ENT_QUOTES);
			
			// Create salt for hash
			$salt = htmlentities($_SESSION['RND'], ENT_QUOTES);
			$_SESSION['RND'] = sha1(rand()%1000001);
			$salt .= htmlentities($_SERVER['REMOTE_ADDR'], ENT_QUOTES);
			$salt .= htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES);
			
			$qGetUser = @mysql_query("SELECT * FROM users WHERE gebruikersnaam='".$username."'");
			if(@mysql_num_rows($qGetUser) == 1) {
				
				// The user exists in the DB
				$aGetUser = @mysql_fetch_assoc($qGetUser);
				$qGetSession = @mysql_query("SELECT * FROM sessions WHERE gebruikersnaam='".$username."'");
				if(@mysql_num_rows($qGetSession) == 0) {
					
					// The user is not logged in yet
					$serverSideHash = sha1($aGetUser['wachtwoord'].$salt);
					if($serverSideHash == $hash) {
						
						// The submitted hash and the server side created …
brechtjah 16 Junior Poster in Training

Ok, I will rewrite the whole code and upload it here once ready.

brechtjah 16 Junior Poster in Training

Yes installing the Microsoft Core Fonts did the job. Here's a quick how to for other people that may be experiencing this in Ubuntu 8.10.
Non-Terminal:
Go to Applications > Add/Remove...
and Search for microsoft core fonts (make sure All Available Applications is selected next to the search box)
Check the box and click Apply Changes

Terminal:
Open the Terminal: Applications > Accessories > Terminal
Type in: sudo apt-get install msttcorefonts
After this you will be prompted your password and the installing will begin.

After installing the fonts you will have to logout for them to be applied.

Nick Evan commented: Thanks for the Ubuntu tip! +15
brechtjah 16 Junior Poster in Training

I don't mean to sound rude, but I just want this question answered about blocking session ID stealing.

brechtjah 16 Junior Poster in Training

Seeing as all the session values are stored on the server, unlike cookies which are stored on the clients computer, they are much more secure anyway.

In theory if the malicious user got the session key they may be able to do some things, but this will be prevented to a certain extent by using the script above to change the session key every page load.

Also, make sure your logout button/link is easy to see, as by clicking this the session data should be deleted by the script meaning that it can no longer be accessed.

Isn't it possible to check if the hacker tries to inject a session id in the URI by using GET? Like this:

if($_GET['PHPSESSID'] != null) {
  // A hacker is trying to inject a session ID
}

?

brechtjah 16 Junior Poster in Training

Excuse me, I'm not so familiar with sessions. I don't know anything about session keys.
If I put the hash in a session and compare it to the hash in the database. Then it is possible for a hacker to pose himself like the user by somehow stealing the session, yes? How would I go to prevent this? Or isn't this possible?

brechtjah 16 Junior Poster in Training

I am kinda stuck now on how I would make one user logged in over multiple pages, however leaving hackers out. I can't really use sessions because they can be hacked no?
Can I have some assist on this please, then I can complete the script and I'll paste it here :)

Thanks

brechtjah 16 Junior Poster in Training

Weird, the attachment didn't work, here's a link:
http://img128.imageshack.us/my.php?image=screenshot1v.png
Edit: I also seem to have this problem with Firefox.

brechtjah 16 Junior Poster in Training

Ok there you go, see attachment.

brechtjah 16 Junior Poster in Training

This site is not being rendered right in my current browser, Opera. The rounded corners appear a bit off. Just thought I'd mention this, I have the latest Opera version available, my OS is Ubuntu.

See you :)

brechtjah 16 Junior Poster in Training

What is your output then? Also there appears to be a mistake in your query. I presume ID is a number, then there is no need for single quotes. So...

where id = '".$row['cid']."'

becomes

where id = ".$row['cid']."
brechtjah 16 Junior Poster in Training

Thats a really nice script. However what if the user has javascript turned off? Some of your validation is in javascrit therefore a login would be imossible.

Use <noscript> to let the user know their login wont be sucessfull unless they turn it on. Also, are you cleaning your strings from quotes and other characters? I cant really see if you are?

On the other hand, this is a really nice method. It works against CSRF and XXS therefore is really safe. I'm copying the code for personal use so thankyou :D

Does this help ?

Oh I should indeed implement htmlentities use, but...
What do you mean with CSRF and XXS? What are those things? :) Googling those things gives me other results than I need

brechtjah 16 Junior Poster in Training

Hi,
I wanted to post my login system I will use for an upcoming site for rating. I want to ensure a safe login, so please, if you know anything about this and see a security leak somewhere... Please post, any remarks are welcome.

How it works: the script generates a random number if the form hasn't been submitted yet. This number is being passed to the Javascript also. On submitting of the form the javascript creates a hash and empties the password field. The hash includes: IP + hashed password + random number. The server recreates this and destroys the session with the random number *. The two hashes are compared and a decision is made.
* I've been thinking of putting the random number in the database and an id in the session, then the random number is pulled of the database. However, I'm not so experienced in login systems and don't know what information can be corrupted.

NOTE: the script will also log who is currently logged in, I still have to code that part, but I couldn't wait to upload this here.
EDIT: I will include a script that will only allow for so much login attempts in a certain time span to exclude bots. Or shouldn't I? :)

<?php
	session_start();
	include_once("connect.php");
	
	if(isset($_POST['logIn'])) {
		$RND = $_SESSION['RND'];
		session_destroy();
		$IP = $_SERVER['REMOTE_ADDR'];
		
		$qGetUser = @mysql_query("SELECT * FROM users WHERE gebruikersnaam='".$_POST['username']."'");
		if(@mysql_num_rows($qGetUser) == 1) {
			$aGetUser = @mysql_fetch_assoc($qGetUser);
			$serverHash = sha1(($IP.$aGetUser['wachtwoord'].$RND));
			
			if($serverHash == …
brechtjah 16 Junior Poster in Training

Thanks, that worked :)!

brechtjah 16 Junior Poster in Training

Bah, what a stupid mistake, I can't believe it. Anyway the warnings include, but are not limited to:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user **'@'localhost' (using password: YES) in /opt/lampp/htdocs/VC/connect.php on line 9
arning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'locahost' (1) in /opt/lampp/htdocs/VC/connect.php on line 9

In other words: when the connection information is wrong, I get warnings, but I don't want these :)
Thanks

brechtjah 16 Junior Poster in Training

I can handle errors just fine on MySQL, but what about warnings? If I use the following code I still get to see the warning, while that is not what I want:

if(mysql_connect($host, $user, $pass)) {
			 $conn_server = true;
		}
	else {
			$msg = "Fout bij verbinden naar de server.";
			$type = "error";
		}
	
	if($conn_server = true) {
		if(mysql_select_db($database)) {
				$msg = "Verbonden met de server en database.";
				$type = "notification";
			}
		else {
				$msg = "Fout bij verbinden naar de database.";
				$type = "error";
			}
		}
brechtjah 16 Junior Poster in Training

Hi,
I'm trying to create a chat with some code I downoaded of the web and altered a bit. The updating works as long as i'm not opening up another tab page in my browser or as long as i'm not ALT+Tabbing... Which seems kinda strange to me... Also, when I submit something, the updating stops.
Since I am somewhat new to AJAX could I have some help on this issue? Don't mind the filenames though.
This is my code

[chattest.php]

<html>
<head>
<script src="selectuser.js"></script>
</head>
<body onload="setTimeout('showUser()', 500)">

<form> 
Select a User:
<select name="users" onchange="showUser(this.value)">
<option value="1">Peter Griffin</option>
<option value="2">Lois Griffin</option>
<option value="3">Glenn Quagmire</option>
<option value="4">Joseph Swanson</option>
</select>

<input type="text" size="60" maxlength="200" name="message" id="message">
<input type="button" value="submit" name="submit" onClick="sendMsg()">
</form>

<p>
<div id="chatBox" style="overflow: scroll; height: 100px; width: 400px;"></div>
</p>

</body>
</html>

[selectuser.js]

var xmlHttp;

	function showUser() { 
		xmlHttp = createXMLHTTPObject();
		if (xmlHttp == null) {
			alert ("Browser does not support HTTP Request");
			return;
		}
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET","getuser.php",true);
		xmlHttp.send(null);
	}
	
	function sendMsg() {
		XML_sendMSG = createXMLHTTPObject();
		if (XML_sendMSG == null) {
			alert ("Browser does not support HTTP Request");
			return;
		}
		
		username = "brecht";
		message = document.getElementById('message').value;
		
		//XML_sendMSG.onreadystatechange=stateChanged;
		XML_sendMSG.open("GET","sendmessage.php?username="+username+"&message="+message,true);
		XML_sendMSG.send(null);
	}

	function stateChanged() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
			document.getElementById("chatBox").innerHTML=xmlHttp.responseText;
		}
	}

	function createXMLHTTPObject() {
		var object = null;
		
		try {
			// Firefox, Opera 8.0+, Safari
			object = new XMLHttpRequest();
		}
		catch (e) {
			//Internet Explorer
			try {
				object = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e) {
				object = new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		return …
brechtjah 16 Junior Poster in Training

Here, this should fix it:
EDIT: I don't know why you used an array by the way, and note the change I did with your switch case to see how it works with your buttons.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
	    <title>javascript1</title>
		<script type="text/javascript">
			function Init()	{
				var table = document.createElement("tbody");
				var newrow,newcol,tmp;
				var i = 0;
					
				for (var row = 0 ; row <4 ; row++) {
					newrow = document.createElement("tr");
					
					for (var col = 0 ; col<4 ; col++) {
						i++;
						
						newcol = document.createElement("td");
						var button = document.createElement('input');
					    button.type = 'button';
					    button.style.width = '60px';
					    button.style.height = '60px';
					    button.id = (row*10 + col).toString();
						button.value = i;
					    newcol.appendChild(button);
					    newrow.appendChild(newcol);
						
						if (row == 3 && col == 3) {
							break;
						}
					}
					
					table.appendChild(newrow);
				}
				
				document.getElementById('gameTable').appendChild(table);
				
				
				document.onclick = function(e) {
					e = e ? e : window.event;
					t = e.target ? e.target : e.srcElement;
					
					if (document.getElementById && t.type == 'button') {
						ids = parseInt(t.id);
						/* You can add more function from the switch method. The only problem you have is that you've set your id's from the maximum count of "col" variable, which is 4 in overall count.
						So the first 4 line up of buttons will take this event. The rest will copy the function counting back from 0 to 4, which all the buttons from the 2nd row copy this effect! Things can be fixed by incrementing the col value = to the length of buttons being created by your function.
						Im sure it …
brechtjah 16 Junior Poster in Training
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title></title>
		<style type="text/css">
			.wrapper {
				margin: 0px 0px 0px 0px;
				width: 492px;
			}
			
			.errorTable {
				width: 100%;
				height: 100%;
				border: 0px;
				border-collapse: collapse;
				
				font-family: Arial;
				color: #ffffff;
				font-size: 12px;
			}
		</style>
	</head>
	
	<body>
		<div class="wrapper">
				<table class="errorTable" cellpadding="0">
					<tr style="height: 23px;">
						<td style="width: 6px; background-image: url('images/error_01.png');"></td>
						<td style="width: 40px; background-image: url('images/error_02.png');"></td>
						<td style="height: 23px; background-image: url('images/error_03.png');"></td>
						<td style="width: 40px; background-image: url('images/error_04.png');"></td>
						<td style="width: 6px; background-image: url('images/error_05.png');"></td>
					</tr>
					<tr style="height: 76px;">
						<td style="width: 6px; background-image: url('images/error_06.png');"></td>
						<td colspan="3" style="background-image: url('images/error_07.png');"></td>
						<td style="width: 6px; background-image: url('images/error_08.png');"></td>
					</tr>
					<tr>
						<td style="width: 6px; background-image: url('images/error_09.png');"></td>
						<td colspan="3" style="background-color: #000000;">
							<div style="position: relative; margin: -95px 0px 0px 0px">
								Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sit amet dui. Suspendisse a magna eu magna ultrices eleifend. Sed in odio porttitor justo egestas convallis. Cras nec erat ac tortor gravida varius. Maecenas vitae nisl. Aliquam ut libero id enim egestas fringilla. In hac habitasse platea dictumst. Sed ante. Aliquam ac dui non odio congue porttitor. Nullam viverra purus non purus. Proin lacinia accumsan sapien. Mauris varius tincidunt metus. Curabitur dolor odio, scelerisque sit amet, consectetur eget, pellentesque ac, ipsum.
								Nunc convallis tempus velit. In hac habitasse platea dictumst. Proin vestibulum fermentum arcu. Praesent elit arcu, luctus sit amet, pulvinar ac, ullamcorper vitae, nibh. In pede odio, porttitor eget, porta in, cursus sed, nulla. Aliquam elementum aliquet nisl. Ut sagittis nibh at eros. Mauris blandit quam quis risus. Pellentesque vel massa. Donec sit amet …
brechtjah 16 Junior Poster in Training

Nevermind, fixed it myself, code coming after some cleanup.

brechtjah 16 Junior Poster in Training

window.print() does not start the printing, but it shows the dialog for the user to print. So you cannot check wether the file has been printed, only if the button "Print" has been pressed.

brechtjah 16 Junior Poster in Training

All those comment rules are a VERY bad idea. Removing them should solve your problem.

brechtjah 16 Junior Poster in Training
brechtjah 16 Junior Poster in Training

Hi,
I'm trying to create an expandable content box for forum purpose, however the code I've come up doesn't work in IE, but it is valid HTML 4.01 Strict. Anyway, if I'm handling this problem the wrong way, please tell me how I should do it then.
I have an image with rounded corners that has to be in the top of the wrapper. This image is just a gradient that ends in #000000 (black).
So in order to make it expand I just set the background color of my wrapper to black, to make it fit my layout. However, because of the rounded corners, the black is shown trough them because the background of my image is transparent. So like this:
[transparent]
________________ [transparent]
[gradient] [corner] |

but the corner is round ofcourse :)

To solve this I've just shrinked my wrapper to the size of the contentbox minus the rounded corners. I then give my image a negative left margin which places it to the left, solving my problem. Well in FF ofcourse, because IE just expands my DIV wrapper even though I gave it a fixed width.
This is my HTML:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title></title>
		<style type="text/css">
			.wrapper {
				margin: 0px 0px 0px 10px;
				height: 300px;
				width: 390px;
				background-color: #000000;
			}
			
			.contentTop {
				margin: 0px 0px 0px -5px;
				height: 98px;
				width: 400px;
				background-color: #bbbbbb;
			}
			
			.content {
				position: relative; …
brechtjah 16 Junior Poster in Training

I can't open up your website,
before I take a look into your site I can tell you that most likely you're website is not valid, or doesn't even have a doctype. Therefore it is being rendered in quirksmode and more things look different in other browsers.

brechtjah 16 Junior Poster in Training

I'll need to see the code YOU are using to check it for errors...

brechtjah 16 Junior Poster in Training

Great to hear that! :)
Good luck on learning Javascript

brechtjah 16 Junior Poster in Training

What you could do is give each checkbox an ID and go by that ID instead of the name, then you can get the name of that checkbox because you have it's ID:

<input type="checkbox" id="checkBox1" name="checkBoxCountry[01SW]"></input>
<input type="checkbox" id="checkBox2" name="checkBoxCountry[A22]"></input>
<input type="checkbox" id="checkBox3" name="checkBoxCountry[BX2L]"></input>
<input type="checkbox" id="checkBox4" name="checkBoxCountry[11OX]"></input>
<input type="checkbox" id="checkBox5" name="checkBoxCountry[41W]"></input>

If you have any questions just reply, I don't have much time to react now I'm sorry

brechtjah 16 Junior Poster in Training

That depends on what's in $new. Is it a number? I'm guessing it is, and how many do you have, in my example there are 5 checkboxes in the form. If your studentId's follow each other up like this:
1, 2, 3
and not like:
3, 34, 55, 56, 57

You can probably change this Javascript:

function checkCheckBoxes(formName) {
			    var i;
			    var numberOfChecked = 0;
				
			    for(i=0;i<5;i++) {
					if(formName.elements['checkBoxCountry['+i+']'].checked) {
						numberOfChecked++;
					}
			    }
			    return numberOfChecked;
			  }

to this:

function checkCheckBoxes(formName) {
			    var i = 0;
			    var numberOfChecked = 0;
				
			    while(formName.elements['checkBoxCountry['+i+']']) {
					if(formName.elements['checkBoxCountry['+i+']'].checked) {
						numberOfChecked++;
					}
					i++;
			    }
			    return numberOfChecked;
			  }

EDIT: code tested and should work
Hope this helps you ^^

brechtjah 16 Junior Poster in Training

Could there be a conflict in that I have my SELECTs with the same name of 'Area' ?

Yes that is very much the problem : ) You have to give each selectbox a unique name.

Please also make sure you changed the whole thing:
<script type="text/javascript">
and NOT
<script type="javascript">

Good luck :)

brechtjah 16 Junior Poster in Training

Excuse me, my previous post was indeed nonsense. This on the other hand should work:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<script type="text/javascript">
			function checkCheckBoxes(formName) {
			    var i;
			    var numberOfChecked = 0;
				
			    for(i=0;i<5;i++) {
					if(formName.elements['checkBoxCountry['+i+']'].checked) {
						numberOfChecked++;
					}
			    }
			    return numberOfChecked;
			  }
		</script>
	</head>
	
	<body>
		<form name="myForm">
			<input type="checkbox" name="checkBoxCountry[0]"></input>
			<input type="checkbox" name="checkBoxCountry[1]"></input>
			<input type="checkbox" name="checkBoxCountry[2]"></input>
			<input type="checkbox" name="checkBoxCountry[3]"></input>
			<input type="checkbox" name="checkBoxCountry[4]"></input>
			<input type="submit" onclick="alert('Number of checked checkBoxes: ' + checkCheckBoxes(myForm))" value="Submit">
		</form>
	</body>
</html>

Good luck

brechtjah 16 Junior Poster in Training

I counted numerous quotation errors in your selectTimeSettings.php

<?php

$q=$_GET["q"];

ob_start();
session_start();
error_reporting(0);
include("config.php");
include("functions.php");

$cy = date("Y");

$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");

$query = "select tz_pref from av.pilot_info where uid='".$SESSION_UID."'";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: ".$query." mysql_error()");

$tz_pref=mysql_result($result,$i,"tz_pref");

if ($tz_pref == "0") { $dtz = "Greenwich Mean Time (Zulu)"; }
else if ($tz_pref == "-3.5") { $dtz = "Newfoundland Time"; }
else if ($tz_pref == "-4") { $dtz = "Atlantic Time"; }
else if ($tz_pref == "-5") { $dtz = "Eastern Time"; }
else if ($tz_pref == "-6") { $dtz = "Central Time"; }
else if ($tz_pref == "-7") { $dtz = "Mountain Time"; }
else if ($tz_pref == "-8") { $dtz = "Pacific Time"; }
else if ($tz_pref == "-9") { $dtz = "Alaska Time"; }
else if ($tz_pref == "-10") { $dtz = "Hawaii-Aleutian Time"; }

$query = "select mc, adesc, hobbs_in, time_setting from av.pilot_ac left join av.logbook on pilot_ac.aid=logbook.aid where pilot_ac.aid='".$q."' order by flight_date desc, lb_id desc limit 1";
$result = mysql_db_query($database, $query, $connection) or die ("Error in query: ".$query. "mysql_error()");

$mc=mysql_result($result,$i,"mc");
$adesc_sel=mysql_result($result,$i,"adesc");
$hobbs_out=mysql_result($result,$i,"hobbs_in");
$time_setting=mysql_result($result,$i,"time_setting");

if ($hobbs_out == 0.0) { $hobbs_out=""; }

if ($adesc_sel == 4 || $adesc_sel == 7 || $adesc_sel == 9) {

echo "<td align='center' style='padding-bottom:10px'><table border='0' cellpadding='0' cellspacing='0'><tr>";

echo "<td align='left' colspan='2'><font class='tfont'><b>All SIM's, FTD's and PCATD's only<br>require Total Flight Time.</b></font></td>";

echo "</tr><tr>";

echo "<td align='center' style='padding-top:10px'><table border='0' cellpadding='0' cellspacing='0'><tr>";

echo "<td align='right' style='padding-right:5px;'><font class='tfont'>Total Flight Time: </td>";
echo "<td style='padding-top:5px'><table …
brechtjah 16 Junior Poster in Training

Perhaps I do not fully understand what you want, if so just explain a bit further, but from what I've read I created this code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<style type="text/css">
			#myDiv {
				width: 400px;
				height: 300px;
				background-color: #bbbbbb;
				overflow: scroll;
			}
		</style>
		<script type="text/javascript">
			function addContent(divName) {
			    document.getElementById(divName).innerHTML += document.getElementById('myContent').value + " ";
			}
		</script>
	</head>
	
	<body>
		<form name="myForm">

		Content to be added:
		<textarea id="myContent"></textarea>
		<input type="button" value="Add content" onClick="javscript:addContent('myDiv');">

		</form>

		<br><br>
		Your content will be added dynamically below:
		<div id="myDiv"></div>
	</body>
</html>

I left out the php in this by the way. Don't hesitate to ask questions, hope this helps : )

brechtjah 16 Junior Poster in Training

What about the image file name, have you copied the image and adjusted the adress to it?
Otherwise I wouldn't really know since you just copied the code.

brechtjah 16 Junior Poster in Training

So you want a script to
1 Access the database
2 Get quotes
3 Display random quotes

Seems pretty straight forward to me, no AJAX needed actually, only if you want random quotes to appear every so seconds.

Those three steps seem actually really easy to me in PHP but watch out when the users download your script that you hide your database access information.
You can read up on AJAX here:
http://www.w3schools.com/Ajax/ajax_intro.asp
or here:
http://www.xul.fr/en-xml-ajax.html
here:
http://www.tizag.com/ajaxTutorial/

:) Google => ajax tutorial

brechtjah 16 Junior Poster in Training

1. onreadystatechange Event
Fires when the readyState method changes.

2. In your httpd.conf file in xammp/apache/conf
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen >PORT_NUMBER<

3. The data you are retrieving, is it located in a database or not? If not then it's normal that it works since Apache does not need to be run.

Hope this helps you further, don't hesitate to ask questions : - )

brechtjah 16 Junior Poster in Training
function checkCheckBoxes() {
    var i;
    var isOneChecked = false;
    for(i=0;i<5;i++) {
      if(checkBoxCountry[i].checked) {
        isOneChecked = true;
      }
    }
    return isOneChecked;
  }
<input type="submit" onclick="alert(checkCheckBoxes())" value="Submit">

This should work. If you want to make it dynamic you can do that with PHP.

brechtjah 16 Junior Poster in Training

What a coincidence, someone wrote a topic about that yesterday, you can find it here: http://www.daniweb.com/forums/thread161189.html
Oh and your link is wrong, it has a h too much in it. It should be:
http://img168.imageshack.us/img168/7080/task3vn7.png

Might want to read up on that program he wrote, it can give you some ideas and where to get started... : - )

brechtjah 16 Junior Poster in Training

After some heavy googling I came up with this; however the IE part does not work I'm afraid, in my IE it always returns false. I have been trying quite everything, but I don't know that much about VBScript, which is necessary to check for the Flash plugin in IE.
Anyway; here goes

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<script type="text/javascript">
			function checkForFlash() {
				var browser = navigator.appName;
				var flashVersion;
				var hasFlash = navigator.mimeTypes["application/x-shockwave-flash"];
				if(hasFlash) {
					document.getElementById('divInfo').innerHTML = "You have the Flash Player plugin.";
				}
				else if(browser == "Microsoft Internet Explorer") {
					hasFlash = false;
					MSDetect = "true";
					document.write('<script type="text/vbscript"\> \n');
					document.write('on error resume next \n');
					document.write('If MSDetect = "true" Then \n');
					document.write('  For i = 2 to 10 \n');
					document.write('    If (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then \n');
					document.write('      hasFlash = true \n');
					document.write('      flashVersion = i \n');
					document.write('    End If \n ');
					document.write('  Next \n');
					document.write('End If \n');
					document.write('</script\> \n');
					
					alert(hasFlash);
				}
			}
		</script>
	</head>
	
	<body onLoad="javascript:checkForFlash();">
		<div id="divInfo" style="width: 300px; height: 200px; background-color: #bbbbbb;">
		</div>
	</body>
</html>

I guess it has something to do with the hasFlash variable being set to true for the right version, but when the for loop loops another time it just resets it back to false. However, I can't solve this myself, I might google somewhat later but now I have to study for my exams today ^^

brechtjah 16 Junior Poster in Training

You can't have a function that has the same name of your class, how can you tell what's what?
You have some code outside the main function or any other functions, that doesn't seem right.

Hope this helps ^^ :)