Jump to content

Displays The Code In The Browser


Kev0121

Recommended Posts

Well basically it displays the code in the browser insted of like doing what its ment to do if that makes sense?

 

Im using wamp and VS and php editor

 

 

<?php
$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'website';

$c = @mysql_connect('$host', '$user', '$pass')
	or die("Error Connecting To Host." . mysql_error());

@mysql_select_db('$db')
	or die("Error Connecting To Database." . mysql_error());

if(isset($_POST['username'])) {

if(!$_POST['username'] || !$_POST['password']) {
	die (' Please make sure you fill out all of the required fields. ');
}

$user = mysql_real_escape_string($_POST['username']);
$user = stripslashes($user);
$pass = mysql_real_escape_string($_POST['password']);
$pass = sha1($pass);

if(strlen($user) < 4) {
	die (ucwords(' Please make sure that the username is 4 or more characters. '));
}

if(strlen($pass) < 4) {
	die (ucwords(' Please make sure that the password is 4 or more characters. '));
}

$check = "SELECT * FROM `users` WHERE `username` = '$user'";
$sql = mysql_query($check);
$row = mysql_num_rows($sql);

if($row >= 4) {
	die (' Sorry but the username '.$user.' is already in use. ');
}

$ins = "INSERT INTO `users` (username, password) VALUES ('$user', '$pass')";
$q = mysql_query($ins);

}

?>

Link to comment
https://forums.phpfreaks.com/topic/136742-displays-the-code-in-the-browser/
Share on other sites

Does any php code work on your server? What is the file name the code is in? What is the URL you are entering in your browser?

 

Does it does work on my server, it works when i use phpDes and im entering the location of it, its called index.php also im using VS.PHP 2.5

Archived

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

×
×
  • Create New...

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.