jazzman1
Staff Alumni-
Posts
2,713 -
Joined
-
Last visited
-
Days Won
12
Everything posted by jazzman1
-
Will I See the MySQL Error or the PHP Error?
jazzman1 replied to Fluoresce's topic in PHP Coding Help
No, I don't recommend you omitting die(), exit functions from the script. Just don't provide information about mysql error when the code on production mode is. Some databases do not return back any errors when we're dealing with it. -
@oshopindia, do you have any idea what requinix means by saying this? " *.example.com " is not a real sub-domain. It's a pattern. Don't try to create something like that.
- 11 replies
-
- mod_rewrite
- apache
-
(and 2 more)
Tagged with:
-
Pretty tricky Barand I never thought about using an array like that. My first reflection was like .josh's reply with a cron job.
-
Ports needed for LDAP connection
jazzman1 replied to TheOneAndOnlyChosenOne's topic in Apache HTTP Server
The outputs of netstat -tulpn from the both servers should be a good start for us. -
When you submit the form this form has been submitted ones! So the file has been already submitted. When you're calling this function again the first argument does not exist (no resource). The first argument should be the path to the large image not just the name of the file as expected to be. $thumbLocation = imageUpload('path_to_the_uploaded_file', $user, $isThumb = TRUE);
-
Hm....it should be work. Just forget at now about the thumbnails. Try to upload the same image twice recursively to two different directories. I don't see anything wrong in this simple test: function imageUpload($file, $user, $isThumb = FALSE) { // create thumbnail or save picture if ($isThumb) { $userDirectory = 'jazzman' . "/images/thumbs"; $max = 100; } else { $userDirectory = "jazzman" . "/images"; $max = 800; } // current directory $directory_self = str_replace ( basename ( $_SERVER ['PHP_SELF'] ), '', $_SERVER ['PHP_SELF'] ); $upload_directory = $_SERVER ['DOCUMENT_ROOT'] . $directory_self . "$userDirectory/"; var_dump($upload_directory ); echo "<br />"; var_dump($file,$user,$isThumb); if (!$isThumb) { echo "About to create thumbnail for image<br />"; //create thumbnail for image $thumbLocation = imageUpload($file, $user, $isThumb = TRUE); } } imageUpload('jazzman.jpg', 'jazz'); Output:
-
Can I see the path to $upload_directory? ............................ $saveto = "$upload_directory" . time () . ".jpg"; // here echo $upload_directory; var_dump($saveto); .......................... Also, don't understand very well what are you going to replace here -> $directory_self = str_replace ( basename ( $_SERVER ['PHP_SELF'] ), '', $_SERVER ['PHP_SELF'] ); echo $directory_self;
-
This one should be: for($i = 0; $i < $count; $i++) { to for($i = 0; $i <= $count; $i++) { just to get the last url from the array() and few errors I've made when I counted the array manually: <?php include 'curl.php'; saveFile(10, 5, $target); include 'curl.php'; saveFile(5, 0, $target);
-
Hey filoaman, so few things you have to know before to start this script. 1. What's a maximum_execution_time provided from your shared server? 2. How many cron jobs it will able to create per 1 hour? 3. Is your hosting provider provides you a php cURL library? In this example, I'm going to retreive contents from 200 pages (not a time to get into all of it) using some random target pages as you can see below. I've created an assosiative array in php with 40 keys and 5 target value inside of each key. The maximum exution time provided by my host provider is 240 sec (4min). Between every request to the remote hosting I set a sleep function time of 5 sec, with maximum range of 7 keys - 7keys x 5 values x 5sec = 175 sec it's enough. All content I put in one txt file named: page.txt, but you can separate the content according every request. Here it is. curl.php <?php include 'target_url.php'; // include target urls function getPages($url, $dest) { if(!file_exists($dest)) touch ($dest); // if the log file not exist create new one $file = fopen($dest, 'a'); // append a data to log file $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_BUFFERSIZE, (1024*1024*512)); curl_setopt($ch, CURLOPT_NOPROGRESS, FALSE); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 5); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); curl_setopt($ch, CURLOPT_FILE, $file); curl_exec($ch); // curl exec curl_close($ch); // close curl fclose($file); // close fopen } function saveFile($max, $min, $page) { $delay = 3; // 3 sec per page while ($max >= $min) { $url = implode(', ', $page[$max])."\n"; $pieces = explode(', ', $url); $count = count($pieces); for($i = 0; $i < $count; $i++) { getPages($pieces[$i], 'page.txt'); sleep($delay); } $max--; } } target_url.php // target pages $target = array( 0 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 1 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 2 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 3 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 4 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 5 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 6 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 7 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 8 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 9 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 10 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 11 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 12 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 13 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 14 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 15 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 16 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 17 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 18 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 19 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 20 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 21 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 22 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 23 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 24 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 25 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 26 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 27 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 28 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 29 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 30 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 31 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 32 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 33 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 34 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 35 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 36 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 37 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 38 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org"), 39 => array("http://linux.org/","http://phpfreaks.com","http://google.com","http://stackoverflow.com/","http://centos.org")); cron1.php <?php include 'curl.php'; saveFile(39, 34, $target); cron2.php <?php include 'curl.php'; saveFile(33, 28, $target); cron3.php <?php include 'curl.php'; saveFile(27, 22, $target); cron4.php <?php include 'curl.php'; saveFile(22, 17, $target); cron5.php <?php include 'curl.php'; saveFile(16, 11, $target); cron6.php <?php include 'curl.php'; saveFile(10, 5, $target); cron7.php <?php include 'curl.php'; saveFile(5, 0, $target); If have any questions be free to ask. The script was tested on my local server and shared. In this way I was able to send 4000 emails to my members by restriction from GoDaddy shared server of 1000 per day (24h). PS: Let the cron to execute every cronJob file by frequency of 300 sec (5 min).
-
I will try to give you an example later how to fetch a data from 600 pages by cron, curl and some sleep functions, using shared server.
-
Then, you should have to consider using cron job and sleeping between packet's transfer inside every cron jobs!
-
Where are you running the script to "thieve" this data? On a shared, dedicated or your local server?
-
@linuxfreakphp, this is a different story. Now you want to load a content with different html templates by calling myFunction(). Back again to my js code: main.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="scripts.js"></script> <title>textbox changing with ajax - php - version 1</title> </head> <body id='body'> <div id='div_textarea'></div> <input type="button" value="Click Me!" onclick="loadXML('index.php')" /> </body> </html> scripts.js var xhr = null; function loadXML(url) { if (window.XMLHttpRequest) { // Mozilla, Safari, ... xhr = new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE 8 and older xhr = new ActiveXObject("Microsoft.XMLHTTP"); } else { alert('No instance of a class that provides this functionality'); } xhr.onload = function () { document.getElementById('div_textarea').innerHTML = this.responseText; button_onload(); } xhr.open("post", url, true); xhr.send(); } function button_onload() { /* first version */ /* ------------- */ document.getElementById('button').innerHTML = 'button 1'; document.getElementById('button2').value = 'button 2'; document.getElementById('button3').value = 'clear/clean'; } /* fffff */ function button() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* fffff */ function button2() { /* show what the textarea inside text */ //alert(document.getElementById('div_textarea_text').value); document.getElementById('div_textarea_text2').value = document.getElementById('div_textarea_text').value; } /* textarea functions */ /* ------------------ */ /* fffff */ function clear_textarea1_2() { clear_div_textarea_text(); clear_div_textarea_text2(); } /* fffff */ function clear_div_textarea_text() { document.getElementById('div_textarea_text').value = ''; } /* fffff */ function clear_div_textarea_text2() { document.getElementById('div_textarea_text2').value = ''; } /* fffff */ function disabled_div_textarea_text2() { document.getElementById('div_textarea_text2').disabled = true; document.getElementById('div_textarea_text3').readOnly = true; } index.php <?php $str1 = '<br />'; $str2 = '<textarea id="div_textarea_text"></textarea>'; $str3 = '<div id="button" onclick="button();"></div>'; $str4 = '<input type="button" onclick="button2();" id="button2" value="" />'; $str5 = '<textarea id="div_textarea_text2"></textarea>'; $str6 = '<input type="button" onclick="clear_textarea1_2();" id="button3" />'; $str7 = '<textarea id="div_textarea_text3"></textarea>'; echo($str1 . $str2 . $str1 . $str3 . $str1 . $str4 . $str1 . $str5 . $str1 . $str6 . $str1 . $str7); ?> You can change the html template as an argument in loadXML('index.php');
- 17 replies
-
- html
- javascript
-
(and 1 more)
Tagged with:
-
What did you mean by saying - "it's not global". Could you be more specific where exactly are you stuck? What errors did you get and what tool are you using to debug js scripts?
- 17 replies
-
- html
- javascript
-
(and 1 more)
Tagged with:
-
There is no way to force his clients automaticaly to use GoDaddy DNS, before to have an agreement with their ISPs. They should create new records for this specific group of users using a remote server. That has benefits for both sides, less data traffic, good performance. That was before when I had a dedicated server, I think nothing changed nowadays. Anyways.....his question is different here
-
I don't know Jamie0, whether is there a possible way to check which DNS server the client use. Maybe, it's possible with javascritp to force a ping from the client browser to the remote host and then to compare this ip address to that one on your server ....but I don't really sure about that.
-
This is a selfish posting and does not help to people having the similar issue.
-
DNS technology allows you to type names into your Web browser and dns (server) try to find out the nearest target server with this domain name. So, what do you want to achieve? To get the closest facebook IP address according to GoDaddy remote server or according to the client ip address at this moment? Can you tell us the whole story?
-
I was thinking that the server return boolean false if the checkbox is not checked but actually is omitted altogether.
-
Why?
-
@Abra, what did you mean by saying - "Unchecked boxes don't get submitted". Everything which have a name and value inside a form could be submitted on the server.
-
Facebook is using "load balancing server methods". It depends how the closest server busy is they provide you different server (ip address). That's way you got a false result.
-
Give me an example how can I get this message - Unknown location.
-
You don't have to do this in that way! Hide the errors from users with error_reporting(0), redirect them and read the log from apache log error directory. I don't understand the logic here.