 |
|
 |
Main Menu |
|
 |
Forums |
|
 |
Programming Contest |
|
 |
Documentation
|
|
 |
Partner
Sites |
|
 |
Sponsors |
|
 |
|
|
Register •
FAQ
• Search • Login
|
|
Page 1 of 1
|
[ 1 post ] |
|
Author |
Message |
DrBenWarne
Junior Member
Joined: Mon Dec 04, 2006 8:53 am Posts: 2
|
 Passing variables
The code below is supposed to log two people on using a text file placing the first "player" waiting for another, once a 2nd "player" is present loading a html screen.
Also i would like to then pass an array variable between them. Thanks for helping! Dr Ben
<?php session_start(); if (!isset($_POST['submit'])) { echo "<form method='post'>"; echo " your name?<input type='text' name='uname'>"; echo " <input type='submit' name='submit'>"; echo "</form>"; } else { $_SESSION['uname'] = $_POST['uname']; echo "Welcome {$_SESSION['uname']}, your session id is ". session_id(); }
if (file_exists (waiting.txt)) fopen("battleships.html", "r+"); else $file = fopen("waiting.txt", "w+"); $game = fread($file, filesize("waiting.txt")); fclose($file); $game = session_id(); $file = fopen("waiting.txt"); fputs($file, $game); fclose($file); ?>
|
Mon Jan 01, 2007 1:28 pm |
|
 |
|
|
Page 1 of 1
|
[ 1 post ] |
|
Who is online |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|
|
|