phorce 131 Posting Whiz in Training Featured Poster

Hello,

I'm trying to create a script that counts the number of people in an array by using a variable called "counter"
I am using functions to display the information, however it won't display..

<?php

function main()
{
	$people = list_people();
	
	echo 'There are currently: ' . $counter . 'Number of people\n\n';
	foreach($people as $person)
	{
		echo $person . '\n\n';
		
	}

}

function list_people()
{
	global $counter;
	
	$people = array ('Phillip', 'Mark', 'Oliver', 'Lucy');
	foreach($people as $p)
	{
		$counter++;	
	}
	
	return $people;
	
}

main();



?>

I can't return the $counter variables, as I'm already returning something else. Please, please help me.

Thanks.

phorce 131 Posting Whiz in Training Featured Poster

Yes, that would work, and be cheaper..

But, my router is downstairs and therefore I cannot have the server downstairs because of my flat mates. That wouldn't work. I really don't want wireless because it's just generally slow and I've found that ethernet works well.

I still think connecting another router would be more effective rather than a switch. I can pick up a router for very cheap (not as cheap as a switch) but if it meant that all my devices had unlimited access to the internet without switching, then it would work more effectively.

Also, do you have any idea why (if I have port forward port 22) and can ssh on my local network but still can't ssh from another network?

phorce 131 Posting Whiz in Training Featured Poster

1) Can you recommend any other alternatives? A switch would not work, simply because I have a server which requires internet connection 24/7.

2) It'd be cool, I can offer other people internet access if they come 'round without having to tell them the password etc.. :) Would I need to port forward 80?

phorce 131 Posting Whiz in Training Featured Poster

Thanks for your reply,

I have decided to invest into an Airport extreme, connect it to my router downstairs and then run multiple Ethernet cables to my devices.

Another question (sorry ;)) do you have any idea how I would go about setting the Airport extreme to not require a password, but, when the someone connects to it, opens a browser it asks for a username and password (Kinda like they do in internet cafes and on trains or universities etc)

I want to allow multiple people to access the network, but, not sharing the same password to connect to the network. Make sense?

phorce 131 Posting Whiz in Training Featured Poster

Hey,

You cannot use two routers in a network, can you? Would this work...

- A router down stairs
- An ethernet cable running upstairs
- The Ethernet cable connects to a router in my room
- Separate Ethernet cables run to all my devices

Would this work?

phorce 131 Posting Whiz in Training Featured Poster

Thank you :)

Another question, I have multiple Computers in my room, and, they all require internet at the same time.
Now, I thought about getting a switch, but, when I went into the store today they said that only one computer can connect to the internet at one time when using a switch, is this correct?

Also can you recommend any gigabit ethernet ethernet switches?

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I'm going to be laying ethernet around my house, now, I'm just wondering which is the fastest? I've been looking at this "CAT5e RJ45 Ethernet Network LAN " type of Ethernet cabling, would this be fast?

Thanks.

phorce 131 Posting Whiz in Training Featured Poster

Hello,

Yes, I am. I'm using the IP address of the computer, it's strange.. Will let me connect on localhost, but nothing else?

phorce 131 Posting Whiz in Training Featured Poster

Yeah, both are running macs and using terminal to access it.

Would it be that I'm using wifi? Someone said something about Wifi?

phorce 131 Posting Whiz in Training Featured Poster

I am forwarding port 20... And no, no firewalls are connected.. I'm on Mac and turned all the security off (to try it) and still getting the "Connection timeout"

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I have a computer upstairs that I want to store everything off and then just be able to ssh into it.

I have port forwarded 20 to the IP address of the computer (on the router), and connect to it when I'm on my own router it works, however, as soon as I connect to a different router, it won't allow it.

Says "Connection timed out" Could this be a firewall issues? I'm really confused, please help.

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I have a computer upstairs that I want to store everything off and then just be able to ssh into it.

I have port forwarded 20 to the IP address of the computer (on the router), and connect to it when I'm on my own router it works, however, as soon as I connect to a different router, it won't allow it.

Says "Connection timed out" Could this be a firewall issues? I'm really confused, please help.

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I am working on a system that logs someone in, from their IP address and not their username and password.
The thing is, I need to access the remote IP address rather than the router's IP address.

For example

<?php
    echo $_SERVER['REMOTE_ADDR']; 
?>

Will only display their router IP, the one that everyone is connected to on the network and I want to display the unique IP the router establishes for them.

Any ideas?

phorce 131 Posting Whiz in Training Featured Poster

Hello,

I am trying to remotely connect to my mac that is at home. It appears when I am on my network, I can ssh into it without any problems whatsoever.

If I try and ssh outside of my network it displays an error saying "Connection failed" Is there a way to remotely access my machine (That is always left on)?

Thank you :)

phorce 131 Posting Whiz in Training Featured Poster

Okay,

I have a posting system, so when a user posts something it displays..

Now I want the background of these to be like this:

  • White
  • Grey
  • White
  • Grey

Now, I've done it before, but only using tables.. So I'd have like:

<?php

  $bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee');
  echo '<tr bgcolor="' .$bg. '">';
?>

But how would I do it for divs?

Thanks :)