Forum Sementara Putera.com

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Forum Sementara Putera.com

Bersama kita perkemaskan forum ini sementara forum asal dalam pemulihan.

Forum putera dah kembali. Masalah sudah berjaya diselesaikan. Sila lawati http://forum.putera.com/tanya


3 posters

    johnburn, setelkan code aku.. sket je lg

    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 2:47 pm

    Pm aku balik johnburn... xpn ang jawab kat sini... aku nak setelkan code aku ni.. sket je lg..
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 2:55 pm

    haha ade lak buat thread tuju kt aku je Razz
    mne codenye?
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 3:05 pm

    Code:
    <form name="fileup" method="post" enctype="multipart/form-data" action="upload3.php">                           

            <table width="80%" align="center">
                            <tbody>
                              <tr>
                                 <td><br /><br />*Username:</td>
                              </tr>
                              <tr>                                                   
                                <td><input type="text" name="username" size="30"></td>
                              </tr>                       
                              <tr>
                                 <td>*URL Name:</td>
                              </tr>
                              <tr>                                                   
                                <td><input type="text" name="urlname" size="30"></td>
                              </tr>
                              <tr>
                                 <td>*Password:</td>
                              </tr>
                              <tr>                                                     
                                <td><input type="password" name="passwd" size="30"></td>
                              </tr>
                              <tr>                           
                                <td align="right"><input type="submit" value="submit" name="submit"></td>
                              </tr>
                              <tr>
                                 <td>                             <p>&nbsp;</p>
                                 </td>
                              </tr>
                              <tr>
                                <td>&nbsp;</td>
                              </tr>
                      </tbody>
                 </table>
     
                </form>

    Code:

    <?php
    //------------- functions

    //--------------------------- connect and login to server
    function ftpconnect($host,$user,$pass)
    {
      global $conn;
      $conn=ftp_connect($host) or die("Could not connect to $host");
      //login to server
      ftp_login($conn,$user,$pass);
    }

    //--------------------------  close ftp connections
    function ftpClose($conn)
    {
      //close ftp connection
      ftp_close($conn);
    }

    //------------------------ create directory
    function ftpMkDir($conn,$dirToCreate)
    {
        @ftp_mkdir($conn,$dirToCreate); 
       
        if(file_exists($dirToCreate))
        {
          echo "<p>Sorry the folder: $dirToCreate already exists</p>\n";
        } else {
          echo "<p>Folder: $dirToCreate created</p>\n";
        }
    }

    //------------------------ set directory permissions
    function ftpFolderPermission($conn,$folderChmod)
    {
      if (ftp_chmod($conn, 0777, $folderChmod) !== false)
      {
          echo "<p>$folderChmod chmoded successfully to 0777</p>\n";
      }
    }

    //---------------------- copy file to new server
    function copyFile($conn,$remoteFile,$localFile)
    {
      if (ftp_put($conn,$remoteFile,$localFile,FTP_ASCII))
      {
          echo "<p>successfully uploaded $localFile to $remoteFile</p>\n";
      } else {
          echo "<p>There was a problem while uploading $remoteFile</p>\n";
      }
    }


    //----------- end of functions -------------------------
    ?>



    <?php
    //get the credentials from user
    $user=$_POST['username']; //change to ftp username $username =
    $pass=$_POST['passwd']; //change to ftp password
    $host=$_POST['urlname']; //change to ftp url
    //connect to server
    ftpconnect($host,$user,$pass);

    echo "<h2>Create Folders</h2>\n";
    //create directory
    ftpMkDir($conn,"boom");

    echo "<h2>Set Folder Permissions</h2>\n";
    //change folder mermissions to 0777
    ftpFolderPermission($conn,"boom");

    echo "<h2>Upload Files</h2>\n";
    //copy file to new server
    //connection then path to copy file to then path to file on this server
    copyFile($conn,"boom/aaa.html","http://www.contoh-url.com/original/aaa.html");

    echo "<h2>Upload Files</h2>\n";
    //copy file to new server
    //connection then path to copy file to then path to file on this server
    copyFile($conn,"aaa.html","http://www.contoh-url.com/original/aaa.html");

    //close ftp connection
    ftpClose($conn);
    ?>

    kat sini mmg jadi. dpt upload.. cuma.. contoh la aku masukkan username yang slah, ftp url yang slah
    org password yang salah.. kalo bleh aku nak ade message bagitau suruh masukkkan balik details..
    aku pm ang url.. ang check..
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 3:14 pm

    bkan kalau silap masuk info2 tu dia kuar Could not connect to <namahost> ke?
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 3:16 pm

    xjadi.. aku pn xtau pasal pe.. kuar line2 error.. ang try r ky url yang aku kasi tu..
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 3:18 pm

    url tu mmg pkai script ni ke?
    sat nk cek
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 3:21 pm

    yang aku pny.. code tu mmg dah cun.. cuma mslh kt situ.. act ade mslh 1 lg.. die ckp folder dah
    existed, tp pdhal blom.. tp tu xde mslh sgt sbb message je.. tu check boleh check nanti..
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 3:26 pm

    aku test code kt atas tu jd je
    kl ltk info slah mmg dia kuar error
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 3:28 pm

    johnburn wrote:aku test code kt atas tu jd je
    kl ltk info slah mmg dia kuar error

    tu aku aku kalo blh xnk ade error mcm tu.. kalo bleh bagi message suruh
    letak balik details ke mcm url contoh aku kasi tu..

    kalo contoh aku kasi tu ang tgk, ang msukkan url salah die srh letak
    detail balik.. mcm aku.. barai haha..
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 3:30 pm

    FTP connection has failed!
    Attempted to connect to ftp.contoh-url.com for user ajshdjksd

    click here to try again
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 3:35 pm

    mksd aku die mmg kuar message la
    ko tgk bhgian ni:
    Code:

    $conn=ftp_connect($host) or die("Could not connect to $host");
    kl gagal connect dia mmg kuar error Could not connet to <namahostsini>
    aku rase script ko kt link yg ko bg tu ko dh ade ubah skit dr skrip kt atas ni kot
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 3:38 pm

    yang script aku ngn yang contoh aku kasi mmg lain.. aku nyer script tu ade org tlg buat..
    tu aku nak edit sket script aku so script aku leh jalan gak mcm yang contoh aku kasik tu..

    xnk ade error line php.. nak ade msg kuar soh masukkan balik details..
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 3:41 pm

    aku kne la tgk script tu
    mne bleh nk men teka je :p
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 3:42 pm

    ang edit r scrip aku tu..

    bila ade org masukkan maklumat yang xbtol (xdpt connect ke ftp)
    tros kasi msg bgtau "Sila masukkan maklumat anda sekali lagi, click here untuk masukkan maklumat anda"
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 3:45 pm

    adoila cmne aku nk edit kl ko xbg script yg ko pkai tu
    aku kne tgk script upload3.php tu, br bleh nk edit
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 3:47 pm

    tu yang kat atas tu.. tu script aku.. hehe.. ni ha.. sm je..


    Code:
    <?php
    //------------- functions

    //--------------------------- connect and login to server
    function ftpconnect($host,$user,$pass)
    {
      global $conn;
      $conn=ftp_connect($host) or die("Could not connect to $host");
      //login to server
      ftp_login($conn,$user,$pass);
    }

    //--------------------------  close ftp connections
    function ftpClose($conn)
    {
      //close ftp connection
      ftp_close($conn);
    }

    //------------------------ create directory
    function ftpMkDir($conn,$dirToCreate)
    {
        @ftp_mkdir($conn,$dirToCreate);
     
        if(file_exists($dirToCreate))
        {
          echo "<p>Sorry the folder: $dirToCreate already exists</p>\n";
        } else {
          echo "<p>Folder: $dirToCreate created</p>\n";
        }
    }

    //------------------------ set directory permissions
    function ftpFolderPermission($conn,$folderChmod)
    {
      if (ftp_chmod($conn, 0777, $folderChmod) !== false)
      {
          echo "<p>$folderChmod chmoded successfully to 0777</p>\n";
      }
    }

    //---------------------- copy file to new server
    function copyFile($conn,$remoteFile,$localFile)
    {
      if (ftp_put($conn,$remoteFile,$localFile,FTP_ASCII))
      {
          echo "<p>successfully uploaded $localFile to $remoteFile</p>\n";
      } else {
          echo "<p>There was a problem while uploading $remoteFile</p>\n";
      }
    }


    //----------- end of functions -------------------------
    ?>



    <?php
    //get the credentials from user
    $user=$_POST['username']; //change to ftp username $username =
    $pass=$_POST['passwd']; //change to ftp password
    $host=$_POST['urlname']; //change to ftp url
    //connect to server
    ftpconnect($host,$user,$pass);

    echo "<h2>Create Folders</h2>\n";
    //create directory
    ftpMkDir($conn,"boom");

    echo "<h2>Set Folder Permissions</h2>\n";
    //change folder mermissions to 0777
    ftpFolderPermission($conn,"boom");

    echo "<h2>Upload Files</h2>\n";
    //copy file to new server
    //connection then path to copy file to then path to file on this server
    copyFile($conn,"boom/aaa.html","http://www.contoh-url.com/original/aaa.html");

    echo "<h2>Upload Files</h2>\n";
    //copy file to new server
    //connection then path to copy file to then path to file on this server
    copyFile($conn,"aaa.html","http://www.contoh-url.com/original/aaa.html");

    //close ftp connection
    ftpClose($conn);
    ?>
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 3:56 pm

    ok nt aku pos blk sini
    g mkn jap :p
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 3:59 pm

    all rise, btw ang usha skali.. ang pasan x kalo dpt upload pn.. die akan bgtau yang "File already existed"... pdhal file tu baru je create pakai code tu... kk tq2
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 5:03 pm

    try code ni
    aku rase sume dh ok kot
    kl x ok gtau blk:
    Code:

    <?php
    //------------- functions

    //--------------------------- connect and login to server
    function ftpconnect($host,$user,$pass) {
       global $conn;
       $conn=ftp_connect($host) or die('Tidak dapat membuat sambungan ke '.$host.'.<br /><a href="javascript:history.back(-1)">Kembali</a>');
       //login to server
       if (!ftp_login($conn,$user,$pass)) {
          echo 'Tidak dapat membuat sambungan ke $host.<br /><a href="javascript:history.back(-1)">Kembali</a>';
       }
    }

    //--------------------------  close ftp connections
    function ftpClose($conn) {
      //close ftp connection
       ftp_close($conn);
    }

    //------------------------ create directory
    function ftpMkDir($conn,$dirToCreate) {
       if (file_exists($dirToCreate)) {
          echo "<p>Sorry the folder: $dirToCreate already exists</p>\n";
       } else {
          @ftp_mkdir($conn,$dirToCreate);
          echo "<p>Folder: $dirToCreate created</p>\n";
       }
    }

    //------------------------ set directory permissions
    function ftpFolderPermission($conn,$folderChmod) {
       if (ftp_chmod($conn, 0777, $folderChmod) !== false) {
          echo "<p>$folderChmod chmoded successfully to 0777</p>\n";
       }
    }

    //---------------------- copy file to new server
    function copyFile($conn,$remoteFile,$localFile) {
       if (ftp_put($conn,$remoteFile,$localFile,FTP_ASCII)) {
          echo "<p>successfully uploaded $localFile to $remoteFile</p>\n";
       } else {
          echo "<p>There was a problem while uploading $remoteFile</p>\n";
       }
    }


    //----------- end of functions -------------------------


    //get the credentials from user
    $user = $_POST['username']; //change to ftp username $username =
    $pass = $_POST['passwd']; //change to ftp password
    $host = $_POST['urlname']; //change to ftp url

    if (($user == "") || ($pass == "") || ($host == "")) {
       echo "Sila isikan maklumat pada semua bahagian.";
    } else {

    //connect to server
    ftpconnect($host,$user,$pass);

    echo "<h2>Create Folders</h2>\n";
    //create directory
    ftpMkDir($conn,"boom");

    echo "<h2>Set Folder Permissions</h2>\n";
    //change folder mermissions to 0777
    ftpFolderPermission($conn,"boom");

    echo "<h2>Upload Files</h2>\n";
    //copy file to new server
    //connection then path to copy file to then path to file on this server
    copyFile($conn,"boom/aaa.html","http://www.contoh-url.com/original/aaa.html");

    echo "<h2>Upload Files</h2>\n";
    //copy file to new server
    //connection then path to copy file to then path to file on this server
    copyFile($conn,"aaa.html","http://www.contoh-url.com/original/aaa.html");

    //close ftp connection
    ftpClose($conn);
    }
    ?>
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 5:06 pm

    ok bro, metar deh...
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 5:13 pm

    ok, aku dah upload.. tp ade error.. ang try masuk dlm url aku kasik tu and test..
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 5:34 pm

    try ni plak:
    Code:

    <?php
    error_reporting(E_ALL ^ E_WARNING);
    //------------- functions

    //--------------------------- connect and login to server
    function ftpconnect($host,$user,$pass) {
       global $conn;
       $conn=ftp_connect($host) or die('Tidak dapat membuat sambungan ke '.$host.'.<br /><a href="javascript:history.back(-1)">Kembali</a>');
       //login to server
       if (!ftp_login($conn,$user,$pass)) {
          echo 'Tidak dapat membuat sambungan ke $host.<br /><a href="javascript:history.back(-1)">Kembali</a>';
       }
    }

    //--------------------------  close ftp connections
    function ftpClose($conn) {
      //close ftp connection
       ftp_close($conn);
    }

    //------------------------ create directory
    function ftpMkDir($conn,$dirToCreate) {
       if (file_exists($dirToCreate)) {
          echo "<p>Sorry the folder: $dirToCreate already exists</p>\n";
       } else {
          @ftp_mkdir($conn,$dirToCreate);
          echo "<p>Folder: $dirToCreate created</p>\n";
       }
    }

    //------------------------ set directory permissions
    function ftpFolderPermission($conn,$folderChmod) {
       if (ftp_chmod($conn, 0777, $folderChmod) !== false) {
          echo "<p>$folderChmod chmoded successfully to 0777</p>\n";
       }
    }

    //---------------------- copy file to new server
    function copyFile($conn,$remoteFile,$localFile) {
       if (ftp_put($conn,$remoteFile,$localFile,FTP_ASCII)) {
          echo "<p>successfully uploaded $localFile to $remoteFile</p>\n";
       } else {
          echo "<p>There was a problem while uploading $remoteFile</p>\n";
       }
    }


    //----------- end of functions -------------------------


    //get the credentials from user
    $user = $_POST['username']; //change to ftp username $username =
    $pass = $_POST['passwd']; //change to ftp password
    $host = $_POST['urlname']; //change to ftp url

    if (($user == "") || ($pass == "") || ($host == "")) {
       echo "Sila isikan maklumat pada semua bahagian.";
    } else {

    //connect to server
    ftpconnect($host,$user,$pass);

    echo "<h2>Create Folders</h2>\n";
    //create directory
    ftpMkDir($conn,"/boom");

    echo "<h2>Set Folder Permissions</h2>\n";
    //change folder mermissions to 0777
    ftpFolderPermission($conn,"boom");

    echo "<h2>Upload Files</h2>\n";
    //copy file to new server
    //connection then path to copy file to then path to file on this server
    copyFile($conn,"boom/aaa.html","http://www.contoh-url.com/original/aaa.html");

    echo "<h2>Upload Files</h2>\n";
    //copy file to new server
    //connection then path to copy file to then path to file on this server
    copyFile($conn,"aaa.html","http://www.contoh-url.com/original/aaa.html");

    //close ftp connection
    ftpClose($conn);
    }
    ?>
    ssh skit la gini
    kl aku dpt edit dr server ko lg senang Razz
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 5:39 pm

    Tidak dapat membuat sambungan ke $host.
    Kembali
    Create Folders

    Folder: /boom created
    Set Folder Permissions
    Upload Files

    There was a problem while uploading boom/aaa.html
    Upload Files

    There was a problem while uploading aaa.html

    Error mesage bila username dgn ftp btol.. cuma password salah..
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by johnburn Mon Sep 28, 2009 6:01 pm

    haha sbb aku xtest pn code tu
    ni aku dh test
    rasenye dh xde prob
    Code:

    <?php
    error_reporting(E_ALL ^ E_WARNING);
    //------------- functions

    //--------------------------- connect and login to server
    function ftpconnect($host,$user,$pass) {
       global $conn;
       $conn=ftp_connect($host) or die('Tidak dapat membuat sambungan ke '.$host.'.<br /><a href="javascript:history.back(-1)">Kembali</a>');
       //login to server
       if (!ftp_login($conn,$user,$pass)) {
          echo 'Tidak dapat membuat sambungan ke '.$host.'.<br /><a href="javascript:history.back(-1)">Kembali</a>';
          exit;
       }
    }

    //--------------------------  close ftp connections
    function ftpClose($conn) {
      //close ftp connection
       ftp_close($conn);
    }

    //------------------------ create directory
    function ftpMkDir($conn,$dirToCreate) {
       if (!ftp_mkdir($conn,$dirToCreate)) {
          echo "<p>Sorry the folder: $dirToCreate already exists</p>\n";
          exit;
       } else {
          echo "<p>Folder: $dirToCreate created</p>\n";
       }
    }

    //------------------------ set directory permissions
    function ftpFolderPermission($conn,$folderChmod) {
       if (ftp_chmod($conn, 0777, $folderChmod) !== false) {
          echo "<p>$folderChmod chmoded successfully to 0777</p>\n";
       }
    }

    //---------------------- copy file to new server
    function copyFile($conn,$remoteFile,$localFile) {
       if (ftp_put($conn,$remoteFile,$localFile,FTP_ASCII)) {
          echo "<p>successfully uploaded $localFile to $remoteFile</p>\n";
       } else {
          echo "<p>There was a problem while uploading $remoteFile</p>\n";
       }
    }


    //----------- end of functions -------------------------


    //get the credentials from user
    $user = $_POST['username']; //change to ftp username $username =
    $pass = $_POST['passwd']; //change to ftp password
    $host = $_POST['urlname']; //change to ftp url

    if (($user == "") || ($pass == "") || ($host == "")) {
       echo "Sila isikan maklumat pada semua bahagian.";
    } else {

    //connect to server
    ftpconnect($host,$user,$pass);

    echo "<h2>Create Folders</h2>\n";
    //create directory
    ftpMkDir($conn,"/boom");

    echo "<h2>Set Folder Permissions</h2>\n";
    //change folder mermissions to 0777
    ftpFolderPermission($conn,"boom");

    echo "<h2>Upload Files</h2>\n";
    //copy file to new server
    //connection then path to copy file to then path to file on this server
    copyFile($conn,"boom/aaa.html","boom/aaa.html");

    //close ftp connection
    ftpClose($conn);
    }
    ?>
    avatar
    yurckk
    Ahli Baharu
    Ahli Baharu


    Number of posts : 227
    Age : 40
    Location : Middle Earth
    Registration date : 17/02/2009

    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by yurckk Mon Sep 28, 2009 6:10 pm

    Ang mmg rocks la.. haha.. jadi2.. cun melecun... weyh.. ang register dlu kt situ..
    nanti aku assign.. aku perlukan kepakaran ang kt situ.. lol..

    Sponsored content


    johnburn, setelkan code aku.. sket je lg Empty Re: johnburn, setelkan code aku.. sket je lg

    Post by Sponsored content


      Current date/time is Fri Mar 29, 2024 5:21 am