Levis
March 28, 2017, 8:08pm
#1
When I try to connect I get this error:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /storage/h10/802/1164802/public_html/login.php:14 Stack trace: #0 /storage/h10/802/1164802/public_html/mainlogin.php(2): include() #1 {main} thrown in /storage/h10/802/1164802/public_html/login.php on line 14
Here is the code I have on line 14:
$connection = mysql_connect(“localhost”, “id1164802_testuser”, “testpass”);
Hello Good day i also have the same proble i cant connect i change my php version to the lowest which is 5.2 (ayaw parin tagalog language)
ProxySQL Error: Access denied for user ‘id157972_root’@‘2a02:4780:bad:f00d::7’ (using password: YES)
here is my full code:
<?php
//Start session
session_start();
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
//Connect to mysql server
$conn = mysql_connect("localhost", "id157972_root","id157972_sales","pass123") or die(mysql_error());
mysql_select_db("id157972_sales", $conn);
if(!$conn) {
die('Failed to connect to server: ' . mysql_error());
}
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$login = clean($_POST['username']);
$password = clean($_POST['password']);
//Input Validations
if($login == '') {
$errmsg_arr[] = 'Username missing';
$errflag = true;
}
if($password == '') {
$errmsg_arr[] = 'Password missing';
$errflag = true;
}
//If there are input validations, redirect back to the login form
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: index.php");
exit();
}
//Create query
$qry="SELECT * FROM user WHERE username='$login' AND password='$password'";
$result=mysql_query($qry);
//Check whether the query was successful or not
if($result) {
if(mysql_num_rows($result) > 0) {
//Login Successful
session_regenerate_id();
$member = mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID'] = $member['id'];
$_SESSION['SESS_FIRST_NAME'] = $member['name'];
$_SESSION['SESS_LAST_NAME'] = $member['position'];
//$_SESSION['SESS_PRO_PIC'] = $member['profImage'];
session_write_close();
header("location: main/index.php");
exit();
}else {
//Login failed
header("location: index.php");
exit();
}
}else {
die("Query failed");
}
?>
@Levis Is your issue solved??
@malunaoreymart Is your solved??