3 posters
johnburn, setelkan code aku.. sket je lg
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
Pm aku balik johnburn... xpn ang jawab kat sini... aku nak setelkan code aku ni.. sket je lg..
johnburn- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
haha ade lak buat thread tuju kt aku je
mne codenye?
mne codenye?
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
- 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> </p>
</td>
</tr>
<tr>
<td> </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- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
bkan kalau silap masuk info2 tu dia kuar Could not connect to <namahost> ke?
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
xjadi.. aku pn xtau pasal pe.. kuar line2 error.. ang try r ky url yang aku kasi tu..
johnburn- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
url tu mmg pkai script ni ke?
sat nk cek
sat nk cek
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
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..
existed, tp pdhal blom.. tp tu xde mslh sgt sbb message je.. tu check boleh check nanti..
johnburn- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
aku test code kt atas tu jd je
kl ltk info slah mmg dia kuar error
kl ltk info slah mmg dia kuar error
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
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..
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
FTP connection has failed!
Attempted to connect to ftp.contoh-url.com for user ajshdjksd
click here to try again
Attempted to connect to ftp.contoh-url.com for user ajshdjksd
click here to try again
johnburn- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
mksd aku die mmg kuar message la
ko tgk bhgian ni:
aku rase script ko kt link yg ko bg tu ko dh ade ubah skit dr skrip kt atas ni kot
ko tgk bhgian ni:
- Code:
$conn=ftp_connect($host) or die("Could not connect to $host");
aku rase script ko kt link yg ko bg tu ko dh ade ubah skit dr skrip kt atas ni kot
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
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..
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- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
aku kne la tgk script tu
mne bleh nk men teka je :p
mne bleh nk men teka je :p
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
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"
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- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
adoila cmne aku nk edit kl ko xbg script yg ko pkai tu
aku kne tgk script upload3.php tu, br bleh nk edit
aku kne tgk script upload3.php tu, br bleh nk edit
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
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- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
ok nt aku pos blk sini
g mkn jap :p
g mkn jap :p
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
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- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
try code ni
aku rase sume dh ok kot
kl x ok gtau blk:
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);
}
?>
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
ok bro, metar deh...
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
ok, aku dah upload.. tp ade error.. ang try masuk dlm url aku kasik tu and test..
johnburn- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
try ni plak:
kl aku dpt edit dr server ko lg senang
- 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);
}
?>
kl aku dpt edit dr server ko lg senang
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
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- Moderators
- Gender : Male Number of posts : 755
Location : Terengganu
Registration date : 07/03/2009
haha sbb aku xtest pn code tu
ni aku dh test
rasenye dh xde prob
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);
}
?>
yurckk- Ahli Baharu
- Number of posts : 227
Age : 40
Location : Middle Earth
Registration date : 17/02/2009
Ang mmg rocks la.. haha.. jadi2.. cun melecun... weyh.. ang register dlu kt situ..
nanti aku assign.. aku perlukan kepakaran ang kt situ.. lol..
nanti aku assign.. aku perlukan kepakaran ang kt situ.. lol..