Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form + post problem

Status
Not open for further replies.

MJB3K

Programmer
Jul 16, 2004
524
GB
Hi, i am developing this chatroom script and would like to know if this is possible:

say if i typed in a textbox:

admin_kick username

then clicked submit, how in a php script could it know if the command admin_kick had been typed, then get the username??

is this possible??

sorry if its not clear!

Regards,

Martin

Gaming Help And Info:
 
did you go for the explode() ?
ps. why admin_kick, and not simply just /kick ?

then you can have commands that are like the IRC clients:
/kick <#channel> <nick>
/ban <#channel> <nick>
/op <#channel> <nick>
/voice <nick>
/devoice <nick>
/mode <#channel> <modes>
/topic <#channel> <topic>

if no channel specified, current is default.

etc etc.

Olav Alexander Mjelde
Admin & Webmaster
 
yea good idea :D thanx

another q...

how would you make it so when another user submits text, your screen updates to display it??


Regards,

Martin

Gaming Help And Info:
 
yea i did go for explode.

How would i do it to get the channel then user/topic using the example you gave me below:

/kick <#channel> <nick>

my code:
Code:
$cmd = $_POST['theCmd'];

$doCmd = explode(" ", $cmd);
echo "Command used: " . $doCmd[0] . " " .$doCmd[1];

<form name="cmd" action="cmd.php" method="post">
<input type="text" name="theCmd" size="60">
<input type="submit" value="Execute">
<input type="hidden" name="beenSub" value="true">
</form>

any ideas??

Regards,

Martin

Gaming Help And Info:
 
I would guess, regular expressions..

if pattern does match, explode it and then you know what is action, what is target and what is mode

if not match, try the pattern without target..

eg. /topic foobar

if it is not /topic #channel foobar, try for pattern /topic foobar

then, if second pattern is ok, make target active channel.

for refresh when content is updated, is worse..

you would need javascript or meta-refresh to refresh the page, on a given interval.. you cant force the client to refresh, when he has loaded the page.

you could do this thingy in java though, or maybe flash.. as that is able to stream content.

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top