Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8368901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:30:09+00:00 2026-06-09T13:30:09+00:00

try{ $pdo = new PDO(mysql:host=localhost;dbname=name, ‘user’, ‘pass’); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $statement = SELECT id FROM

  • 0
        try{
            $pdo = new PDO("mysql:host=localhost;dbname=name", 'user', 'pass');
            $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
            $statement = "SELECT id FROM users WHERE email LIKE ?";
            $stmt = $pdo->prepare($statement);
            $stmt->bindParam(1, htmlspecialchars($this->params['email']), PDO::PARAM_STR);
            $stmt->setFetchMode(PDO::FETCH_ASSOC);
            $row = $stmt->fetch();

        }catch (PDOException $e) {
            echo $e;
        }

        print_r($row[0]['id']);

        if(is_int($row[0]) > 0) {
            throw new Exception();
        } elseif(is_int($row[0]) > 0) {
            //Generating encryption
            $crypt = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, '');
            $iv = mcrypt_create_iv(32, MCRYPT_RAND);
            $key = mcrypt_create_iv(32, MCRYPT_RAND);
            $password = mcrypt_create_iv(12, MCRYPT_RAND);
            mcrypt_generic_init($crypt, $key, $iv);
            $crypted = mcrypt_generic($crypt, $password);


            $activation = mcrypt_create_iv(128, MCRYPT_RAND);

            mcrypt_generic_deinit($crypt);




            try{
                $pdo = new PDO("mysql:host=localhost;dbname=name", 'user', 'pass');
                $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                $statement = "INSERT INTO users(name, password, cryptokey, cryptovector, email, activation_code, active, usertype) values(?, ?, ?, ?, ?, ?, 0, ?); ";
                $stmt = $pdo->prepare($statement);
                $stmt->bindParam(1, mysql_real_escape_string($this->params['name']), PDO::PARAM_STR);
                $stmt->bindParam(2, $password, PDO::PARAM_STR);
                $stmt->bindParam(3, $key, PDO::PARAM_STR);
                $stmt->bindParam(4, $iv, PDO::PARAM_STR);
                $stmt->bindParam(5, mysql_real_escape_string($this->params['email']), PDO::PARAM_STR);
                $stmt->bindParam(6, $activation, PDO::PARAM_STR);
                $stmt->bindParam(7, mysql_real_escape_string($this->params['acctype']), PDO::PARAM_STR);

                $stmt = null;

            }catch (PDOException $e) {
                print_r($e);
            }


            $smarty = new Smarty();

            $smarty->assign('NAMES',$this->params['name']);
            $smarty->assign('UNIT', $this->params['acctype']);
            $smarty->assign('KEYPASS',$password);
            $smarty->assign('NAMES',$this->params['name']);
            $smarty->assign('ACTIVATION_LINK','https://localhost/profile.php?action=activate&key='.urlencode($activation).'&email='.urlencode($this->params['email']));

            $msgBody = $smarty->fetch('templates/default/mail.html');

            try {
                $mail = new PHPMailer();

                $mail->Host = "server";
                $mail->SMTPAuth = TRUE;
                $mail->Host = "server";
                $mail->Port = 25;
                $mail->Username = "email";
                $mail->Password = "password";

                $mail->AddAddress($this->params['email']);
                $mail->SetFrom('test@example', 'test Services');

                $mail->Subject = 'Confirm registration and login credentials.';
                $mail->MsgHTML($msgBody);    // attachment
                #$mail->Send();

                echo 'localhost/profile.php?action=verify&key='.base64_encode($activation).'&email='.urlencode($this->params['email']);
            } catch (phpmailerException $e) {
                #echo $e; //Pretty error messages from PHPMailer
                print_r($e);
            } catch (Exception $e) {
                echo $e; //Boring error messages from anything else!
                print_r($e);
            }


        }

    }

So this is my method for authentication. __construct($arg1, $arg2); $arg1 gets the action and $arg2 and it is the $self::params gets the variables that it requires in this case the email names and password. It prints the the activation link for testing purposes and when it does i see Array( ) after it. The if statement that has isset($row) is not doing what it have cuz it is telling my script that row is set. And when I print_r it I see none… when echo i see Array( )…. I Use Zend server CE With PHP 5.4 and I have a table that is structured like this:

id, – name, – password, – cryptokey, – cryptovector, – email, – activation_code, – active, – usertype
1, – J.Smith, – pwd, – key, – vector, – some@mail, – activation code, – 0, – candidate

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:30:11+00:00Added an answer on June 9, 2026 at 1:30 pm

    You are missing the $stmt->execute(); in your code. This is an example of code that I happen to have in eclipse right now:

    $sql="select id from users where userName=:userName";
    $this->prepared = $this->mysqlAccess->con->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
    $this->prepared->execute(array(':userName' => $this->username));
    

    When you prepare the statement, you need to execute it before you can query the results.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php try { $db = new PDO(mysql:host=localhost;dbname=DBNAME, USER, PASSWD); $stmt = $db->prepare(SELECT id, name
try { $dbh = new PDO('mysql:host=localhost;dbname=wqposts', 'root', ''); $query = SELECT wqpid FROM threads
<?php require 'dbinfo.php'; try { $db = new PDO($dsn, $username, $password); $db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION
I'm trying to run this simple query: try { $dsn = mysql:host=localhost;dbname:mydb; $PDO =
I'm using this code and I'm beyond frustration: try { $dbh = new PDO('mysql:dbname='
try to set host in dsn of pdo like this: <?php /* Connect to
I'm new to PHP and PDO, and I try to use prepared statements here.
Using PDO::setAttribute , how do I provide the class name when setting PDO::ATTR_DEFAULT_FETCH_MODE to
I'm kinda new to PDO with MYSQL, here are my two files: I have
I have the following code : <?php try { # MySQL with PDO_MYSQL $DBH

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.