Jump to content

willfitch

Members
  • Posts

    109
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.willfitch.com

Profile Information

  • Gender
    Not Telling
  • Location
    New Hope, PA

willfitch's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Looking at the warning, PHP is looking for your script in: C:/php_projects/myproject/controller/registering/register_2.php You need to update your include statement to reference the root directory of your project - not the disk. define('root', 'C:/xampp/htdocs/php_projects/myproject/'); Also, it's good convention to make your constants uppercase.
  2. Hey All, I am having issues getting the MySQLi extension to connect to a SSL enabled MySQL server. As soon as I specify the MYSQLI_CLIENT_SSL flag on the real_connect, it hangs forever. The connection is being made. If I issue a SHOW PROCESSLIST on the MySQL server, I can see the user attempting to authenticate, but it never goes beyond that. Neither one of these work: <?php // Instantiate object $mysqli = new mysqli( ); //Call the init method to allow setting of options $mysqli->init( ); $host = 'hostname.tld'; $username = 'ssluser'; $password = 'password'; $dbname = 'db'; $port = 3309; $socket = null; // Set a new config file, disallow LOAD LOCAL INFILE and set the timeout to 600 seconds $mysqli->options(MYSQLI_READ_DEFAULT_FILE, '/home/user/ssl/mynew.cnf'); $mysqli->options(MYSQLI_OPT_LOCAL_INFILE, false); $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 600); // Connect with the above options, as well as SSL if (!$mysqli->real_connect($host,$username,$password,$dbname,$port,$socket,MYSQLI_CLIENT_SSL)) { $mysqli->close(); exit(); } or <?php /* create a connection object which is not connected */ $mysqli = new mysqli(); $mysqli->init(); $mysqli->ssl_set("/home/user/ssl/client-key.pem","/home/user/ssl/client-cert.pem","/home/user/ssl/ca-cert.pem","/home/user/ssl",null); /* set connection options */ $mysqli->options(MYSQLI_INIT_COMMAND, "SET AUTOCOMMIT=0"); $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5); /* connect to server */ $mysqli->real_connect('host.tld', 'ssluser', 'password','db',3309,null,MYSQLI_CLIENT_SSL); /* Select queries return a resultset */ $mysqli->close(); ?> I can successfully connect to this same server using the mysql client with the same server that the PHP script is running on. I know the issue is not hostname resolution or certificate related. Any help would be appreciated.
  3. Place an "or die(mysql_error())" after your update statement
  4. The mysql_error should go outside of your mysql_query() function. $result = mysql_query("sql statement") or die(mysql_error()); Also, make sure you have the correct connection credentials
  5. http://www.php.net/manual/en/ This is everying you'll need to know.
  6. What error are you getting back? Try using mysql_error()
  7. Is there any reason you are attempting to use persistant connections? 
  8. SET PASSWORD FOR 'pmausr'@'localhost'=password('whateveryouwanthere');
  9. Here is an example of opening the temp directory and reading all sessions: [code=php:0] <?php $session_dir = '../Tmp'; $handle = opendir($session_dir); while (($file = readdir($handle)) != false) { if (ereg("^sess", $file)) {   $fhandle = file($session_dir.'/'.$file);   printf("<pre>%s</pre>",print_r($fhandle[0],1)); } } ?> [/code] Also, I think you mean unlink(). 
  10. The values for $dbname, $dbhost, $dbuser, and $dbpassword aren't defined.  Remember, you are using a function, so it's expecting those variables to either be provided through the parameter, or local scope. If these variables exist outside of the function, use the keyword "global" and import them into your local scope.
  11. You absolutely can access the tmp file.  Accessing the tmp file can be done through this: $_FILES['file_name']['tmp_file'] This is the actual temporary file name assigned by PHP. Check out the documentation here: http://us3.php.net/manual/en/features.file-upload.php
  12. Stop reinventing the wheel! There are tons of built in XML extensions: DOM, SimpleXML, etc.
  13. keeB, Any reason you don't like MySQLi?  I see you are using abstract classes, so PHP5 is your version.  I'm sure if you're running PHP5 and have MySQL extensions, MySQLi is very likely available. Unless you are currently using persistant connections, I would look into the MySQLi extension. Also, the danger of using an abstract class for your DB mechanism is that you can't instantiate it.  It must be extended.
  14. session_start() goes at the VERY beginning: <?php session_start(); ?> <html> ....
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.