Jump to content


This topic is now archived and is closed to further replies.


Uploading & Viewing PHP Site

Recommended Posts

I have decided that its about time I got up to speed with PHP.

I'm using my PlusNet account for hosting and for the MySQL database (which I created using phpmyadmin)

I am trying to create a v.simple login site just to get used to working with the code etc..

I have created a database: dewbie_pn

I have created a table: members

In this table I have: Id, username, password. I have put in 3 users details.


Now, my problem is getting these pages on the net so they work!!

I've tried uploading them to my usual ftp.plus.net account, whenever I try to open main_login.php it askes if I want to save the file to disc instead of opening the page.

I tried uploading it to my cshell.plus.net and ccgi.plus.net parts of my web space, and for this I just get an error message (You don't have permission to access / on this server.)

Now this is really nooby of me, but what am I doing wrong?!


Here is a list of the code for the 3 pages.

(this is a login page where the 3 users I have created login with their usernam and password)

[code]<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<form name="form1" method="post" action="checklogin.php">
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<td colspan="3"><strong>Member Login </strong></td>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
<td><input name="mypassword" type="text" id="mypassword"></td>
<td><input type="submit" name="Submit" value="Login"></td>

This goes to this page..

(checks the login details against the database)

$host="humbug"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="dewbie_pn"; // Database name
$tbl_name="members"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";

// Mysql_num_row is counting table row
// If result matched $myusername and $mypassword, table row must be 1 row

// Register $myusername, $mypassword and redirect to file "login_success.php"
else {
echo "Wrong Username or Password";

If it matches, it goes to this final page...

(displays a page saying "Successfuly Logged In"

[code]// Check if session is not registered , redirect back to main page.
// Put this code in first line of web page.

Login Successful

Share this post

Link to post
Share on other sites
If its asking you if you want to download the files then its either in the wrong location or your host doesn't support php.

Surely your host provides instructions on where to upload php files too?

Share this post

Link to post
Share on other sites
Update on my problem...

PlusNet told me that I do need to put it on my ccgi.plus.net space, so I did, then I realised it wasn't workign as I had put it in the cgi bin folder, I moved it from there into the main directory and got this error message:

[img src=\"http://img506.imageshack.us/img506/5639/php39um.jpg\" border=\"0\" alt=\"IPB Image\" /]

I then tried loading it onto the KK space, just to see if it worked, and it did! However, I have problems with this bit if anyone can help me... also ideas why it isnt working on my plusnet space when it does on KK's, even though PlusNet claim that their ccgi supports PHP.. maybe they dont have PHP installed on my ccgi space?!

This is the bit of code that is wrong, I need to know what to put in for $host as it doesnt seem to like ccgi.plus.net ot humbug..

[b][!--coloro:red--][span style=\"color:red\"][!--/coloro--]$host="humbug"; // Host name[!--colorc--][/span][!--/colorc--][/b]
$username="dewbie"; // Mysql username
$password="2fbe8e1fefb41176"; // Mysql password
$db_name="dewbie_pn"; // Database name
$tbl_name="members"; // Table name

Share this post

Link to post
Share on other sites
99.999% of the time the host should be 'localhost'

$host="localhost"; // Host name

put it in just like that.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.