roopurt18
Staff Alumni-
Posts
3,746 -
Joined
-
Last visited
Never
About roopurt18
- Birthday 03/11/1980
Contact Methods
-
Website URL
http://www.rbredlau.com
Profile Information
-
Gender
Male
-
Location
California, southern
roopurt18's Achievements
Advanced Member (4/5)
0
Reputation
-
Are you sure that's the relevant JavaScript? I don't see any exclamation marks in your code.
-
What command can I use in linux to create a new mysql database.
roopurt18 replied to ghurty's topic in MySQL Help
If you want to access the database as someone other than root, don't forget to use GRANT afterwards! -
How to increase PHP Eclipse Font Size?
roopurt18 replied to theITvideos's topic in Editor Help (PhpStorm, VS Code, etc)
Don't use the PHP node. There is a node labeled "default" or similar; use that one. -
You shouldn't be using FTP for anything since everything is sent in clear text. You're better off setting up a correct development environment so that you can edit locally and only deploy when the application is ready for production. If you *must* edit files remotely, then use SFTP if you can. If SFTP is not available then you should set up an SSH tunnel and FTP to the port you create on your local machine. I develop using NuSpherePhpEd Professional.
-
This requires jQuery. The CSS class to make. .hidden { display: none !important; } The HTML code to embed. <div class="hidden" id="busy_container"> <img alt="Busy" src="/images/working.gif" id="busy_img"> </div> The JavaScript to make the screen busy. /** * Make the screen look busy. * * @param flag bool True makes page look busy, false makes page look ready. * @param target string Node ID of element to mask out * @param target string Node ID of element to center image over */ function busy( flag, target, center ) { var top, left, width, height, position, busy_container, busy_img; // get the busy_container and busy_img busy_container = $('#busy_container'); busy_img = $('#busy_img'); if( flag === true ) { // Turn target id into jquery object target = $('#' + target); // Turn center id into jquery object center = $('#' + center); // Need the target's position position = target.position(); // top and left of target will go here top = position.top + 1; left = position.left + 1; // target will be this high and wide width = target.innerWidth(); height = target.innerHeight(); // busy_container.css( 'position', 'absolute' ); busy_container.css( 'background-color', '#eaeaea' ); busy_container.css( 'opacity', '0.5' ); busy_container.css( 'top', top + 'px' ); busy_container.css( 'left', left + 'px' ); busy_container.css( 'width', width + 'px' ); busy_container.css( 'height', height + 'px' ); // busy_img.css( 'position', 'absolute' ); busy_img.css( 'top', Math.floor((center.innerHeight() - busy_img.height()) / 2) + 'px' ); busy_img.css( 'left', Math.floor((center.innerWidth() - busy_img.width()) / 2) + 'px' ); // busy_container.removeClass( 'hidden' ); } else if( flag === false ) { busy_container.addClass( 'hidden' ); } }; Let's assume you have a form with id frm_add_user. In the onsubmit() handler you might add this code: busy( true, 'frm_add_user', 'frm_add_user' ); When the XHR request finishes you will call this: busy( false ); Let's assume you have a form with id frm_login inside a larger container div with id container. When the form is submitted you want to make the entire container busy but center the busy image over the form. You will call: busy( true, 'container', 'frm_login' ); When the XHR request finishes you call the same thing: busy( false ); I wrote this as a one-off for my current project. It may require tweaking to work in yours!
-
I'm not authority on music files so I'm not much help. Although I can reiterate what you probably already know: ffmpeg seems to be the solution here. As far as generating a list of errors, here is what I usually do: <?php function validate() { // pretend were in a class-instance context... $errors = array(); if( $this->someCondition() === false ) { $errors[ 'someCOndition' ] = 'Some condition was not met.'; } if( $this->someConditionB() === false ) { $errors[ 'someCOnditionB' ] = 'Some conditionB was not met.'; } // etc... $this->_errors = $errors; $n = count( $errors ); if( $n > 0 ) { throw new Exception_CustomErrorException(); // The constructor to custom exception may not require arguments. } return true; } ?> And would be called like: <?php try { $out = '<p>Save successful!</p>'; $foo = new MyObject(); $foo->save(); // assume save() calls validate(); } catch( Exception_CustomErrorException() ) { $out = '<p>Errors Encountered:</p><ul><li>' . implode( '</li><li>', $foo->errors() ) . '</li></ul>'; } ?> It doesn't quite look like that in practice but that's the quick and dirty of it.
-
... ini_set('upload_max_filesize', number_format( (self::MAX_SIZE / 1048576), 2) . 'M'); ... <input type="hidden" name="MAX_FILE_SIZE" value="3670016" /> The value declared in the class is not used as the value in the form; therefore you allow the possibility of changing one and forgetting the other. Also, if I'm remembering correctly, you can not set the maximum upload file size via ini_set() because the PHP script will not execute until after the upload has been finished. if ( !in_array($this->_files[$i]['type'], $this->_allowedTypes[$this->_type]) ) Your private member $this->_files is really just the global $_FILES array, which is fine. But the point I want to make is that $_FILES['name']['type'] is set by upload agent (i.e. web browser) and can be faked or spoofed. This could allow an attacker to create their own upload agent that uploads a script and tells you that it's an image. In this way they could add their own executable code to your server! The correct way to validate uploaded file types is to pass them through functions that work on those file types. For example, if you are allowing images to be uploaded, try to open them with the built-in image functions. If the functions fail then the files are not images. Googling should provide some examples of this type of validation. As for your initial question about errors via exceptions, just change lines like this: return 'Files could not be uploaded, ' . $this->_uploadDir . ' is not a valid directory.'; To: throw new Exception( 'Files could not be uploaded, ' . $this->_uploadDir . ' is not a valid directory.' ); And then surround your class's use inside of try...catch blocks. You could go as far as creating your own exceptions for every possible type of error you expect in your class: class Exception_NotAnUploadDirection extends Exception { } class Exception_NotAnAcceptableUploadFileType extends Exception {} (I'd recommend using better names than I came up with; I'm in a hurry!)
-
Do you have the ability to log into the web server and use a console? If so you should just switch to the web server's user id and group and try to make the directories as a permissions test. Otherwise I suggest you make a tiny PHP script called t.php and play with the mkdir and chmod functions until you get something that works the way you'd like.
-
Which version of Apache and mod_rewrite are you using? I've set something up similar and it works. Here is my .htaccess: RewriteEngine on RewriteRule ^([^/\.]+)/?$ /Test/foo/index.php?uk=$1 [L] Do you have more stuff in your .htaccess file? Or is it only those two lines? You might also try stopping and restarting your web server. You might also try turning on the mod_rewrite logging to see what it's doing.
-
If this worked before and it doesn't work now that means your PHP host went backwards in PHP versions, which is unlikely. What exactly did they change? Be very, very specific.
-
Not all byte sequences are valid in UTF-8. A common convention by programs reading supposedly UTF-8 data is to convert such sequences to question marks. Perhaps that is occurring in your case.
-
Where on Earth did you get that crazy idea?
-
Sometimes third party hosts will allow you to specify your own php.ini file with custom settings. You could try and set it via .htaccess as you've originally requested with: php_value upload_max_filesize 16M
-
If the alarm is as simple as an e-mail notification then PHP would be fine. If however you're wanting to create task bar notifications or windows on the screen it won't be as simple.
-
I downvote Alienware on the basis their desktops are overpriced.