Jump to content

I AM NEW! HELP!


dezkit

Recommended Posts

checklogin.php

 

<?php
ob_start();
$host="localhost"; 
$username="dezkit";
$password="******"; 
$db_name="test"; 
$tbl_name="members"; 

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");


$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

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


$count=mysql_num_rows($result);


if($count==1){

session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}

ob_end_flush();
?>


Link to comment
https://forums.phpfreaks.com/topic/93251-i-am-new-help/#findComment-477647
Share on other sites

<?php
//Connect To Database
$hostname="h50mysql13.secureserver.net";
$username="username";
$password="password";
$dbname="database";

mysql_connect($hostname,$username, $password) OR DIE ("Unable to connect to database! Please try again later.");
mysql_select_db($dbname);

?>

 

This is my connect code - I use godaddy.com . It should be similar. Notice that localhost does not exist because mysql is on a different server than your website files...

Link to comment
https://forums.phpfreaks.com/topic/93251-i-am-new-help/#findComment-477690
Share on other sites

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.