<?xml version="1.0" encoding="UTF-8" ?><connect player="player2" />
database: | player1_username = null | player2_username = null|
player1 and player2 are pulling info from server.
if (SELECT player1 FROM players) == NULL:
UPDATE players SET player1 = 'player1abc'
else:
UPDATE players SET player2 = 'player2fff'
<?xml version="1.0" encoding="UTF-8" ?><connect status='yes' msg='start' op="yesss"/>
if player1 != null and player2 != null
Game_start = 1
server updates database:
1. Drop "gamelive" table
2. create "Gamelive" table
3. insert ID of player2 to userName of Gamelive, which means player1 should play first!!!
pulling info from server -> userName != device’s username => you can place your disc => need to wait and update grids
<?xml version="1.0" encoding="UTF-8" ?><connect status='yes' usr="player2" gridNum="43"/>
Player playaction done -> send (userName + gridNum) -> Server: update database ->
game end according to local devices.
if game ends => send info to server
Drop “players” table
http://webdev.cse.msu.edu/~longziya/cse476/proj2/create-user.php?user=longziya&magic=NechAtHa6RuzeR8x&pw= &usr=yesss &psw=666
create table players(player1 varchar(255),player2 varchar(255))
insert players (player1,player2) values(NULL,NULL)
UPDATE players SET player1= NULL,player2= NULL
DROP TABLE gamelive
CREATE TABLE Gamelive (
userName VARCHAR,
gridNum INT
)
- insert into connect(user, password) values(‘yesss’, ‘666’);
- select * from connect;