Hola, alguien podria ayudarme con este archivo php, necesito convertir de mysql a mysqli o pdo. Gracias
==============================================================================
<?php
header("Access-Control-Allow-Origin: *");
include "db.php";
//Create New Account
if(isset($_POST['signup']))
{
$fullname=mysql_real_escape_string(htmlspecialchars(trim($_POST['fullname'])));
$email=mysql_real_escape_string(htmlspecialchars(trim($_POST['email'])));
$password=mysql_real_escape_string(htmlspecialchars(trim($_POST['password'])));
$login=mysql_num_rows(mysql_query("select * from `users` where `email`='$email'"));
if($login!=0)
{
echo false;
}
else
{
$date=date("d-m-y h:i:s");
$q=mysql_query("insert into `users` (`reg_date`,`fullname`,`username`,`email`,`password`) values ('$date','$fullname','$email','$email','$password')");
if($q)
{
echo true;
}
else
{
echo false;
}
}
echo mysql_error();
}
//Login
if(isset($_POST['login']))
{
$email=mysql_real_escape_string(htmlspecialchars(trim($_POST['email'])));
$password=mysql_real_escape_string(htmlspecialchars(trim($_POST['password'])));
$login=mysql_num_rows(mysql_query("select * from `users` where `email`='$email' and `password`='$password'"));
if($login!=0)
{ echo true; }
else{ echo false; }
}
//Change Password
if(isset($_POST['change_password']))
{
$email=mysql_real_escape_string(htmlspecialchars(trim($_POST['email'])));
$old_password=mysql_real_escape_string(htmlspecialchars(trim($_POST['old_password'])));
$new_password=mysql_real_escape_string(htmlspecialchars(trim($_POST['new_password'])));
$check=mysql_num_rows(mysql_query("select * from `users` where `email`='$email' and `password`='$old_password'"));
if($check!=0)
{
mysql_query("update `users` set `password`='$new_password' where `email`='$email'");
echo true;
}
else
{
echo false;
}
}
// Forget Password
if(isset($_POST['forget_password']))
{
$email=mysql_real_escape_string(htmlspecialchars(trim($_POST['email'])));
$q=mysql_query("select * from `users` where `email`='$email'");
$check=mysql_num_rows($q);
if($check!=0)
{
echo true;
$data=mysql_fetch_array($q);
$string="Hey,".$data['fullname'].", Tu password es".$data['password'];
mail($email, "Tu Password", $string);
}
else
{
echo false;
}
}
?>
(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)