jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Guys, give me an idea of using a free or open sorce software for transferring messages over a local network between computers using MAC OS and Linux platforms.
-
Thanks guys. @kick, start (begin) transaction ......commit reduced the time of execution from 57.12 sec to 0.231 using the PDO code am InnoDB engine
-
Using a standart php pdo driver taking much xecution time as well it's not a SP problem at all. There is no such a problem with performance executing the select or delete statement. <?php $username = 'lxc'; $password = 'password'; $dbh = new PDO('mysql:dbname=test;host=::1;charset=utf8', $username, $password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql= "insert into test.tmp_one (id, name,pass) values(:code,:name,:pass)"; $time_start = microtime(TRUE); $stmt = $dbh->prepare($sql); $stmt->bindParam(':code', $code, PDO::PARAM_INT, 1); $stmt->bindParam(':name', $name, PDO::PARAM_STR, 4); $stmt->bindParam(':pass', $pass, PDO::PARAM_STR, 41); $i = 1; do { $code = $i; $name = 'jazz_'.$i; $pass = sha1('password'); $stmt->execute(); $i = $i + 1; } while ($i < 1000); $stmt = null; $time_end = microtime(true); echo substr(($time_end - $time_start),0,5). " seconds"; exit; Execution time: 57.93 seconds <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); error_reporting(-1); $dbh = new PDO("firebird:dbname=127.0.0.1:/var/firebirddata/new.fdb;charset=utf8", "SYSDBA", "masterdba"); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql= "insert into tmp_one(CODE,NAME,PASS) values(:code,:name,:pass)"; $time_start = microtime(TRUE); $stmt = $dbh->prepare($sql); $stmt->bindParam(':code', $code, PDO::PARAM_INT, 1); $stmt->bindParam(':name', $name, PDO::PARAM_STR, 4); $stmt->bindParam(':pass', $pass, PDO::PARAM_STR, 41); $i = 1; do { $code = $i; $name = 'jazz_'.$i; $pass = sha1('password'); $stmt->execute(); $i = $i + 1; } while ($i < 1000); $stmt = null; $time_end = microtime(true); echo substr(($time_end - $time_start),0,5). " seconds"; exit; Execution time -> 0.603 seconds Almost 60 times less
-
Hey mac, sorry my delay and thanks for your reply So, I am aware, that previous data structure and stored procedure script were not exactly the same, but the execution time to the mysql server is too long, isn't it? I think I'm missing something by compiling the server, howerver I will check the configure log file for more details tomorrow. Here's the second test inserting only 2000 records. 1.MySQL Database Server a) TMP_ONE: DDL CREATE TABLE `tmp_one` ( `id` int(10) unsigned NOT NULL, `name` varchar(45) NOT NULL, `pass` char(41) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; b) Routine DDL CREATE DEFINER=`lxc`@`::1` PROCEDURE `insertData`(IN it INT) BEGIN declare i int default 0; myloop: while ( i < it) do insert into test.tmp_one (id, name,pass) VALUES (i+1,concat('jazz_',i+1),PASSWORD(round(rand() * 999))); set i = i+1; end while myloop; end c) mysql> call insertData(2000); Query OK, 1 row affected (1 min 55.11 sec) 2. FB Database Server a) TMP_ONE: DDL CREATE TABLE TMP_ONE ( CODE integer NOT NULL, NAME varchar(45), PASS char(41), CONSTRAINT CODE PRIMARY KEY (CODE) ); b) Routine DDL SET TERM ^ ; CREATE PROCEDURE INSERTDATA ( IT integer ) AS DECLARE VARIABLE i integer; BEGIN i = 0; while ( i < it ) do begin INSERT INTO TMP_ONE( CODE,NAME,PASS) VALUES(:i+1, 'jazz_' || :i, fb_hash(round(rand() * 999))); i = i + 1; end END^ SET TERM ; ^ c) EXECUTE PROCEDURE INSERTDATA (2000); Note: The two DB servers are deployed onto two different LXC ( linux containers ) but they share the same domain and host machine. The memory of both containers is the same, 512 MB per each. PS: No, I'm not using the internal mysql password function in production code!
-
Guys, why the following mysql stored procedure taking much more time comparing with firebird one? 1. MySQL stored procedure CREATE DEFINER=`lxc`@`::1` PROCEDURE `insertData`(IN it INT) BEGIN declare i int Default 0; declare str char(4); declare p_hash int; myloop: loop set p_hash = round(rand() * 999); set str='book'; insert into test.users (name,password) VALUES (concat(str,'_',i+1),PASSWORD(p_hash)); set i = i+1; if (i = it) then leave myloop; end if; end loop myloop; end Object info: Table: users Columns: id int(10) UN PK AI name varchar(45) password char(41) Time: mysql> call insertData(10000); Query OK, 1 row affected (9 min 38.22 sec) 2. Firebird Stored Procedure SET TERM ^ ; CREATE PROCEDURE INSERDATA ( IT integer ) --iteration number AS DECLARE VARIABLE i integer; BEGIN i = 0; while ( i < it ) do begin INSERT INTO PRODUCT( CODE,NAME,PASS) VALUES(:i, 'jazz_' || :i, fb_hash(round(rand() * 999))); i = i + 1; end END^ SET TERM ; ^ COMMIT; Object Info: Table: product columns CODE integer, NAME varchar(45), PASS CHAR(41) Time: ( for 10 000 records it takes less than 1 sec for execution) Executing statement... Statement executed (elapsed time: 0.063s). 31464 fetches, 11084 marks, 0 reads, 0 writes. 10000 inserts, 0 updates, 0 deletes, 5 index, 0 seq. Delta memory: 24264 bytes. PRODUCT: 10000 inserts. 0 rows affected directly. Total execution time: 0.151s Script execution finished. Do you see something wrong in mysql stored procedure code? jazz.
-
I think mysql dev group are using the same convention used by Unix man pages. So, about the link above posted by kicken, the options brackets ["and"] indicate that this modifier is not needed, but can be used. Also, any one from the link can be followed by a "..." which tells you that they can be used one or more times. On the other hand the compulsory curly braces {"and"} indicate that this modifier is required in the string as well as the bold italic text. So, the following sql syntax should be correct using mysql (never tested) INSERT tbl_name VALUE ('val_1','val_2',.....)
-
I've done some research on the web and found that the crypt_blowfish function using this hashing algorithm is used in php 5.3.0+. If you insist to use it probably you would need to create a patch for this older php version, which isn't a good idea. Why do you want/need to use this version of php?
-
What result do you get using the next if/else block? if (defined("CRYPT_BLOWFISH") && CRYPT_BLOWFISH){ echo "true"; } else { echo "false"; }
-
tried to install peewee on opensuse 13. 1 - failes permanently
jazzman1 replied to apollo_moon_driver's topic in Linux
I don't know how to access MySQL using Python. I am not using that language. Are you able to access mysql and its databases without using this app? -
json - how to check if this is installes on opensuse 13.1
jazzman1 replied to apollo_moon_driver's topic in Linux
What is "json" for you? -
tried to install peewee on opensuse 13. 1 - failes permanently
jazzman1 replied to apollo_moon_driver's topic in Linux
Sounds like, this account doesn't have permissions to install the app. Have you tried as root? -
Yes, it's correct! This statement should return the maximum index selectivity of any index defined on a table grouping by "replyId". Don't use the odious star "*" symbol in the selecting list. EDIT: What do you mean?
-
In the link you've posted above is used javascript/ajax/php/css/database technics. You need to create some script by yourself, then you should post your specific question(s) in the forum in case you faced problems, if you are not a programmer I recommend using Google to find some tuts on the web.
-
Here's a very good example how to manage/structure a hierarchical data in MySQL.
-
Finding extension of file that has been retrieved using CURL
jazzman1 replied to stubarny's topic in PHP Coding Help
Well, the name of the downloaded file is "download.php" with some additional get query string value as "mailbox=INBOX&passed_id=6475&startMessage=1&override_type0=text&override_type1=.........". Curl works as a web browser where the content will be retrieved/saved or displayed as an HTML data. However, to be honest with you, I still have no idea what exactly do you want to achieve. -
Finding extension of file that has been retrieved using CURL
jazzman1 replied to stubarny's topic in PHP Coding Help
You want to make а search for existing files into a remote machine/server (which doesn't belong to you)? That's impossible. -
Interesting Can you prove it? Post the script when the user is on a logged in session?
-
In the process_applicants.php file you also need to call start_secure_session() before using login_check(), otherwise you will get a notice of undefined variables, only the start_secure_session() function contains session_start() itself in your script. Even the both function are in the same file, any variable used inside a function is by default limited to the local function scope. Also, when using a php header function you need to call an exit command at the end. header('Location:http://main_function_page.htm'); exit;
-
Then, you have errors somewhere in your script when using sessions. Add the following code on the top of this file and please, use the forum's code [ code ] tags when posting code. <?php ini_set('display_startup_errors',1); ini_set('display_errors',1); ini_set('output_buffering', 0); error_reporting(-1) echo 'Content of $_FILES:<br>'; var_dump($_FILES); echo 'Content of $_POST:<br>'; var_dump($_POST); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Upload</title> </head> <body> <form method="post" enctype="multipart/form-data"> <input type="file" name="test_file"> <input type="submit"> </form> </body> </html>
-
Are you still getting this notice? Why don't you try to show us all relevant code and entire html uploading form?
-
Before looking the script into the login_check function, check first, if your login is being successful (or not) inside the login function and the both $_SESSION['user_name'] and $_SESSION['login_string'] variables are being defined. function login($user_name, $password, $mysqli) { // Using prepared statements means that SQL injection is not possible. if ($stmt = $mysqli->prepare("SELECT user_name, password, salt FROM user_profiles WHERE user_name = ? ")) { $stmt->bind_param('s', $user_name); // Bind "$user_name" to parameter. $stmt->execute(); // Execute the prepared query. $stmt->store_result(); // get variables from result. $stmt->bind_result($user_name, $database_password, $salt); $stmt->fetch(); // hash the password with the unique salt. $password = hash('sha512', $password . $salt); if ($stmt->num_rows == 1) { // Check if the password in the database matches // the password the user submitted. $short_password = substr($password,0,80); if ($database_password == $short_password) { // Password is correct! //echo "password is correct <br/>"; // Get the user-agent string of the user. $user_browser = $_SERVER ['HTTP_USER_AGENT']; // XSS protection as we might print this value $user_name = preg_replace("/[^a-zA-Z0-9_\-]+/", "", $user_name); $_SESSION['user_name'] = $user_name; $_SESSION['login_string'] = hash('sha512', $password . $user_browser); // echo "In login function user name: " . $_SESSION['user_name'] . "<br/>"; //echo "In login function login string: " . $_SESSION['login_string'] . "<br/>"; // Login successful. return true; } else { echo ("Password is incorrect!!!"); return false; } } else { // No user exists. echo "No user exists!!!"; return false; } } // end of if ($stmt = $mysqli->prepare.......) } EDIT: For debugging your database errors you need to use mysqli::$error function.
-
Any errors?
-
Double check the script of this file and make sure that this constant is difened! <?php /** * These are the database login details */ define("HOST", "localhost"); // The host you want to connect to. define("USER", "sec_user"); // The database username. define("PASSWORD", "4Fa98xkHVd2XmnfK"); // The database password. define("DATABASE", "secure_login"); // The database name. define("CAN_REGISTER", "any"); define("DEFAULT_ROLE", "member"); define("SECURE", FALSE); // FOR DEVELOPMENT ONLY!!!!
-
You've gotta be kiding, right? Is it your html upload files form? How many forms you have in your html document? echo "<form action='' method='POST' enctype='multipart/form-data'><table cellpadding='2' cellspacing='2' border='0'>"; echo "<tr><td></td><td><input class='input-file uniform_on' type='file' name='uploaded' /></td>"; echo "</table></form>";
-
Making documents only accessible to specific users?
jazzman1 replied to Kristoff1875's topic in MySQL Help
In situations where your application needs to store and share a lot of public binary files, as pics, movies, other shared data, etc.. where you expect to have multiple requests to those files and queries to your database server, I' m agree that the preffered method is to save the binary files using the server’s file system and that's considered to be the easiest and fastest way when storing files. However, you have a completely different situation here! When the data shouldn't be shared amoung people, as I said above the database application will provide you a new different level of security onto the main server-system, that means you must have an account name and password for the server administrator or for a group administrator that has the privilege to perform some actions on databases and handling those account permmisions on the files in much more easier way. Anyways.... you should get the fastest and eaysiest way for youself