From perl to php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Poggyuk
    Member
    • Nov 2002
    • 98

    From perl to php

    If this is possible, could someone please tell me how to do this, do this for me or tell me where i could find a turorial for this sort of thing...

    Basically all that i want to do is change a perl script into a php script...

    I've attached at the bottom of this post for you...

    A demo of it can be found at: http://www.webboards.net/cgi-bin/cha...demo&user=java

    Thanks in advance for anyone that thinks they can help...

    Here it is:
    #!/usr/bin/perl


    if ($ENV{'REQUEST_METHOD'} eq 'GET') {
    $buffer= $ENV{'QUERY_STRING'} ;
    } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    }
    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs)
    {
    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s/~!/ ~!/g;
    $FORM{$name} = $value;
    }
    print "Content-type: text/html\n\n";

    if ($FORM{'channel'} eq "") {
    print <<"eof";
    <html>
    <head>
    <title>WebBoards</title>
    <style type="text/css">
    BODY {
    SCROLLBAR-BASE-COLOR: #606096;
    SCROLLBAR-ARROW-COLOR: #FFF788;
    }
    </style>
    <script>
    function hidestatus(){
    window.status='WebBoards'
    return true
    }
    if (document.layers)
    document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
    document.onmouseover=hidestatus
    document.onmouseout=hidestatus
    </script>
    </head>
    <body bgcolor="#A8A8A8">
    <div align="center"><center>
    <form action="chat.pl" method="POST">
    <input type="hidden" name="channel" value="$FORM{'chan'}">
    <input type="hidden" name="userd" value="$FORM{'user'}">
    <table border="0" cellpadding="0" cellspacing="1" width="85%"
    bgcolor="#000000">
    <tr>
    <td><table border="0" cellpadding="2" cellspacing="0"
    width="100%" bgcolor="#FFFFFF" height="203">
    <tr>
    <td height="21"><font size="3" face="Arial"><strong>Chat Room Preferences</strong></font></td>
    </tr>
    <tr>
    <td height="28"><font face="Verdana"><font size="2">Show Joins/Parts in the
    channel: Yes </font><input
    type="radio" checked name="c1" value="true"> <font size="2">No</font><font
    size="false"> </font><input type="radio"
    name="c1" value="2"></font></td>
    </tr>
    <tr>
    <td height="28"><font face="Verdana"><font size="2">Font Size: 12 </font><input
    type="radio" name="c2" value="12"> <font
    size="2">13 <input type="radio" checked name="c2"
    value="13"></font></font></td>
    </tr>
    <tr>
    <td height="29"><font face="Verdana"><font size="2">Background/Foreground: - White/Black
    </font><input type="radio" checked name="c3" value="1">
    <font size="2">Black/White </font><input
    type="radio" name="c3" value="2"></font></td>
    </tr>
    <tr>
    <td height="28" valign="bottom"><p align="center"><font size="2" face="Verdana"><strong>Your
    Nickname:</strong></font></p>
    </td>
    </tr>
    <tr>
    <td height="25"><p align="center"><input type="text"
    size="20" name="nickname" value="Guest"></p>
    </td>
    </tr>
    <tr>
    <td height="27"><p align="center"><input type="submit"
    name="B1" value="Chat Now!"><input type="reset"
    name="B1" value="Reset"></p>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </form>
    </center></div>
    <p align="center"><font color="#FFFFFF" size="1" face="Verdana">Copyright &copy; WebBoards</font></p>
    </body>
    </html>

    eof
    exit;
    }
    if ($FORM{'c3'} eq "1") {
    $bg = 'FFFFFF';
    $fg = '000000';
    } else {
    $bg = '000000';
    $fg = 'FFFFFF';
    }
    print <<"eofg";
    <html>
    <head>
    <title>Welcome To The $FORM{'channel'} Chat Room!</title>
    <base target="_self">
    <style type="text/css">
    BODY {
    SCROLLBAR-BASE-COLOR: #606096;
    SCROLLBAR-ARROW-COLOR: #FFF788;
    }
    </style>
    <script>
    function hidestatus(){
    window.status='WebBoards'
    return true
    }
    if (document.layers)
    document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
    document.onmouseover=hidestatus
    document.onmouseout=hidestatus
    </script>
    </head>
    <body bgcolor="#666696" topmargin="0" leftmargin="0">
    <applet CODE="com.chatspace.Browser3x.Chat"
    CODEBASE="http://127.0.0.1/Java/"
    ARCHIVE="http://127.0.0.1/Java/cs3fu.zip" NAME="cs" WIDTH="100%"
    HEIGHT="100%">
    <param name="cabbase" value="cs3fu.cab">
    <param name="port" value="7000">
    <param name="showurl" value="False">
    <param name="restricted" value="False">
    <param name="simple" value="False">
    <param name="user" value="$FORM{'userd'}">
    <param name="nick" value="$FORM{'nickname'}">
    <param name="room" value="$FORM{'channel'}">
    <param name="fg" value="$fg">
    <param name="bg" value="$bg">
    <param name="size" value="$FORM{'c2'}">
    <param name="showjoins" value="$FORM{'c1'}">
    <param name="font" value="Arial">
    <param name="inputprompt" value="True">
    <param name="allowtour" value="False">
    <param name="tourprompt" value="False">
    <param name="history" value="300">
    <param name="prefixself" value="True">
    <param name="tabs" value="True">
    <param name="dnd" value="False">
    <param name="sound" value="False">
    </applet>
    <div align="center">
    <center>
    <table border="0" width="99%" cellpadding="3" cellspacing="0" height="1">
    <tr>
    <td width="121%" colspan="5" height="21" bgcolor="#666696">
    <b><font face="Verdana" size="2" color="#FFF788">Welcome To The $FORM{'channel'} Chat Room!</font></b>
    </td>
    </tr>
    <tr>
    <td width="121%" colspan="5" height="1" bgcolor="#8080A6">
    <font face="Verdana" color="#FFFFFF" size="1"><b>Chat Room Controls:</b></font>
    </td>
    </tr>
    <tr>
    <td width="16%" height="1" bgcolor="#E4E4E4" valign="middle" align="center">
    <form name=chnick onSubmit="document.cs.nick(document.chnick.nick.value);return false">
    <input name=nick type=text size="23">
    <input type=submit value="Change Nickname">
    </form>
    </td>
    <td width="16%" height="1" bgcolor="#E4E4E4" valign="middle" align="center">
    <form name="chnick2"
    onsubmit="document.cs.output('/silence ' + document.chnick2.nick.value);return false">
    <input name="nick"
    type="text" size="15"> <input type="submit"
    value="Silence User"> </font></p>
    </center></div>
    </form>
    </td>
    <td width="17%" height="1" bgcolor="#E4E4E4" valign="middle" align="center">
    <form name="theform">
    <br>
    <input type="button" value="Register My Nick" onClick="document.cs.output('/profile ' + document.cs.getNick());">
    </form>
    </td>
    <td width="34%" height="1" align="center" bgcolor="#E4E4E4" valign="middle">
    <form name="theform2">
    <p align="center">
    <font face="Verdana" size="2">
    Sound:
    <input type="button" value="On" onClick="document.cs.sounds(true); alert('Sounds are now on');">
    <input type="button" value="Off" onClick="document.cs.sounds(false); alert('Sounds are now off');"><br>
    Joins:&nbsp;&nbsp;
    <input type="button" value="On" onClick="document.cs.showJoins(true); alert('Joins/Parts are now shown');">
    <input type="button" value="Off" onClick="document.cs.showJoins(false); alert('Joins/Parts are now hidden');"><br>
    DND:&nbsp;&nbsp;&nbsp; <input type="button" value="On" onClick="document.cs.dnd(true); alert('Do Not Disturb is now on');">
    <input type="button" value="Off" onClick="document.cs.dnd(false); alert('Do Not Disturb is now off');">
    </font>
    </form>
    </td>
    <td width="17%" height="1" bgcolor="#E4E4E4" valign="middle" align="center">
    <form>
    <br>
    <input type=button value="Log Off" onClick="document.cs.output('/Quit Signed Off')"> </form>
    </td>
    </tr>
    <tr>
    <td width="16%" height="51" bgcolor="#D6D6D6" valign="top">

    <table border="0" width="100%">
    <tr>
    <td width="100%"><font size="1" face="MS Sans Serif">If you would like to
    use a different nickname: type in your new nickname in the textbox above
    and press 'Change Nickname'.</font></td>
    </tr>
    </table>

    </td>
    <td width="16%" height="51" bgcolor="#D6D6D6" valign="top">

    <table border="0" width="100%">
    <tr>
    <td width="100%"><font size="1" face="MS Sans Serif">To ignore an abusive
    member: type in the members nickname and click 'Silence User'</font></td>
    </tr>
    </table>

    </td>
    <td width="17%" height="51" bgcolor="#D6D6D6" valign="top">

    <table border="0" width="100%">
    <tr>
    <td width="100%"><font face="MS Sans Serif" size="1">To register your
    nickname: click the above button and type in your password in the text box
    that pops up.</font></td>
    </tr>
    </table>

    </td>
    <td width="34%" height="51" bgcolor="#D6D6D6" valign="top">

    <table border="0" width="100%">
    <tr>
    <td width="100%"><font size="1" face="MS Sans Serif">Sound: Turn user
    created sounds on or off.&nbsp; Joins: choose whether you want to see when
    a member joins or parts the room.&nbsp; DND: when on you will not receive
    p2ps.</font></td>
    </tr>
    </table>

    </td>
    <td width="17%" height="51" bgcolor="#D6D6D6" valign="top">
    <table border="0" width="100%">
    <tr>
    <td width="100%"><font size="1" face="MS Sans Serif">Clicking 'Log Off' will
    end your chat session.</font></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="121%" colspan="5" height="1" bgcolor="#8080A6">
    <font face="Verdana" color="#FFFFFF" size="1"><b>Help And Information:</b></font>
    </td>
    </tr>
    <tr>
    <td width="121%" colspan="5" height="108" bgcolor="#EAEAEA">
    <table border="0" width="100%">
    <tr>
    <td width="100%"><font face="Verdana" size="1"><b>To begin chatting:</b>&nbsp;
    Please allow time for the chat applet to load, it could take a few minutes
    depending on your connection.&nbsp; Once the chat applet is loaded, type
    in your nickname and press connect.&nbsp; If a password screen pops up,
    and you do not know the password, this nickname is most likely registered
    to someone else so please use a different nickname.&nbsp; Using the Guest
    nickname will always allow you to logon without being asked for a
    password.&nbsp; We recommend that you register your nickname and keep the
    password in a safe place.</font>
    <p><font face="Verdana" size="1"><b>Important Notice:</b>&nbsp; Please do
    not give out personal information such as your real name, home address,
    phone number or any passwords when chatting online.&nbsp; We ask that you
    are kind and courteous to other chatroom members.</font></p>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </center>
    </div>
    <div align="center">
    <center>
    <table border="0" width="99%" cellspacing="0" cellpadding="0">
    <tr>
    <td width="100%" bgcolor="#8080A6">
    <p align="center"><font color="#FFFFFF" size="1" face="Verdana">Copyright &copy; WebBoards</font></p></td>
    </tr>
    </table>
    </center>
    </div>
    <p align="center"><br>
    </p>
    </body>
    </html>


    eofg
    exit;
  • TeKnIcIaN
    Member
    • Feb 2003
    • 53

    #2
    I don't beleive I actually did this for you..... but I ain't gonna fix your other broken parts.
    PHP Code:
    <?php

    if ($_SERVER['REQUEST_METHOD'] == 'GET') {
        
    $FORM $HTTP_GET_VARS;
    } else {
        
    $FORM $HTTP_POST_VARS;
    }
    if (
    $FORM['channel'] == "" ) {
    ?>
    <html>
    <head>
    <title>WebBoards</title>
    <style type="text/css">
    BODY {
    SCROLLBAR-BASE-COLOR: #606096;
    SCROLLBAR-ARROW-COLOR: #FFF788;
    }
    </style>
    <script>
    function hidestatus(){
    window.status='WebBoards'
    return true
    }
    if (document.layers)
    document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
    document.onmouseover=hidestatus
    document.onmouseout=hidestatus
    </script>
    </head>
    <body bgcolor="#A8A8A8">
    <div align="center"><center>
    <form action="chat.pl" method="POST">
    <input type="hidden" name="channel" value="<?=$FORM['chan']?>">
    <input type="hidden" name="userd" value="<?=$FORM['user']?>">
    <table border="0" cellpadding="0" cellspacing="1" width="85%"
    bgcolor="#000000">
    <tr>
    <td><table border="0" cellpadding="2" cellspacing="0"
    width="100%" bgcolor="#FFFFFF" height="203">
    <tr>
    <td height="21"><font size="3" face="Arial"><strong>Chat Room Preferences</strong></font></td>
    </tr>
    <tr>
    <td height="28"><font face="Verdana"><font size="2">Show Joins/Parts in the
    channel: Yes </font><input
    type="radio" checked name="c1" value="true"> <font size="2">No</font><font
    size="false"> </font><input type="radio"
    name="c1" value="2"></font></td>
    </tr>
    <tr>
    <td height="28"><font face="Verdana"><font size="2">Font Size: 12 </font><input
    type="radio" name="c2" value="12"> <font
    size="2">13 <input type="radio" checked name="c2"
    value="13"></font></font></td>
    </tr>
    <tr>
    <td height="29"><font face="Verdana"><font size="2">Background/Foreground: - White/Black
    </font><input type="radio" checked name="c3" value="1">
    <font size="2">Black/White </font><input
    type="radio" name="c3" value="2"></font></td>
    </tr>
    <tr>
    <td height="28" valign="bottom"><p align="center"><font size="2" face="Verdana"><strong>Your
    Nickname:</strong></font></p>
    </td>
    </tr>
    <tr>
    <td height="25"><p align="center"><input type="text"
    size="20" name="nickname" value="Guest"></p>
    </td>
    </tr>
    <tr>
    <td height="27"><p align="center"><input type="submit"
    name="B1" value="Chat Now!"><input type="reset"
    name="B1" value="Reset"></p>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </form>
    </center></div>
    <p align="center"><font color="#FFFFFF" size="1" face="Verdana">Copyright &copy; WebBoards</font></p>
    </body>
    </html>

    <?php
    exit;
    }
    if (
    $FORM['c3'] == "1" ) {
    $bg 'FFFFFF';
    $fg '000000';
    } else {
    $bg '000000';
    $fg 'FFFFFF';
    }
    ?>
    <html>
    <head>
    <title>Welcome To The <?=$FORM['channel']?> Chat Room!</title>
    <base target="_self">
    <style type="text/css">
    BODY {
    SCROLLBAR-BASE-COLOR: #606096;
    SCROLLBAR-ARROW-COLOR: #FFF788;
    }
    </style>
    <script>
    function hidestatus(){
    window.status='WebBoards'
    return true
    }
    if (document.layers)
    document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)
    document.onmouseover=hidestatus
    document.onmouseout=hidestatus
    </script>
    </head>
    <body bgcolor="#666696" topmargin="0" leftmargin="0">
    <applet CODE="com.chatspace.Browser3x.Chat"
    CODEBASE="http://127.0.0.1/Java/"
    ARCHIVE="http://127.0.0.1/Java/cs3fu.zip" NAME="cs" WIDTH="100%"
    HEIGHT="100%">
    <param name="cabbase" value="cs3fu.cab">
    <param name="port" value="7000">
    <param name="showurl" value="False">
    <param name="restricted" value="False">
    <param name="simple" value="False">
    <param name="user" value="<?=$FORM['userd']?>">
    <param name="nick" value="<?=$FORM['nickname']?>">
    <param name="room" value="<?=$FORM['channel']?>">
    <param name="fg" value="<?=$fg?>">
    <param name="bg" value="<?=$bg?>">
    <param name="size" value="<?=$FORM['c2']?>">
    <param name="showjoins" value="<?=$FORM['c1']?>">
    <param name="font" value="Arial">
    <param name="inputprompt" value="True">
    <param name="allowtour" value="False">
    <param name="tourprompt" value="False">
    <param name="history" value="300">
    <param name="prefixself" value="True">
    <param name="tabs" value="True">
    <param name="dnd" value="False">
    <param name="sound" value="False">
    </applet>
    <div align="center">
    <center>
    <table border="0" width="99%" cellpadding="3" cellspacing="0" height="1">
    <tr>
    <td width="121%" colspan="5" height="21" bgcolor="#666696">
    <b><font face="Verdana" size="2" color="#FFF788">Welcome To The <?=$FORM['channel']?> Chat Room!</font></b>
    </td>
    </tr>
    <tr>
    <td width="121%" colspan="5" height="1" bgcolor="#8080A6">
    <font face="Verdana" color="#FFFFFF" size="1"><b>Chat Room Controls:</b></font>
    </td>
    </tr>
    <tr>
    <td width="16%" height="1" bgcolor="#E4E4E4" valign="middle" align="center">
    <form name=chnick onSubmit="document.cs.nick(document.chnick.nick.value);return false"> 
    <input name=nick type=text size="23"> 
    <input type=submit value="Change Nickname"> 
    </form> 
    </td>
    <td width="16%" height="1" bgcolor="#E4E4E4" valign="middle" align="center">
    <form name="chnick2"
    onsubmit="document.cs.output('/silence ' + document.chnick2.nick.value);return false">
    <input name="nick"
    type="text" size="15"> <input type="submit"
    value="Silence User"> </font></p>
    </center></div>
    </form>
    </td>
    <td width="17%" height="1" bgcolor="#E4E4E4" valign="middle" align="center">
    <form name="theform">
    <br>
    <input type="button" value="Register My Nick" onClick="document.cs.output('/profile ' + document.cs.getNick());">
    </form>
    </td>
    <td width="34%" height="1" align="center" bgcolor="#E4E4E4" valign="middle">
    <form name="theform2">
    <p align="center">
    <font face="Verdana" size="2">
    Sound:
    <input type="button" value="On" onClick="document.cs.sounds(true); alert('Sounds are now on');">
    <input type="button" value="Off" onClick="document.cs.sounds(false); alert('Sounds are now off');"><br>
    Joins:&nbsp;&nbsp;
    <input type="button" value="On" onClick="document.cs.showJoins(true); alert('Joins/Parts are now shown');">
    <input type="button" value="Off" onClick="document.cs.showJoins(false); alert('Joins/Parts are now hidden');"><br>
    DND:&nbsp;&nbsp;&nbsp; <input type="button" value="On" onClick="document.cs.dnd(true); alert('Do Not Disturb is now on');">
    <input type="button" value="Off" onClick="document.cs.dnd(false); alert('Do Not Disturb is now off');">
    </font>
    </form>
    </td>
    <td width="17%" height="1" bgcolor="#E4E4E4" valign="middle" align="center">
    <form>
    <br>
    <input type=button value="Log Off" onClick="document.cs.output('/Quit Signed Off')"> </form> 
    </td>
    </tr>
    <tr>
    <td width="16%" height="51" bgcolor="#D6D6D6" valign="top">

    <table border="0" width="100%">
    <tr>
    <td width="100%"><font size="1" face="MS Sans Serif">If you would like to
    use a different nickname: type in your new nickname in the textbox above
    and press 'Change Nickname'.</font></td>
    </tr>
    </table>

    </td>
    <td width="16%" height="51" bgcolor="#D6D6D6" valign="top">

    <table border="0" width="100%">
    <tr>
    <td width="100%"><font size="1" face="MS Sans Serif">To ignore an abusive
    member: type in the members nickname and click 'Silence User'</font></td>
    </tr>
    </table>

    </td>
    <td width="17%" height="51" bgcolor="#D6D6D6" valign="top">

    <table border="0" width="100%">
    <tr>
    <td width="100%"><font face="MS Sans Serif" size="1">To register your
    nickname: click the above button and type in your password in the text box
    that pops up.</font></td>
    </tr>
    </table>

    </td>
    <td width="34%" height="51" bgcolor="#D6D6D6" valign="top">

    <table border="0" width="100%">
    <tr>
    <td width="100%"><font size="1" face="MS Sans Serif">Sound: Turn user
    created sounds on or off.&nbsp; Joins: choose whether you want to see when
    a member joins or parts the room.&nbsp; DND: when on you will not receive
    p2ps.</font></td>
    </tr>
    </table>

    </td>
    <td width="17%" height="51" bgcolor="#D6D6D6" valign="top">
    <table border="0" width="100%">
    <tr>
    <td width="100%"><font size="1" face="MS Sans Serif">Clicking 'Log Off' will
    end your chat session.</font></td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="121%" colspan="5" height="1" bgcolor="#8080A6">
    <font face="Verdana" color="#FFFFFF" size="1"><b>Help And Information:</b></font>
    </td>
    </tr>
    <tr>
    <td width="121%" colspan="5" height="108" bgcolor="#EAEAEA">
    <table border="0" width="100%">
    <tr>
    <td width="100%"><font face="Verdana" size="1"><b>To begin chatting:</b>&nbsp;
    Please allow time for the chat applet to load, it could take a few minutes
    depending on your connection.&nbsp; Once the chat applet is loaded, type
    in your nickname and press connect.&nbsp; If a password screen pops up,
    and you do not know the password, this nickname is most likely registered
    to someone else so please use a different nickname.&nbsp; Using the Guest
    nickname will always allow you to logon without being asked for a
    password.&nbsp; We recommend that you register your nickname and keep the
    password in a safe place.</font>
    <p><font face="Verdana" size="1"><b>Important Notice:</b>&nbsp; Please do
    not give out personal information such as your real name, home address,
    phone number or any passwords when chatting online.&nbsp; We ask that you
    are kind and courteous to other chatroom members.</font></p>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </center>
    </div>
    <div align="center">
    <center>
    <table border="0" width="99%" cellspacing="0" cellpadding="0">
    <tr>
    <td width="100%" bgcolor="#8080A6">
    <p align="center"><font color="#FFFFFF" size="1" face="Verdana">Copyright &copy; WebBoards</font></p></td>
    </tr>
    </table>
    </center>
    </div>
    <p align="center"><br>
    </p>
    </body>
    </html>
    this software comes with no warranty, support, or nothing

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...