...

View Full Version : need help with php code



Henning12342
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

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

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

Henning12342
01-29-2012, 06:04 PM
<?php


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

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

if($login=='yes') {

$con = mysql_connect("u627998065_login","login","");
mysql_select_db(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

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

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

jmj001
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

Henning12342
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

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

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

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

jmj001
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?

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

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

jmj001
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..

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

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

jmj001
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

Henning12342
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

jmj001
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..

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum