943,547 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 5346
  • PHP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Sep 5th, 2005
0

Re: How To Create A Free Web Host

Hi Zippee,

First, thanks for all your help. Second, I was wrong about knowing how to upload files! Do you know how? I already made a form with a file field.

Thanks again.
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
Sep 5th, 2005
0

Re: How To Create A Free Web Host

Reputation Points: 10
Solved Threads: 7
Posting Whiz in Training
zippee is offline Offline
294 posts
since Jan 2005
Sep 5th, 2005
0

Re: How To Create A Free Web Host

Hi Zippee!

Thanks! I get some errors so I attached the code:
login.php:
[PHP]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CinnaHost Login</title>
</head>

<body bgcolor="#3366FF">
<img src="logo.png" width="939" height="61" />
<br />
<table width="940" height="215" border="1">
<tr>
<td width="103" height="209"><center>
<h3>CinnaHost<br />
<br />
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="20">
<param name="BGCOLOR" value="#3366FF" />
<param name="movie" value="button1.swf" />
<param name="quality" value="high" />
<embed src="button1.swf" width="100" height="20" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#3366FF" ></embed>
</object>
<br />
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="20">
<param name="BGCOLOR" value="#3366FF" />
<param name="movie" value="button4.swf" />
<param name="quality" value="high" />
<embed src="button4.swf" width="100" height="20" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#3366FF" ></embed>
</object>
<br />
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="20">
<param name="BGCOLOR" value="#3366FF" />
<param name="movie" value="button2.swf" />
<param name="quality" value="high" />
<embed src="button2.swf" width="100" height="20" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#3366FF" ></embed>
</object>
<br />
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="20">
<param name="BGCOLOR" value="#3366FF" />
<param name="movie" value="button3.swf" />
<param name="quality" value="high" />
<embed src="button3.swf" width="100" height="20" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#3366FF" ></embed>
</object>
<br />
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="20">
<param name="BGCOLOR" value="#3366FF" />
<param name="movie" value="button5.swf" />
<param name="quality" value="high" />
<embed src="button5.swf" width="100" height="20" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" bgcolor="#3366FF" ></embed>
</object>
</h3>
</center></td>
<td width="821" bgcolor="#0000FF"><center>
<h2>CinnaHost Login/Upload:</h2>
</center>
<form action="in.php" method="post" enctype="multipart/form-data">
<p><strong> <font color="#FFFFFF">Site Name:</font><br />
<input name="site" type="text" />
<br />
<br />
<font color="#FFFFFF">Password:</font><br />
<input type="password" name="password" />
</strong><strong></strong>
<strong> <br />
<br />
<font color="#FFFFFF">File To Upload:</font>
<br />
<input type="file" name="updelfile" />
<br />
<br />

<input type="submit" value="Login" />
</strong></p>
</form></td>
</tr>
</table>
</body>
</html>
[/PHP]

in.php:
[PHP]<html>
<head>
<title>CinnaHost Login</title>
</head>
<body bgcolor="#3366FF">
<center><h1><font color="#FFFFFF">Uploading...</font></h1>
<h2><font color="#FFFFFF">To Upload More Files, Click <a href="login.php"><font color="#FFFFFF">Here</font></a>.</font></h2>
</h1></center>


<?php
$filename = "../public/$_POST[site]/pswrd.pswrd";
$fp = fopen($filename,"r") or die ("Login Not Working - please try again.");
$pswrd = fgets($fp);
$attempt = "$_POST[password]";
if($pswrd == $attempt) {
echo "Login Successful!";


//START UPLOAD

$file = $_FILES["$_POST[updelfile]"];
// set the file type you will allow to avoid abuse to your server
$accept = array('pdf','doc','xls','ppt','txt','zip','jar','html','html','php','rtf','jpg','png','gif','txt','java','cpp');
if($file["size"] > 0) {
$file_name = basename($file["name"]);
$ext = substr($file_name, -3, 3);
}
// validate file
if ($file["size"] > 5000000) {
echo "Filesize over 5 mb limit.<br>\n";
}
elseif(!in_array($ext, $accept)) {
echo "Invalid file format. <br>\n";
}
else {
// set folder path to which image uploaded
$uploaddir = "../public/$_POST[site]";
//copy the file to some permanent location
if (move_uploaded_file($file['tmp_name'], $uploaddir.$file['name'])) {
echo "File has been uploaded.<br>\n";
}

//END UPLOAD


else {
echo "Error found. Please try again. <br>\n";
}
}
}
else {
echo "Login Failed - please try agin.";
}
?>

</body>
</html>[/PHP]

Thanks!
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
Sep 5th, 2005
0

Re: How To Create A Free Web Host

What errors you get?

You may want to use echo or print at each stage to find out where the errors were. I would suspect your $filename may be an error and always use $_POST['something'].
Reputation Points: 10
Solved Threads: 7
Posting Whiz in Training
zippee is offline Offline
294 posts
since Jan 2005
Sep 6th, 2005
0

Re: How To Create A Free Web Host

actually, $filename works. Here's the errors:
[PHP]
Notice: Undefined index: updelfile in c:\phpdev5\www\public\in.php on line 22

Notice: Undefined index: in c:\phpdev5\www\public\in.php on line 22

Notice: Undefined variable: ext in c:\phpdev5\www\public\in.php on line 33
Invalid file format.
[/PHP]

If you want to view the page, go to http://192.168.1.42/public/login.php You can use "cinnatech" for a site name and "pwrd" for the password. If you try to upload a file and click login, you'll see the error messages.
Reputation Points: 12
Solved Threads: 2
Posting Whiz
Ghost is offline Offline
352 posts
since Aug 2004
Sep 6th, 2005
0

Re: How To Create A Free Web Host

I can't access the site as 192 is your localhost address, not the true IP address.
I have no idea about the first two. The thrid may be because you upload files that wasn't define in the script (in my other post http://www.daniweb.com/techtalkforums/thread31803.html there is something called $accept that prevent undefined file being upload).
Reputation Points: 10
Solved Threads: 7
Posting Whiz in Training
zippee is offline Offline
294 posts
since Jan 2005
Apr 21st, 2009
0

Re: How To Create A Free Web Host

Hey zipee can you help me how to create a free webhost i need my site to create game its called Star Wars Jedi Academy.My friend from that game tell im just must go to game an create game but there is no ip adress or how to call my server so can you please help me...i wait your answer.....
Tnxy
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Speedy505 is offline Offline
1 posts
since Apr 2009
Apr 26th, 2009
0

Re: How To Create A Free Web Host

You Can Try joining http://www.myownfreehost.net
im a Member and i Can Host Unlimited Sites,
its Free {but theres also Paid Host if ya Wanna pay a Bit}


P.S There is Plenty of Features and you can have no Banners or Adds {or Add Some if you want}
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dairishguy is offline Offline
1 posts
since Apr 2009
Apr 27th, 2009
0

Re: How To Create A Free Web Host

We are talking about how to create a free webhost service , not looking for a free webhost, thanks anyway.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
foryounow is offline Offline
12 posts
since Mar 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: registaration of users scripts
Next Thread in PHP Forum Timeline: Date Conversion





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC