ToonMariner
Members-
Posts
3,342 -
Joined
-
Last visited
Everything posted by ToonMariner
-
you MUST sanitize any data you collect from a user. If this is particular to one user check and see what is unique about that user - it could be something stored in the session like a character that causes the problem... Memory allocation problems are often caused by recursive execution of code - it could be that this one users is experiencing this - maybe an include is cycling by calling a page that is already been called. if possible switch and require/include to require_once or include once. You could get the users details and test locally - debugging script by inserting various echo statements and exit(); to stop execution at strategic points (not the best way to debug but if you don't have any other tool available and don't want xdebug then it could be good for you - I learn't a fair bit debugging this way in the early days ) good luck and keep posting back any updates.
-
[SOLVED] How can I insert an md5 into database?
ToonMariner replied to forumnz's topic in PHP Coding Help
you don't need to generate that in php MD5(RAND()+RAND()+RAND()) will work fine in a query.... -
[SOLVED] How can I insert an md5 into database?
ToonMariner replied to forumnz's topic in PHP Coding Help
<?php mysql_query("INSERT INTO chart_of_accs (hash_key, acc_hash, type, code, name, description, tax, show_exp_claims, sys_locked) VALUES ('$demo_hash', MD5(RAND() + RAND() + RAND()), 'r_r', '200', 'Sales', 'Income', 'gst_n', '1', '0')"); ?> -
http://uk.php.net/manual/en/function.session-set-cookie-params.php if you set the $domain part then .site.com should allow use across sub-domains also...
-
@daniel0 - wasn't having a beef mate! agreed on the contextual (lack of) info etc etc. but one last point... the request for the current password should prevent anyone happening across an unattended account from changing it
-
li should NOT be wrapped in a div! li should be the drect descendant of the ul... don't make the mistake of adding more html than you need... http://tinyurl.com/deh3o4
-
Application logging really helps out when you are bug fixing a live site. start recording browser info as Aexia suggests. You could also cache the pages being served out to this user - opening them up in your own browser to see if you can replicate (you should perhaps use some VM ware to truly replicate their environment). In this case as only one user has an issue just log based on their userid... Post back if you need tips on what to log.
-
@Daniel0 this operation doesn't require such an inefficient check - indeed if its so high risk the single query option is better as it does NOT give any feedback on why something error. You initial login check should be sufficiently robust to negate any such requirement.
-
still don't see you using tmp_name yet... have you read the documentation on super globals?
-
use jquery...
-
PHP MySQL statements WHERE name OR section LIKE %this%
ToonMariner replied to scrubbicus's topic in PHP Coding Help
SELECT * FROM table WHERE lecture LIKE '%man%' OR book LIKE '%man%' -
yes you can do this all in one query... <?php $dbhost = "localhost"; //change this to your DB host $dbuser = "User"; //change this to your DB username $dbpass = "pass"; //change this to your DB password $dbname = "logon"; //change this to your DB name for your account info mysql_connect($dbhost, $dbuser, $dbpass); mysql_select_db($dbname); if (isset($_POST['Submit'])) { $user = mysql_real_escape_string($_POST['user']); $pass = mysql_real_escape_string($_POST['pass']); $newpass = mysql_real_escape_string($_POST['newpass']); $newpass2 = mysql_real_escape_string($_POST['newpass2']); $errors = array(); if(empty($user) || empty($pass) || empty($newpass) || empty($newpass2)) { $errors[] = "Please fill in all required fields"; } if(strlen($newpass < 5) { $errors[] = "Your new password must be longer than 5 characters"; } if(strlen($newpass > 20) { $errors[] = "Your new password must be shorter than 20 characters"; } if(strcmp($newpass,$newpass2) != 0) { $errors[] = "Your new passwords do not match"; } if (count($errors) == 0) { $qry = "UPDATE accounts SET password = '{$newpass}' WHERE username = '{$username}' and password = '{$pass}'"; $res = mysql_query($qry); if (!$res || mysql_affected_rows($res) != 1) { echo "Unable to complete request"; } else { echo "Password changed successfully"; } } else { foreach($errors as $key => $val) { echo $val; } } } ?> there is no need to run a query to check if the users credentials are ok - they should need to be logged in anyway so your session should be 'proof' of that. you will need to smrten up the error output for notices on password length etc etc but that is trivial.
-
have you looked at the $_FILES array? it has a 'tmp_name' index... so $_FILES['upfile']['tmp_name'] should return what you need (substitue upfile for what ever you used as your file input element name in your form...
-
you need mencoder / ffmpeg on your server and the ability for php to call it from the command line...
-
settimeout could call the same function if there are characters left in the string...
-
http://www.twinhelix.com/css/iepngfix/ javascript free methhod (has a few issues but on the whole very good).
-
why are you storing that in a database? the overhead with storing files in a database is pretty big so rarely I'd do anything like that. if its a case of storing the file securely maybe look at storing it behind the site root and forcing download rather than displaying in browser...
-
Make the script run in background after triggering it..
ToonMariner replied to siddscool19's topic in PHP Coding Help
you need to fork your script - you will need to have access to call scripts from theh command line... here's the place to get started. http://uk3.php.net/manual/en/function.exec.php[/ur] -
Parse a US street address into its individual parts?
ToonMariner replied to fr34k's topic in PHP Coding Help
without writing the code for you you will need perform such operations on the string as: explode(), preg_match(), list() and that kind of thing... -
encapsulation... methods and properties of your class belong to that class - anything declared outside must be passed in... <?php require_once 'database.php'; class User { var $user; var $pass; private function User($db) { $this->db = $db; } function select_a() { $sql = "SELECT * FROM users"; $res = $this->db->query($sql); } } $user = new User($db); ?> if you have php 5 available then you could use __construct() - it wold also be beneficial to make the database object a singleton class that way you won't have lots of instances of he 'same thing'...
-
your aint set up to run php - either its not installed or your server is not configured correctly.
-
[SOLVED] Image button submit...tried hidden field...etc.
ToonMariner replied to mo's topic in PHP Coding Help
use print_r($_POST) to check what the button sends (after you have set type="image") - some browsers pass different values...