Search the Community
Showing results for tags 'connection'.
-
Hello guys, I do not know if anyone work or have worked with the "elFinder (file manager)" .. I incorporate "elFinder" to my platform .. I have the following question .. Have its connector: <?php error_reporting(0); // Set E_ALL for debuging include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderConnector.class.php'; include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinder.class.php'; include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeDriver.class.php'; include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeLocalFileSystem.class.php'; // Required for MySQL storage connector include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeMySQL.class.php'; // Required for FTP connector support include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'elFinderVolumeFTP.class.php'; /** * Simple function to demonstrate how to control file access using "accessControl" callback. * This method will disable accessing files/folders starting from '.' (dot) * * @param string $attr attribute name (read|write|locked|hidden) * @param string $path file path relative to volume root directory started with directory separator * @return bool|null **/ function access($attr, $path, $data, $volume) { return strpos(basename($path), '.') === 0 // if file/folder begins with '.' (dot) ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true : null; // else elFinder decide it itself } $opts = array( // 'debug' => true, 'roots' => array( array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => '/home/', // path to files (REQUIRED) 'URL' => dirname($_SERVER['PHP_SELF']) . '/home/', // URL to files (REQUIRED) 'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL) ) ) ); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run(); I want him to make the call the "$screen" (folder will be created automatically by the user) of each user .. and not the "/home/" (as an example of put) .. the "$screen" comes from my platform, and I add the "elFinder" to it .. Imagine that each user creates "1/2/3 or 4, etc .." folders .. The user then enters the "elFinder" and see the folder created "1/2/3 or 4" (created on the left side of the folders ) and want only see your folders him. My Example.. It gives me error when I try to use these functions .. I use these functions for the "$screen" .. Of course, that I try connect only the folder .. but the result was 0 .. //za screen imeto function clean($string) { $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens. $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one. } //end $srvname = mysql_real_escape_string(trim($_POST['servername'])); //ime na servera $port = (int)$_POST['ports']; //port na servera $ip = mysql_real_escape_string(trim($_POST['serverip'])); //serverip $screen = clean($srvname).$port.'_'.uniqid(); //screen imeto $dir = "/home/"; $opts = array( // 'debug' => true, 'roots' => array( array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => '$dir/$screen', // path to files (REQUIRED) 'URL' => dirname($_SERVER['PHP_SELF']) . '$dir/$screen', // URL to files (REQUIRED) 'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL) ) ) ); This example of more folders.. $opts = array( 'roots' => array( array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => 'path/to/files/first_root', // path to files (REQUIRED) 'URL' => 'http://localhost/files/first_root/', // URL to files (REQUIRED) 'alias' => 'First home', // The name to replace your actual path name. (OPTIONAL) 'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL) ), array( 'driver' => 'LocalFileSystem', 'path' => 'path/to/files/second_root', 'URL' => 'http://localhost/files/second_root/', 'alias' => 'Second home' ) ) ); But I need to be automatic, for each creation of user.. I use the variable "$screen" to create automatic folder of user.. but how to call the database of $screen ? the $screen exist only on my platform.. I don't know if you understand me.. Regards, Joob
-
hi I'm create a form and I connect it by database and when I submit the data the data is inserted correctly in the table ,but it's show me some wrings this is HTML code <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <legend> <form action="cccccccccc.php" method="post"> <label>user name <input type="text" name="uname"> </label> <label>pasword <input type="password"name="pass"> </label> <input type="submit"> </form> </legend> </body> </html> and this is php code <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php mysql_connect("localhost","root","")or die (mysql_error()); mysql_select_db("abubakerdb") or die (mysql_error()); $user=$_POST['uname']; $pass=$_POST['pass']; $query = mysql_query("insert into user_name (name , password)values('$user','$pass')")or die (mysql_error()); if($query) { echo $user ."is added"; } ?> </body> </html>
-
Hi I am fairly new to using PHP and am struggling connecting the MYSQL database to PHP. It will work but when i enter dummy data into the form it won't update within the database. I have already got someone to look over the PHP and they have just given me hints and tips of which I have followed to improve the PHP. I just want to be able that when I type in a users data it displays within the MySQL database. If someone could help me ASAP that would be great. Thanks dtferguson Registration.zip
- 3 replies
-
- php
- registration
-
(and 2 more)
Tagged with:
-
Hi PHPFreaks =), I'm in need of some guidance. Is it possible and safe to open a SOAP Connection every 10-15 minutes? Thanks, Hal
- 11 replies
-
- soap
- connection
-
(and 1 more)
Tagged with:
-
Hi Everyone, Apologies for the basic question, but since I can't see where I am going wrong, I probably won't get far reading the FAQ's. I've been using a section of code just to see whether I can connect up to my MySQL database, and after the last part of the statement I keep getting the text appearing on the relevant web page as if it were a comment. I've changed some of the details of the connection for security reasons, but this is essentially what I have got on the web page. Everything after the "Connected" text gets written onto the page, rather than displaying the database results. I tinkered a bit with the tags around "Connected", whose line originally had a semicolon at the end, but regardless of what I do at the end of this line I still get text. Any suggestions? Thanks. <body> <?php mysql_connect("localhost", "curem5801_pogopat", "chickenkievs427","curem8019_languages") or die('Unable to connect to MySQL'); echo <h1>Connected</h1> $result = mysqli_query($link, 'SELECT * FROM Rebus34_tbl'); while($row = mysqli_fetch_assoc($result)){ echo $row['curem5801_pogopat']; } ?> </body>
- 20 replies
-
Hi guys, Im new to coding, learning fast! I have built a simple social networking website and im trying to implement a chat system on my site.. im using this resource. http://old.ajaxim.com/ Im following the database connection and i get this error.. Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user'@'localhost' (using password: YES) in /home/guyrich/public_html/AJAX IM/install.php on line 135 Here is the code for the connection file. <? /////////////////////////////////// // ajax im 3.41 // // AJAX Instant Messenger // // Copyright © 2006-2008 // // http://www.ajaxim.com/ // // Do not remove this notice // /////////////////////////////////// // MySQL Database Configuration $sql_user = 'user'; $sql_pass = ''; $sql_host = 'localhost'; $sql_db = 'ajaxim'; // This is the prefix for the ajax im MySQL tables -- this can usually be left alone. // (If upgrading from a version < 3.1, set the prefix to '') define('SQL_PREFIX', 'ajaxim_'); $maxBuddyIconSize = 100; // in KBs, set to 0 to disable uploads ?> This may seem like a lame question, but how do i configure this to connect to my database :/ Cheers Guy
-
I have multiple scripts referring to one another and it is getting a little confusing with database calls. I stumbled upon the singleton method, and I am trying to use it to create a Database class that will make sure there is only one connection at a time. This is what I have: class Database{ //Store the single instance of Database private static $m_pInstance; private function __construct(){ $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $db); if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } } public static function getInstance() { if(!self::$m_pInstance) { self::$m_pInstance = new Database(); } return self::$m_pInstance; } } My connection definitions are stored in a cfg.php file which is required by this script. For the most part I understand how this works, but not well enough to understand why it isn't working. Here is the reference to this database: $mysqli = Database::getInstance(); Can someone help me figure out what I am doing wrong? The connection fails when I run it. It works when I put the above reference into a comment and simply connect with this: $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $db); if ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); } Thanks.
- 3 replies
-
- mysqli
- connection
-
(and 1 more)
Tagged with:
-
Is it possible to make two consecutive calls to a MYSQL DB in one trip to the server? Tables are powered by MYISAM (because fatcow doesn't support InnoDB). PHP 5.3. MYSQL 5.0.91 In case you need more information, my site is broken down into header, footer, main content, and side bar, and they are all separate PHP docs. The main content is made up of a few different pages, one of which is called depending on the user's selections. One of the content pages is a catalog. The script accesses the database and loads the current available inventory. When a user adds item to the cart, the whole page reloads (starting with a DB call to load the catalog) and then populates the cart summary in the sidebar, constituting the second DB call for that single trip to the server. Will the second call potentially be attempted when the table is still locked? I ask because I am experiencing connection failures. Please let me know if you need more information. Thank you in advance for your consideration.