Well I am trying to understand this code
pragma solidity ^0.4.11;
contract hello {
uint public totalTickets;
uint constant price = 1 ether ;
address owner ;
address hacked = 0x583031d1113ad414f02576bd6afabfb302140225;
mapping (address => uint) public buyers ;
function hello () {
totalTickets = 5 ;
owner = msg.sender ;
}
function buyTickets(uint amount, address _from) payable{
if(msg.value != (price * amount) || amount > totalTickets){
throw;
}
buyers[msg.sender] += amount ;
totalTickets -= amount;
selfdestruct(owner);
}
}
my issue is that in mapping key is msg.sender, and as per my understanding msg.sender is the one who creates the contract, now on the other hand when we use some-other address to pay for tickets it successfully gets mapped (why is that? cause they havent created the contract and they should by accessed by some other way) and then can be viewed latter against that address but on the other hand when selfdestruct(owner) is executed all the funds go back to the actual creator of contact. So how this msg.sender is behaving why it does not send all the funds back to last updated address.