The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Automatic Email Signup

Discussion in 'E-mail Discussions' started by frontdoorguy, Mar 10, 2003.

  1. frontdoorguy

    frontdoorguy Registered

    Joined:
    Mar 10, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Sandy, Utah, USA
    Hi All,

    I found one thread in this forum on automatic email signups through cpanel, but that thread led to a dead-end. Does anyone know where I can find such a script? :confused:
     
  2. wozza

    wozza Member

    Joined:
    Feb 14, 2002
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    mail creation scripts

    Here is some scripts that I copied from previous posts on this forum re creating mail accts from php scripts.
    you would need to find which works and modify to suit.
    hope this helps :)

    $host = "www.domain.com";
    $socket = fsockopen($host,2082);
    $user = "cpaneluser";
    $password = "cpanelpass";
    $authstr = "$user:$password";
    $pass = base64_encode($authstr);
    $in = "GET /frontend/default/mail/doaddpop.html?email=emailaddress&domain=domain.com&password=emailpassword&quota=10 HTTP/1.0\r\nAuthorization: Basic $pass \r\n";

    fputs($socket,$in);
    fclose( $socket );

    it may be a little slow but it definitely works, and I suppose this means that you can use it do any command really,

    ================
    <?
    if ($submit){
    $host = "www.1337ster.com";
    $domain = "1337ster.com";
    $socket = fsockopen($host,2082);
    $user = "jimmyc";
    $password = "859780barryw";
    $authstr = "$user:$password";
    $pass = base64_encode($authstr);
    $in = "GET /frontend/default/mail/doaddpop.html?email=$email&domain=$domain&password=$password&quota=$quota HTTP/1.0\r\nAuthorization: Basic $pass \r\n";

    fputs($socket,$in);
    fclose( $socket );
    }
    else {
    ?>
    <form method=post>
    Username:<input type=text name=email><br>
    Password:<input type=password name=password><br>
    Quota:<input type=text name=quota>
    <input type=submit name=submit value=submit>
    <?
    }
    ?>

    =====
    set REMOTE_USER to your username and run

    use /usr/local/cpanel/cpanel-email

    # /usr/local/cpanel/cpanel-email
    cpanel-email: usage addpop <popuser> <password> <quota> <domain> delpop <popuser> 0 <domain>
    =========

    $in = "GET /frontend/USER_THEME/mail/dopasswdpop.html?email=$email&domain=$domain&password=$password1"a=$quota HTTP/1.0\r\nAuthorization: Basic $pass \r\n";

    Make sure your form's input names match the email, password and quota variables on this line.

    Replace the USER_THEME with bluelagoon, default, iconic or whatever the theme for the account is and leave all the rest in the script as is.

    ==========
    header("Location: index.php"); /* Redirect browser */
    exit; /* Make sure that code below does
    not get executed when we redirect. */

    make the index.php file whereever you want to redirect too.


    ===============
    For thoes of your that used Jim Carters neomail create script.

    There is an error in that after you create the email account the user will not beable to login to neomail the reason for this is the cpanel password and user name conflict with the form that is made with it to fix it do this.


    Original:


    <?
    if ($submit){
    $host = "www.domain.com";
    $domain = "domain.com";
    $socket = fsockopen($host,2082);
    $user = "cpaneluser";
    $password = "cpanelpass";
    $authstr = "$user:$password";
    $pass = base64_encode($authstr);
    $in = "GET /frontend/default/mail/doaddpop.html?email=$email&domain=$domain&password=$password&quota=$quota HTTP/1.0\r\nAuthorization: Basic $pass \r\n";

    fputs($socket,$in);
    fclose( $socket );
    }
    else {
    ?>
    <form method=post>
    Username:<input type=text name=email><br>
    Password:<input type=password name=password><br>
    Quota:<input type=text name=quota>
    <input type=submit name=submit>
    <?
    }
    ?>

    Fixed version:

    <?
    if ($submit){
    $host = "www.domain.com";
    $domain = "domain.com";
    $socket = fsockopen($host,2082);

    // these lines are changed
    $cpaneluser = "cpaneluser";
    $cpanelpass = "cpanelpass";
    $authstr = "$cpaneluser:$cpanelpass";
    //****************************

    $pass = base64_encode($authstr);
    $in = "GET /frontend/default/mail/doaddpop.html?email=$email&domain=$domain&password=$password&quota=$quota HTTP/1.0\r\nAuthorization: Basic $pass \r\n";

    fputs($socket,$in);
    fclose( $socket );
    }
    else {
    ?>
    <form method=post>
    Username:<input type=text name=email><br>
    Password:<input type=password name=password><br>
    Quota:<input type=text name=quota>
    <input type=submit name=submit>
    <?
    }
    ?>


    ================

    I have been trying to utilise the signup script that is used on http://www.warwithboredom.com which allows users to signup for email acounts via a html form, however i cant seem to get the file to work.

    If posts the username and password to the sql but isnt setting up the pop account.

    The program consists of two files and a sql

    the files are: config.php

    <?
    //before this will work you will need to make a database and then run signup.sql in phpmyadmin
    //if you need any help email me at support@warwithboredom.com
    //also once you have made the table you Must add any email addresses that you already have
    //to the data base manually otherwise this script can overwrite mailboxes


    $host = "www.yourdomain.com";//your url
    $domain = "yourdomain.com";//your domain without the www
    $cpaneluser = "username";//your cpanel username
    $cpanelpass = "password";//your cpanel password
    $cpaneltheme= "cpanelxp_hg"; //this is the word after frontend/ and the next / when you login to cpanel
    $dbhost="localhost"; //Usually localhost
    $dbuser="user";//mysql username
    $dbtable="users";//only change this if you have access to only one database
    $dbpass="";//mysql password
    $dbname="users";//The name of the database
    $quota=4000;//how much space in k you want to give the user
    $mailurl="mail/index.php";//The url for your web based mail program I use http://uebimiau.sourceforge.net but you can use anything
    //see http://www.hotscripts.com/PHP/Scripts_and_Programs/Email_Systems

    //End of settings! you should not need to change anything below this

    ?>



    and


    signup.php

    <?php
    $pathtoconfig="config.php";
    include("theme.php";
    doheader();
    if(isset($newuser))
    {
    include($pathtoconfig);

    $newemail = "$newuser@$domain";
    $mpassword = $password2;

    $link = mysql_connect($dbhost, $dbuser, $dbpass);
    mysql_select_db($dbname) or die("Could not select database";
    $query="SELECT username FROM $dbtable WHERE((username = '$username'))";
    $result= mysql_query($query,$link);
    if(mysql_num_rows($result) ==0)
    {
    $query="INSERT INTO $dbtable(name,username,password,email) VALUES ('$name','$newuser','$pass2','$replymail');";
    mysql_query($query,$link);
    $socket = fsockopen($host,2082);
    $authstr = "$cpaneluser:$cpanelpass";
    $pass = base64_encode($authstr);
    $in = "GET /frontend/$cpaneltheme/mail/doaddpop.html?email=$newemail&domain=$domain&password=$mpassword&a=$quota\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n";
    fputs($socket,$in);
    fclose( $socket );
    ?> Your account has been setup successfully please login <a href="mail/index.php">here</a>
    <?
    }
    else {
    echo "Username already in use please try another one.<br><a href=signup.php>Back</a>";
    }
    mysql_close($link);
    }

    else { ?>
    <form name="orderform" method="post" action="signup.php">
    <table border="0" cellspacing="1" cellpadding="0">
    <tr>
    <td>Your full Name:</td>
    <td colspan="2"><input name="name" type="text"></td>
    </tr>
    <tr>
    <td width="147">Other Email Address:</td>
    <td colspan="2"><input name="replymail" type="text">
    (In case you forget your password)</td>
    </tr>
    <tr>
    <td>Prefered Email Address:</td>
    <td colspan="2"><input name="newuser" type="text">
    @WarWithBoredom.com</td>
    </tr>
    <tr>
    <td>Password:</td>
    <td colspan="2"><input name="password1" type="password"></td>
    </tr>
    <tr>
    <td>Retype Password:</td>
    <td colspan="2"><input name="password2" type="password"></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td width="344"> <div align="center">
    <input name="signupbtn" type="button" id="signupbtn" value="Signup" onClick="validateform()">
    </div></td>
    <td width="163">&nbsp;</td>
    </tr>
    </table>
    <script language="JavaScript1.2">


    function validateform()
    {
    if (checkEmailAddress(document.orderform.replymail))
    {
    if(document.orderform.password1.value == document.orderform.password2.value)
    {
    document.orderform.submit();
    }
    else
    {
    alert("The passwords you typed do not appear to match";
    }
    }
    }

    function checkEmailAddress(field) {
    var good;
    var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);

    if (goodEmail){
    good = true
    } else {
    alert('Please enter a valid e-mail address.')
    field.focus()
    field.select()
    good = false
    }
    return good;
    }


    </script>
    </form>
    <? }
    dofooter();
    ?>

    the sql file is:

    CREATE TABLE `users` (
    `name` char(50) NOT NULL default '',
    `username` char(50) NOT NULL default '',
    `password` char(20) NOT NULL default '',
    `id` int(11) NOT NULL auto_increment,
    `email` char(50) NOT NULL default '',
    PRIMARY KEY (`id`)
    ) TYPE=MyISAM;

    Now im trying to use this but cant seem to get it to work.

    My mail is horde which is available via :2095/horde/index.php and my cpanel theme is "cpanel"

    anyone have any ideas what may be wrong with this code?

    Ps ive had to cut this into two replies, as limit on 1000 words
     
  3. wozza

    wozza Member

    Joined:
    Feb 14, 2002
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    mail scripts Part 2

    PART 2 :)

    ====================
    A fix...
    [mail.php]
    // follow the instuctions given before...
    // the config file is the same
    <?
    $pathtoconfig="config.php";
    error_reporting(0);
    if (!include($pathtoconfig)){echo"Cannot include config file.<br />Please alert admin.\n";die;}

    if(isset($newuser)) {

    $newemail = "$newuser@$domain";

    $link = mysql_connect($dbhost, $dbuser, $dbpass);
    mysql_select_db($dbname) or die("Could not select database");
    $query="SELECT username FROM $dbtable WHERE((username = '$username'))";
    $result= mysql_query($query,$link);
    if(mysql_num_rows($result)==0) {
    $query="INSERT INTO $dbtable (name,username,password,email)
    VALUES ('$name','$newuser','$password2','$replymail');";
    mysql_query($query,$link);
    $socket = fsockopen($host,2082);
    $authstr = "$cpaneluser:$cpanelpass";
    $pass = base64_encode($authstr);
    $in = "GET /frontend/$cpaneltheme/mail/doaddpop.html?email=$newemail&domain=$domain&password=$password2&quota=$quota\r\n HTTP/1.0\r\nAuthorization: Basic $pass \r\n";
    fputs($socket,$in);
    fclose( $socket );
    ?>Your account has been setup successfully please login <a href="<?echo $mailurl;?>">here</a>. Use your full email address (<?echo $newemail;?>) as the username.<?
    }
    else {echo mysql_error();echo"<br />Username already in use please try another one.<br /><a href=\"".$_SERVER['PHP_SELF']."\">Back</a>";}
    mysql_close($link);
    }

    else { ?>
    <form name="orderform" method="post" action="<?echo$_SERVER['PHP_SELF'];?>">
    <table border="0" cellspacing="1" cellpadding="0">
    <tr>
    <td>Your full Name:</td>
    <td colspan="2"><input name="name" type="text" /></td>
    </tr>
    <tr>
    <td width="147">Other Email Address:</td>
    <td colspan="2"><input name="replymail" type="text" />(In case you forget your password)</td>
    </tr>
    <tr>
    <td>Prefered Email Address:</td>
    <td colspan="2"><input name="newuser" type="text" />@<?echo $domain;?></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td colspan="2"><input name="password1" type="password" /></td>
    </tr>
    <tr>
    <td>Retype Password:</td>
    <td colspan="2"><input name="password2" type="password" /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td width="344">
    <input name="signupbtn" type="button" id="signupbtn" value="Signup" onclick="validateform();" />
    </td>
    <td width="163">&nbsp;</td>
    </tr>
    </table>
    </form>

    <script language="JavaScript1.2">
    function validateform() {
    if (checkEmailAddress(document.orderform.replymail)) {
    if(document.orderform.password1.value == document.orderform.password2.value){
    document.orderform.submit();
    }
    else {alert("The passwords you typed do not appear to match");}
    }
    }

    function checkEmailAddress(field) {
    var good;
    var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
    if (goodEmail){good=1}
    else {
    alert('Please enter a valid e-mail address.');
    field.focus();
    field.select();
    good=0;
    }
    return good;
    }
    </script>
    <?}?>

    [/mail.php]



    ==============







    <?
    if ($submit){


    //Username, root directory NO TRAILING SLASH
    $home_directory = "/home/username";

    // Mailbox path
    $mail_path = "$home_directory/mail";

    $p_directory = "$home_directory/etc";

    $newuser = "$formusername";
    $usrPassword = "$formpass";


    chmod ("$p_directory/passwd", 0755);
    chmod ("$p_directory/shadow", 0755);
    chmod ("$p_directory/quota", 0755);


    if (is_dir("$mail_path/$newuser")){ echo "username taken, please try again"; die; }
    mkdir ("$mail_path/$newuser",0770);
    mkdir ("$mail_path/$newuser/uploads",0770);
    mkdir ("$mail_path/$newuser/addressbook",0770);


    $mailfile = fopen("$p_directory/passwd",'a');
    $shadowfile = fopen("$p_directory/shadow",'a');
    $quotafile = fopen("$p_directory/quota",'a');



    $mail = "$newuser:x:xxxxx:xxx::$home_directory:/bin/bash\n";

    $shadow = "$newuser:" . crypt($usrPassword, $usrPassword) . ":::::::\n";
    // convert quota to bytes, If you dont want them to set there own quota you can delete the $formquota variable, and put in a figure, ie. 5 and then remove the form compontent, allowing you to add quota.
    $formquot = $formquota * 1048576;


    $quota = "$newuser:$formquot";

    fputs($mailfile, $mail);
    fputs($shadowfile, $shadow);
    fputs($quotafile, $quota);
    fclose($quotafile);
    fclose($mailfile);
    fclose($shadowfile);
    echo "Account Created Successfully!";
    }
    else
    {
    ?>
    <html>
    <center><h4>Create New Mail User</h4><p>
    <form method=post>
    Username: <input type=text name=formusername><br>
    Password: <input type=password name=formpass><br>
    Quota in MB: <input type=text name=formquota><br>
    <input type=submit name=submit value=Submit>
    <?
    }
    ?>
     
  4. frontdoorguy

    frontdoorguy Registered

    Joined:
    Mar 10, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Sandy, Utah, USA
    Hey thanks, wozza!

    The first little snippet works just great. Just what I needed.

    ~FrontDoorGuy
     
  5. mbedwell

    mbedwell Member

    Joined:
    Oct 25, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Have followed the examples, can get the scripts to execute with no errors, but also get no results as far as mail accounts created.. any ideas?
     
  6. frontdoorguy

    frontdoorguy Registered

    Joined:
    Mar 10, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Sandy, Utah, USA
    Hello,

    My script quit working when my host upgraded the server and all the cPanel skins (or themes) went back to default. I use bluelagoon. Check the line that looks like this:

    $in = "GET /frontend/default/mail/doaddpop.html?email=$email&domain=$domain&password=$password"a=$quota HTTP/1.0\r\nAuthorization: Basic $pass \r\n";

    "default" is the directory of the default skin, so mine says "bluelagoon" instead of "default." Check to make sure your GET string has the proper directory. If that doesn't help, let me know and I'll help you get it working. Good luck!

    FrontDoorGuy
     
  7. mbedwell

    mbedwell Member

    Joined:
    Oct 25, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I've got the right theme configured, just double checked. but I can see another strange thing in your GET line. You have $password"a=... I have $password&a=... I thought maybe... so I tried it, and got an error...
     
  8. frontdoorguy

    frontdoorguy Registered

    Joined:
    Mar 10, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Sandy, Utah, USA
    Woops!

    I just snipped that code from one of the lines above. Here is what I actually use:

    $authstr = "$user:$domainpass";
    $psswd = base64_encode($authstr);
    $host = "www.$domainname";
    $socket = fsockopen($host,2082);
    $in = "GET /frontend/bluelagoon/mail/doaddpop.html?email=$usrname&domain=$domainname&password=$pwd&quota=10 HTTP/1.0\r\nAuthorization: Basic $psswd \r\n";
    fputs($socket,$in);
    fclose( $socket );

    I use this on an Apache server with Red Hat Linux 7.2, PHP 4+ and the latest cPanel. What is your setup?

    FrontDoorGuy
     
  9. kayb91

    kayb91 Registered

    Joined:
    Jul 1, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Help please

    Hi,

    I've been trying to work with this code:

    <?
    $sAuth = base64_encode("cpaneluser:cpanelpass");
    $sHTTP = "GET /frontend/x/mail/doaddpop.html?email=test&domain=mydomain.com&password=test&quota=10\r\n HTTP/1.0\r\nAuthorization: Basic $sAuth\r\n";
    $hSocket = fsockopen("mydomain.com", 2082);
    fputs($hSocket, $sHTTP);
    fclose($hSocket);
    ?>

    It worked for a few hours and then just quit working. No errors, just fails silently. Can someone help me find a solution to this?

    I haven't changed my skin, port 2082 is correct. The issue is that the authorisation part of the code is not working.

    Thanks :)
     
  10. kayb91

    kayb91 Registered

    Joined:
    Jul 1, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    In the above thread it is not pasting correctly in the Get request. After password=test& should read quota=10.

    In case this doesn't copy right either it is:

    quote equals 10 :D
     
  11. BeNE.WS

    BeNE.WS Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Belgium
    I had installed this script a couple of months ago.
    It was working fine t'ill today.

    TYODAY I changed all the themes to the X theme so that all the accounts on the server have the same theme.

    My script for the cration of emails does not work anymore since than.

    I have changed the map to my theme.
    $in = "GET /frontend/x/mail/doaddpop.html?email=....

    I have installed: WHM 8.5.4 cPanel 8.5.4-R7

    What can be wrong ?
     
  12. mbedwell

    mbedwell Member

    Joined:
    Oct 25, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1

    Here is the code I'm using currently
    <?
    if ($submit){
    $host = "www.domain.com";
    $domain = "domain.com";
    $socket = fsockopen($host,2082);

    // these lines are changed
    $cpaneluser = "myuser";
    $cpanelpass = "mypass";
    $authstr = "$cpaneluser:$cpanelpass";
    //****************************

    $pass = base64_encode($authstr);
    $in = "GET /frontend/xcontroller/mail/doaddpop.html?email=$email&domain=$domain&password=$password& quota=$quota HTTP/1.0\r\nAuthorization: Basic $pass \r\n";

    fputs($socket,$in);
    fclose( $socket );
    }
    else {
    ?>
    <form method=post>
    Username:<input type=text name=email><br>
    Password:<input type=password name=password><br>
    Quota:<input type=text name=quota>
    <input type=submit name=submit>
    <?
    }
    ?>

    inserted a space to prevent &quota from becoming "a
    WHM 8.5.1 cPanel 8.5.3-S3 on Redhat 7.3 with apache
     
  13. BeNE.WS

    BeNE.WS Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Belgium
    I have used the same script. But it is not working.

    BEFORE I changed the theme into X it WAS WORKING.

    but I don't have /fontend/xcontroller
    $in = "GET /frontend/xcontroller/mail/doaddpop.html

    I use
    $in = "GET /frontend/x/mail/doaddpop.html?email=$newuser&domain=bene.ws&password=$password&quota=25\r\nHTTP/1.0\r\nAuthorization: Basic $sAuth\r\n";



    I don't have a 'xcontroller' in my '/usr/local/cpanel/base/frontend' map


    There is x, x2 and xmail.
     
  14. mbedwell

    mbedwell Member

    Joined:
    Oct 25, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    doaddpop.html doesn't exist and the normal email add form doesn't post to it, uses <form method="POST" action="popadded.html">
     
  15. BeNE.WS

    BeNE.WS Well-Known Member

    Joined:
    May 14, 2003
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Belgium
    doaddpop.html DOES exist.

    I tried both POST & GET, still NOTHING

    Other suggestions ?

    Thanks.
     
  16. mbedwell

    mbedwell Member

    Joined:
    Oct 25, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I'm looking for suggestions to. Punched doaddpop.html into the browser and got 404'd... so I assumed. shouldn't have I guess. I'm getting nothing but silent fails as well. Wish I had more access to see how the darned thing works so I could troubleshoot instead of guessing.
     
  17. kayb91

    kayb91 Registered

    Joined:
    Jul 1, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    It seems that it works on older versions of WHM and cPanel. I'm using WHM 8.5.4 cPanel 8.5.4-E48 RedHat - WHM X v2.1.1.

    Looks like more and more people are going to have a problem with this code......

    Any suggestions?
     
  18. Nikkers

    Nikkers Member

    Joined:
    Oct 28, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
  19. webmeister

    webmeister Member

    Joined:
    Aug 5, 2002
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    has anyone seen anything happen on this lately? adding pop users is an important function of any user management toolkit...
     
  20. Nameless

    Nameless Member

    Joined:
    Feb 25, 2003
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    I have it working on my WHM 8.5.1
    Try use my script:
    #!/usr/local/bin/php

    <?
    $email = "xxx";
    $udomain = "xxxx.com";
    $upass = "yyyy";
    $quota = 1;

    $host = "zzzzz.com";
    $socket = fsockopen($host,2082);
    if(!$socket)
    {
    print('Socket error');
    exit();
    }
    $user = "qqqq";
    $password = "wwwwwww";
    $authstr = "$user:$password";
    $pass = base64_encode($authstr);
    $in1 = "GET /frontend/x/mail/doaddpop.html?email=$email&domain=$udomain&password=$upass&quota=$quota\r\n";
    $in2 = "HTTP/1.0\r\n";
    $in3 = "Host:$udomain\r\n";
    $in4 = "Authorization: Basic $pass\r\n";
    $in5 = "\r\n";

    fputs($socket,$in1);
    fputs($socket,$in2);
    fputs($socket,$in3);
    fputs($socket,$in4);
    fputs($socket,$in5);
    while (!feof($socket)) {
    echo fgets ($socket,128);
    }
    fclose( $socket );
    ?>
    i use $in[1-5] variables specially for right presentation on the forum you can append it in one line...
     
Loading...

Share This Page