$str = "& &svnips  ∴ ≈ osidnviosd & sopinsdo";
$regex = "/&[^\w;]/";
echo preg_replace($regex, "&", $str);
I'm trying to replace all un-encoded ampersands with encoded ones.
The problem is it's removing the space between & and sopinsdo.
Any idea why?
...
Hello, I have a contact form in my website. I made a class to handle the whole process.
But there is something not working in it.
I have 2 functions to check for exploitation and they are not working. I don't know what's wrong with them, so here they are :
private function _validateExploit($val) {
$exploitPattrens = array('conten...
Hi There,
I've used PHPMailer on several projects but now I'm stuck. It gives me the error:
SMTP Error: Could not connect to SMTP host.
I've tried sending email from Thunderbird and it works ! But not through PHPMailer ... Here are the settings from Thunderbird:
Server name: mail.exampleserver.com
Port: 587
Username: user@exampleser...
I have some simple XML which I would like to parse into an array in PHP so that I can build some dynamic SQL inserts.
Sample XML:
<Data>
<Key>1</Key>
<Column>Value 1</Column>
<Column2>Value 2</Column>
</Data>
Data will be passed to PHP via http POST.
What's the easiest way to do this? There should always be one instance ...
hey,
i want to check via php if a page is a cms_page in Magento. I need diffrent breadcrumbs for cms pages, so im trying to this with a condition, but i have no idea how to or where to look at.
Heres my breadcrumbs.phtml so far.
<?php if(this is a cms page): ?>
<p>some content</p>
<?php else: ?>
<?php if($crumbs && is_array($crumbs)): ...
Any PHP functions that deal with JPEGs don't seem to be working on my server.
This code:
<?php
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
header('Content-type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
creates an e...
Hi.
I'm having some problem with my SQL syntax/escaping variables on my LAMP server.
The command I want to use is the following:
$sql=mysql_query("INSERT INTO '$table' (FirstName, LastName, StartDate, TimeStroke, DueDate, Duration, Price, Retailer, Checksum)
VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[startdate]','$_POST[tim...
Hi, as I wrote a small PHP framework with a DSL parser, and I'm not satisfied with the result, is there any tool like Treetop for PHP? It would lead to far better (and nicer) results.
...
Hello,
I'm currently trying to improve my PHP by moving towards an MVC framework architecture. I've looked around a lot and have decided to go with the Zend Framework.
However all the tutorials I can find talk about version 1.8, the problem is I can only find version 1.1 on the Zend Framework site.
I'm probably missing some key concep...
How to authenticate to remote site via HTTP and then submit one more form, accessible only for authenticated user?
What I'm trying to achieve:
Login to Mantis bug tracker: http://www.mantisbt.org/demo/login_page.php
Submit new issue: http://www.mantisbt.org/mantis/bug_report_page.php
Logout: http://www.mantisbt.org/mantis/logout_page....
Is it possible to assign users individual permissions based on dynamic elements in a Zend Framework application?
I have tables like so:
clients (id, name, contact_name, contact_number, logo, active)
modules (id, client_id, module_id, active)
permissions (id, user_id, client_id, module_id)
users (id, username, password, email, realname)...
I got "Warning: mysql_query(): 10 is not a valid MySQL-Link resource" referring to a line in my PHP script where I executed a query using "mysql_query($query, $link_identifier)"
...
Can't seem to get it right with the syntax:
<?php
if isset $_POST['tutorial'] {
header('Location: /phonebooks?tutorial=1b');
} else {
header('Location: /phonebooks?phonebook_created=1');
};
?>
What am I doing wrong??
...
Hello,
I have an array
$hourly = array(
"01" => "0",
"02" => "0",
"03" => "0",
"04" => "0",
"05" => "0",
"06" => "0",
"07" => "0",
"08" => "0",
"09" => "0",
"10" => "0",
"11" => "0",
"12" => "0",
"13" => "0",
"14" => "0",
...
I am trying to write a simple Javascript snippet into a Codeigniter link. I am using the link to delete posts where required in my dashboard. I dont know anything about JS although am trying to learn it.
Code
$js = 'onClick = "alert("Are you sure")"';
$this->table->set_heading('Date', 'Title', 'Delete', 'Update');
foreach($records ...
Hey StackOverflow, I'm a new member but still hoping someone might be able to help if they can!
I'm using dompdf to generate PDFs in PHP. All is well when it parses a standard <a href="...">[Link]</a> style link: the generated PDF contains clickable hyperlinks.
However, my source text (i.e. the content of the PDF) contains anchor tags ...
I have a product info table with more than 130 columns/fields.
I want to write a php script that adds a new product to the table OR updates the existing product if it already exist. The first field is the product key.
The product information is stored in a numbered php array : $product_info[0] to $product_info[130].
Basically somethin...
I was reading an article about form security becuase I have a form which a user can add messages.
I read that it was best to use strip_tags(), htmlspecialchars() and nl2br()
Somewhere else said to use html_entity_decode()
I have this code in my page which takes the user input
<?php
$topicmessage = check_input($_POST['message']);...
hello - just trying to add some setting for the admin in a database entry.
i've saved;
array('aviva'=>'aviva','teacher'=>'teacher');
into the field 'fullPara' but can't seem to get it back into an array? Just spits it out as a string and i've tried eval but not sure where to go from here?
echo $userTypes['fullPara']; // spits out a...
I believe this would be a more CPU friendly method, can it be implemented with php ?, instead of gzipping content for every request, I compress the files once and serve those instead =).
...