View Full Version : need help with php code

01-29-2012, 05:55 PM
hey guys im new to coding and im having some trouble i am trying to crate a login.php file but for some or other reason it just comes up with the code i will post code if need be any help would be much appretiated thanks in advance

01-29-2012, 05:59 PM
yep, post the code...

also post the exact name of the file you have this code in

01-29-2012, 06:04 PM

$username = $_post ['username'];
$password = $_post ['password'];
$login = $_get ['login'];

setcookie("username","$username",time ()+86400);

if($login=='yes') {

$con = mysql_connect("u627998065_login","login","");

$_get = mysql_query ("select count (id) From loginwhere user='$username'and pass='$password'");

$result = mysql_result ($get, 0);
if ($result!1){
echo "invalid login.";

else {
echo"login successful. Welcome back".$_COOKIE['username']."sir/madam";
$_SESSION ['username'] = $username;



I am using crimson editor and saved as login.php

01-29-2012, 06:08 PM
so when you open login.php you actually see this code in the browser?

01-29-2012, 06:10 PM
yea thats all i see

01-29-2012, 06:18 PM
then it's a problem with your server ... the server needs to know that a file needs to be parsed as php and not just write the contents to screen

01-29-2012, 06:28 PM
then it's a problem with your server ... the server needs to know that a file needs to be parsed as php and not just write the contents to screen

how do i do that then

01-29-2012, 06:29 PM
who owns the server?

is it a hosting company or you have setup a server yourself locally?

01-29-2012, 06:33 PM
its a free web hoster address is IAS3.com using phpmyadmin

01-29-2012, 06:38 PM
so you can login to phpmyadmin? if so then the server can display php...

are you 100%+ sure that the file name is login.php? not login.html?

01-29-2012, 06:39 PM
yea it says login file type .php

01-29-2012, 06:40 PM
is there a way to upload a screenshot for you to see

01-29-2012, 06:41 PM
if you are ok with it paste the link to your website here and i'll have a look... it sounds pretty weird..

01-29-2012, 06:47 PM
its not letting my open my url it is currently running off my system drives any ideas

01-29-2012, 06:49 PM
its saying that it is active url should be www.space-warsz.com

01-29-2012, 07:15 PM
so you are trying to open it on your local computer?

coz i went to that url and it doesn't exist

01-30-2012, 12:52 AM
one question i have made a server for testing but where am i supposed to save my php files to use mysql data base

01-30-2012, 01:53 AM
sorry mate.. you need to ask google... how to setup a server and get it running is more than i can help with.. sorry..

01-30-2012, 10:53 AM
hey guys go it sorted now thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum