jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Also, don't mixing both styles (object-oriented and procedural). Even though it's possible is not recommended for code clarity and coding style reasons.
-
Issue with readfile() and download on at least one mobile browser
jazzman1 replied to LLLLLLL's topic in PHP Coding Help
Realy? -
Then, you have a logic error(s) in your app. The only way to detect logic errors that I know is by testing your program, manually or automatically (using some debugging tools) and verifying that the output is what you expected. Many programmers (me too) are first exposed debugging process attempting to isolate a problem by adding calls to output functions as simple echo() to their code. Your script is too hard to debug like in the example above. What the value of the form action attribute is before the form being submitted? <form id="form1" name="form1" method="post" action="<?php echo $forumurl;?>">
-
Issue with readfile() and download on at least one mobile browser
jazzman1 replied to LLLLLLL's topic in PHP Coding Help
I think he makes no difference downloading a binary data through a browser and download manager in Android OS. The download manager doesn't care about the MIME type of the script. What exactly browser are you using in your phone and what the current android version is? -
Davie, do you like to eat italian spaghettii Are you able to show us the html source view of the generated php code above? Do you have php's error_reporting set to E_ALL and display_errors set to ON so that any php detected errors will be reported and displayed? Try, to set this on the top of this php page, and tell us if you're getting some notices. <?php ini_set('display_errors',1); ini_set('display_startup_errors',1); ini_set('output_buffering','Off'); error_reporting(-1);
-
Recreating An Uploaded Image to Protect It Against Virus ?
jazzman1 replied to phdphd's topic in PHP Coding Help
It's a very common area for questions, as this efficient way can have several options and methods depend on which environments the server is, assuming you are on UNIX/Linux environment. Without going into too much details, I'm going to try and give some tips use for you. 1. Use input validation to ensure the uploaded filename uses an expected extension type 2. Ensure the uploaded file is not larger than a defined maximum file size 3. Ensure the image is served with the correct content type (image/jpeg, image/png, etc..) 4. Ensure the uploaded directory has correct file/directory permissions itself. 5. Ensure the uploaded file has not executable rights. 6. Use some Apache techniques like ".htaccess" and ".htpasswd" which provides server configuration options on a per-directory basis. 7. Use image rewriting libraries in php to verify the image is valid and to strip away extraneous content. 8. Set the extension of the stored image to be a valid image extension based on the detected content type of the image. Do not just trust the header from the upload php script So, I think this could covered of the very basic of security measures and hope it has helped you. jazz. -
Errors when PHP creates MySQL stored procedure on new server
jazzman1 replied to sKunKbad's topic in Applications
Did you try to install and setup the free version of mysql workbench before to buy SQLyog? It works very well to me dealing with MySQL via SSH tunnel. -
Did you get these errors when are you using try{}catch{} block or not only? Try to rid $( document ).ready() of the try{} block. My IDE and firebug say that there is a syntax error. Try to catch <script type="text/javascript"> $(document).ready(function() { try { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover', function() { var styles = { backgroundColor: '#FF0C55' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout', function() { $('#title_buttom').css('background-color', color); }); } catch (err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } }); </script>
-
I used the script above on my local Debian/CentOS machines with version of PHP 5.4 and one shared hosting by GoDaddy using CentOS 5.3/PHP5.3.3, so everything works fine. PS: Listen, this thread is getting too large, stretchable, unreadable and unhelpful for others members in this forum. Open a new one, describe the symptoms of your problem, bugs and errors, describe the environment in which it occurs (machine, OS, application, whatever), describe carefully and clearly the things in the very beginning of your post, what, exactly you are done and want to achive and so forth. jazz.
-
Check the permissions to this working directory. I'm on CentOS and Debian linux distros.
-
Twice slower? I believe not. Take this one and test the speed, it's a part of my script //$data = array('name'=>'userName','password'=>'userPass','Submit'=>'OK'); $curl_cookie = "cookies.txt"; //$fp = fopen("example_homepage.txt", "w"); // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, 'http://hidemyass.com/proxy-list/search-225892'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, FALSE); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_COOKIEFILE, $curl_cookie); // Read cookie file curl_setopt($ch, CURLOPT_COOKIEJAR, $curl_cookie); // Write cookie file //curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // set the post data //curl_setopt($ch, CURLOPT_FILE, $fp); // write the data in external file // grab URL and pass it to the browser $output = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); //fclose($fp);
-
Hey murfy, sorry for the delay but there was a big ice storm in Toronto and GTA which left my city dealing with widespread power outages and transit problems for more than 15 hours. So, your problem is, that the post form action doesn't execute any data to the remote URL destination, even though you have a set of cookies and proper header information, right? I will try to test your script by myself, if I have the time today and I'll back with new reply if I got a success result. If it still doesn't work the easiest way is to use cURL of course
-
Did you try to set all requested header inside context header? it's mine that I've got from their domain:
-
Do var_dump(http_build_query( $options)) and post the output.
-
Errors when PHP creates MySQL stored procedure on new server
jazzman1 replied to sKunKbad's topic in Applications
To view the content of the stored procedure I'm using next sql command: SHOW CREATE PROCEDURE greeting. I don't see a button to show the content in my mysql workbench too. Inside ROUTINES table I can create/alter/drop procedures without any problems. Unfortunately, I'm not using phpMyAdmin to test it out. -
Errors when PHP creates MySQL stored procedure on new server
jazzman1 replied to sKunKbad's topic in Applications
What do you mean by saying it appears blank? Are you able to execute a CALL statement in phpMyAdmin SQL tab? CALL greeting -
Errors when PHP creates MySQL stored procedure on new server
jazzman1 replied to sKunKbad's topic in Applications
This works to me and I was able to create 2 stored procedures. Make sure you have a semicolon after END! <?php $mysqli = new mysqli("localhost", "lxc", "password", "test"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $sql = "DROP PROCEDURE IF EXISTS fake_stored_procedure; CREATE PROCEDURE `fake_stored_procedure`(x float,y float, z int) BEGIN END;"; $sql .= "CREATE PROCEDURE greeting() BEGIN select current_time() AS time; END;"; /* execute multi query */ if ($mysqli->multi_query($sql)) { do { $mysqli->next_result(); } while( $mysqli->more_results() ); } /* close connection */ $mysqli->close(); -
Look at the examples of php.net. Maybe you're doing something wrong or at least don't undestand something very well.
-
Errors when PHP creates MySQL stored procedure on new server
jazzman1 replied to sKunKbad's topic in Applications
You should use a CALL SQL statement to execute and create a stored procedure with php. I haven't see it in the script above. Check out for more details at php.net. EDIT:: found it - http://www.php.net/manual/en/mysqli.quickstart.stored-procedures.php -
Do you see the <script src="required/showAddForm.js"></script> tag when you try to open the page as a view source documment? What js debbuging tool are you using?
-
Is getting a PHP/Programming Degree Important?
jazzman1 replied to mostafatalebi's topic in Miscellaneous
I meant to prepare yourself for survivor job. -
Hey murfy, without going into too much details I wanna tell you that fopen and curl are two different tools desighed to do different tasks. For instance, cURL is a library in php for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP, POP3S, RTMP, RTSP, SCP, SFTP, SMTP and so forth protocols, a lot of these protocols are not supported by fopen at least is not very suitable to handle the data with fopen or other similar tools. On the other hand, fopen is a tool desighed to open files or URL's from remote distance, so if you have a big video file in the remote machine and want to write down on the local one you should better use fopen and fread to chunk the file into some parts writting it in the local machine. Based on your example I see, you want to grab a web page into a string, so to increase the speed a little more you could use the file_get_contents function instead of fopen or curl. It would be similar like: $context = stream_context_create(array('http' => array( 'method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => http_build_query(array('query' => '71.44.87.55')) ))); // Open the file using the HTTP headers set above $file = file_get_contents('http://www.iplocation.net/index.php', false, $context); echo $file; I am not entirly sure what, exactly you want to do here but.....it sounds you should use cURL to login into the web page and set check attributes to these checkboxes you want to be checked.