-
Posts
1,437 -
Joined
-
Last visited
Never
Posts posted by papaface
-
-
Yeah. Just add something like:
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT,12); curl_setopt($ch, CURLOPT_TIMEOUT,; curl_exec($ch); if (curl_errno($ch) == false) { //no error } else { //error }
-
Hello,
I have a script which is used to get a file off a remote server however the transfer is taking place an an EXTREMELY slow rate.
Does anyone have any idea what could be causing this?
$this->ch = curl_init($url); $parts = parse_url($url); curl_setopt($this->ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($this->ch,CURLOPT_FOLLOWLOCATION,1); $header = array("Host: {$parts['host']}","Accept: text/xml,application/xml,application/xhtml+xml,text/html,;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5", "Accept-Language: en-us,en;q=0.5", "Connection: keep-alive", "User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.4) Gecko/20070625 Ubuntu/7.10 (gutsy) Firefox/3.0.0.7", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Keep-Alive: 300"); curl_setopt($this->ch, CURLOPT_HTTPHEADER, $header);
-
array_walk($t, '$this0>converttolower');
should be
array_walk($t, $this->converttolower);
I think
-
Thats not code. Its commented out of the PHP code so php doesn't process it.
-
$file_dir = "photos/originals/".$user."_".$user_id."_".$file_count.".jpg";
-
-
Your cURL commands use $tweet not $twitter.
-
& is a way of separating vars in the query.
Try
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=".htmlentities($tweet));
-
I can't see session_start(); in America1.php even though you say you have it in the pages...
-
$connection
is not defined anywhere.
-
I don't see any code there that actually logs the user out, or am I missing something.
Try adding
$_SESSION = array();
to your code.
-
remove $find = htmlentities($find);
-
If you used google in the first instance you would have saved everyones time...$i = 10; if ( $i&1 ) { echo "$i is odd"; } else { echo "$i is even"; }
Nice.
http://newsourcemedia.com/blog/php-how-to-find-odd-and-even-numbers/
Thanks for the help.
-
$i = 10; if ( $i&1 ) { echo "$i is odd"; } else { echo "$i is even"; }
-
Probably a better way to do this, but just do:
$count = mysql_query("SELECT `request_tel` FROM `request` WHERE `request_tel`='".$_POST['request_tel']."' "); if (mysql_num_rows($count) <= 3) { $Query = mysql_query('INSERT INTO `request` ( `request_year`, `request_month`, `request_day`, `request_date`, `request_ip`, `request_tel`, `request_txt`, `request_artist`, `request_title`, `request_datetime`, `request_ipp` ) VALUES ( "'.$_POST['request_year'].'", "'.$_POST['request_month'].'", "'.$_POST['request_day'].'", "'.$_POST['request_year'].$_POST['request_month'].$_POST['request_day'].'", "'.$_POST['request_ip'].'", "'.$_POST['request_tel'].'", "'.$NoPregText.'", "'.$_POST['request_artist'].'", "'.$_POST['request_title'].'", "'.date('Y-m-d H:i:s').'", "'.getenv('REMOTE_ADDR').'" )'); if ($Query) { //inserted correctly } else { //issue inserting } } else { //3 or more with the same tel in db }
-
Try google. There are thousands and thousands of tutorials on this basic stuff tbh.
-
function theLooper($vars) { if (is_array($vars)) { foreach ($vars as $k => $v) { //do something } } else { echo "not an array of values"; } } theLooper(array("Name" => "Andrew","Age" => "20"));
Do you mean like that?
-
<?php $url = parse_url("http://sub.site.com"); $explode = explode(".", $url['host']); echo "Sub = " . $explode[0] . "<br />"; echo "Site = " . $explode[1] . "<br />"; echo "TLD = " . $explode[2] . "<br />"; ?>
-
You could try:
$_FILES = array(); $_POST = array();
But for a fool proof way, I think you may have to generate a value in a hidden field which is unique. When someone uploads something have that value inserted into the database IF its not already in the table. If it is then it is a duplicate (i.e the person refreshed the page) and have the script exit or produce an error.
-
<?php echo round((1230000/1000000),2).' million'; echo "<br />"; echo round((1000000000/1000000000),2).' billion'; ?>
-
Code should be:
<?php $payment = "3.50"; $ref = $_COOKIE['ref']; mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line "); mysql_select_db($database); //cant see the $database var defined anywhere.... $monthlydue = mysql_query("select `monthlydue` from `affiliates` where `memid`= '".$ref."'"); while ($row = mysql_fetch_array($monthlydue)) { mysql_query("UPDATE `affiliates` SET `monthlydue` ='".$row['monthlydue'] + $payment."' WHERE `memid` ='".$ref."'"); } ?>
You may also be able to do this:
<?php $payment = "3.50"; $ref = $_COOKIE['ref']; mysql_connect($server, $db_user, $db_pass) or die ("Database CONNECT Error (line "); mysql_select_db($database); //cant see the $database var defined anywhere.... mysql_query("UPDATE `affiliates` SET `monthlydue` = '`monthlydue`+".$payment."' WHERE `memid` ='".$ref."'"); ?>
-
The OP is referring to this
http://www.phpfreaks.com/forums/index.php/topic,252975.0.html
Don't post duplicate threads.
-
Ignore that message I posted is what I mean.
-
Ignore.
Get my syntax right
in PHP Coding Help
Posted
Replace all " with ' and replace all ' with " ?
Simple.