Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once('connection.php');
- $con = getConnection();
- $sql = "SELECT CONN, USER, PWD FROM USUARIO WHERE EMAIL = ?";
- $stmt = $con->prepare($sql);
- $stmt->bindValue(1, $_SESSION['email']);
- $stmt->execute();
- while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
- {
- $dsnUser = $row["CONN"];
- $userUser = $row["USER"];
- $pwdUser = $row["PWD"];
- }
- function getConnectionUsr(){
- try {
- $conn = new PDO("'".$dsnUser."'", $userUser, $pwdUser);
- return $conn;
- }
- catch(PDOException $Exception) {
- echo $Exception->getMessage();
- return null;
- }
- }
- function closeConnectionUsr() {
- return null;
- }
- ?>
- <?php
- require_once("connUser.php");
- $con = getConnectionUsr();
- if (isset($_REQUEST['cod-sql']))
- {
- $codAplly = $_REQUEST["cod-sql"];
- $sql = $codAplly;
- $stmt = $con->prepare($sql);
- try {
- $stmt->execute();
- header ("location: ../../criacao.php");
- }
- catch(PDOException $e)
- {
- echo "Deu ruim!!";
- }
- finally
- {
- $con = closeConnectionUsr();
- }
- }
- else{
- echo ">:(";
- }
- ?>
- invalid data source name
- Fatal error: Call to a member function prepare() on null
Add Comment
Please, Sign In to add comment