-1

hi,
I've coded like this for login Database.
Its well working in my local host in offline.But not working Online in Plesk PHPMYADMIN MYSQL Database

with same database name, username, password as below.
and host name as mentioned in PHP server..
(provided db name, username & password are correct)

<?php
session_start();
$host="localhost"; // Host name 
$username="username"; // Mysql username 
$password="password"; // Mysql password 
$db_name="dbname"; // Database name 
$tbl_name="tablename"; // Table name 

// Connect to server & select databse.
$conn=mysql_connect("$host","$username","$password");
mysql_select_db("$db_name",$conn);

// username & password sent from form 
$mymemberid=$_POST['tbone']; 
$mypassword=$_POST['tbtwo']; 

$myencrypted=md5($mypassword);
$myconverted=hexdec($myencrypted);

$sql="SELECT * FROM $tbl_name WHERE memberid='$mymemberid' and password='$myconverted'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);// Mysql_num_row is counting table row
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){

$sql1="SELECT username FROM $tbl_name WHERE memberid='$mymemberid' and password='$myconverted'";
$result1=mysql_query($sql1);
$row1 = mysql_fetch_array($result1);
//echo $row1['username'];die();

$_SESSION['session_name']=$row1['username'];// superglogal sesion creation
$_SESSION['memberid']="$mymemberid";// superglogal sesion creation
/* echo $_SESSION['session_name'];
   echo "<br/>";
   echo $_SESSION['memberid'];die(); */

session_register("tbone");
session_register(memberid);

header("location:profile search.php");// login success
}
else {
header("location:loginfail.html");// login failure
}
?>

Edited by guruvarman: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by =OTS=G-Man
0

Any specific Errors?

also I would check the SQL host, if its a shared host, they usually don't use localhost.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.