I'm using the Markdown library for PHP by Michel Fortin. I started noticing that it formats the text in tags with markdown rules, like so:
http://foo.com/My_Url_With_Underscores
essentially becomes:
<a href="...">http://foo.com/My<em>Url</em>With_Underscores</a>
How do I disable that behavior or otherwise prevent the library from doing that?
Hi,
I am trying to develop a PHP class which would enable me to get the query string appended into a url and process it according to the variables passed. How can this be done?
Eg
www.example.com?var1=a&var2=b&var3=c
now I want to get '?var1=a&var2=b&var3=c' section and process it based on the variables.
Thanks
I have an array called $times. It is a list of small numbers (15,14,11,9,3,2). These will be user submitted and are supposed to be minutes. As PHP time works on seconds, I would like to multiply each element of my array by 60.
I've been playing around with array_walk and array_map but I can't get those working :S
Thanks.
I have written a web app in PHP which makes use of Ajax requests (made using YUI.util.Connect.asyncRequest).
Most of the time, this works fine. The request is sent with an X-Requested-With value of XMLHttpRequest. My PHP controller code uses apache_request_headers() to check whether an incoming request is Ajax or not and all works well.
But not always. Intermittently, I'm getting a situation where the Ajax request is sent (and Firebug confirms for me that the headers on the request include an X-Requested-With of XMLHttpRequest) but apache_request_headers() is not returning that header in its list.
The output from when I var_dump the apache_request_headers() is as follows (note the lack of X-
'Host' => string 'peterh.labs.example.com' (length=26)
'User-Agent' => string 'Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.3) Gecko/2008101315 Ubuntu/8.10 (intrepid) Firefox/3.0.3' (length=105)
'Accept' => string 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' (length=63)
'Accept-Language' => string 'en-gb,en;q=0.5' (length=14)
'Accept-Encoding' => string 'gzip,deflate' (length=12)
'Accept-Charset' => string 'ISO-8859-1,utf-8;q=0.7,*;q=0.7' (length=30)
'Keep-Alive' => string '300' (length=3)
'Connection' => string 'keep-alive' (length=10)
'Referer' => string 'http://peterh.labs.example.com/qmail/' (length=40)
'Cookie' => string 'WORKFLOW_SESSION=55f9aff2051746851de453c1f776ad10745354f6' (length=57)
'Pragma' => string 'no-cache' (length=8)
'Cache-Control' => string 'no-cache' (length=8)
But Firebug tells me:
Request Headers:
Host peterh.labs.example.com
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0.3) Gecko/2008101315 Ubuntu/8.10 (intrepid) Firefox/3.0.3
Accept text/html,application/xhtml+xml,application/xml;q=0.9,**;q=0.8
Accept-Language en-gb,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 300
Connection keep-alive
X-Requested-With XMLHttpRequest
Referer http://peterh.labs.example.com/qmail/
Cookie WORKFLOW_SESSION=55f9aff2051746851de453c1f776ad10745354f6
This mismatch is (apparently) intermittent when executing the same code. But I don't believe in "intermittent" when it comes to software! Help!
I want to be able to get the size of a file before uploading it to a PHP script using FileReference.
Can I get the file size before detecting bytesTotal during the upload process?
I have the following code.
$connect = new Connection ();
$response = $connect->putFile($fileName, $destination);
header("Location: /test.php?response=" . $response);
When I invoke header with the response, the file will stop execution, but I will have no error in the console... I am thinking maybe this array needs to be encoded for the url?
if that is the case how?
Thank you
Hi..
I need to use include Function with variable.
but,when I try to do it I faced some errors .
Code :
$year=$_POST['year'];
$month=$_POST['month'];
$day=$_POST['day'];
include "Event.php?year=".$year."&month=".$month."&day=".$day;
so,can U help me ? : )
How can create simple PHP Search Engine Submission tool, which allows that to submit the site URL to multiple search engines such as "http://www.google.com/addurl?q=www.yoursite.com&hl=&dqq=" and also "http://www.bing.com/webmaster/SubmitSitePage.aspx" or any other other search engines?
What do you guys do (system/framework wise) to safeguard things like
1) employees writing malicious code to destroy your server
2) employees reading all your database sensitive information
3) generally programmers that have access to your back-end and potential damages that they can do.
Is there any PHP scripts that guards against these, etc.?
How can i encrypt a function or its contents in a php class ?
e.g. Take a look at below class, i would like to encrypt the function test1() so the code inside will never be revealed but executes as normal
class test
{
var $x;
var $y;
function test1()
{
return $this->x;
}
function test2()
{
return $this->y;
}
}
Thanks in advance
I have a pretty complicated index.php now, and I would like to only run it once every hour. What is the best way to achieve this? Some ideas I've had
Put it in APC with apc_store($page, 60*60*) - I feel this isn't what APC is for and will probably be doing something bad to the other parts of my site
Save the output to a filesystem somewhere - Then apache needs write access somewhere which might be a pain
Somehow setup apache to do the caching for me - Is this possible?
Has anyone here tried it or is it possible?
I've been using PHP for quite a few years but never know exactly the underlying c scripts.
Is there a way to go into it?
How to prepare Cyrilic and other variables for storing into MySql DB? (PHP)
So I need realy simple way to prepare recived from browser $_GET[string] variables for storing into DB.
How to do such thing?
Hi everybody,
Having some trouble sending properly formatted HTML e-mail from a PHP script. I am running PHP 5.3.0 and Apache 2.2.11 on Windows XP Professional.
The output looks like this:
Agent Summary for Support on Tuesday April 20 2010=20
Ext. Name Time Volume
137 Agent Name 01:27:25 1
138 =09 00:00:00 0
139 =09 00:00:00 0
You see the =20 and =09 in there? If you look at the HTML you also see = signs being turned into =3D. I figure this is a character encoding issue as I read the following at Wikipedia:
ISO-8859-1 and Windows-1252 confusion
It is very common to mislabel text data with the charset label ISO-8859-1, even though the data is really Windows-1252 encoded. In Windows-1252, codes between 0x80 and 0x9F are used for letters and punctuation, whereas they are control codes in ISO-8859-1. Many web browsers and e-mail clients will interpret ISO-8859-1 control codes as Windows-1252 characters in order to accommodate such mislabeling but it is not standard behaviour and care should be taken to avoid generating these characters in ISO-8859-1 labeled content.
This looks like the problem but I don't know how to fix. My code looks like this:
ob_start();
report_queue_summary($yesterday,$yesterday,$first_extension,$last_extension,$queue);
$body_report = ob_get_contents();
ob_end_clean();
$body_footer = "This is an automatically generated e-mail.";
$message = new Mail_mime();
$html = $body_header.$body_report.$body_footer;
$message->setHTMLBody($html);
$body = $message->get();
$extraheaders = array("From"=>"***redacted***","To"=>$recipient, "Subject"=>"Agent Summary for $yesterday [$queue]", "Content-type"=>"text/html; charset=iso-8859-1");
$headers = $message->headers($extraheaders);
# setup e-mail;
$host = "*********";
$port = "26";
$username = "*****";
$password = "*****";
# Send e-mail
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($recipient, $extraheaders, $body);
if (PEAR::isError($mail)) {
echo("" . $mail->getMessage() . "");
} else {
echo("Message successfully sent!");
}
Is the problem that I'm using output buffering?
Just a curious question but is there any programs that can help/aid you when you write PHP codes? Say there is an error in your code and using this program it would help you locate it, etc.
I might be thinking too much...
Hello
I have a table : tags(tagname,entryid,stamp) and i want to make a section for the most trending tags today, the tagname column has no unique value, because many entries has the same tag, so the php code that i want should display the most attached tags today.
Note: the "stamp" column is the date of adding the tag in UNIX time stamp format.
Thanks
When C# app is ran, it POSTS a request to the PHP server, which wants to return an array. What's an easy way to load this array's contents into C# for using with there.
I develop websites using PHP and MySQL. What resources would a seasoned web developer recommend that would cover server-specific information relevant to the job of a developer.
If it helps, I work specifically with an Apache server (through my hosting company).