Hi!
I have a problem that I haven't seen before. The same regex is producing two different results on two different servers.
This is the code:
preg_replace('#[^\pL0-9_@-]#iu', '', '!%&abc123_æøå');
Result on server A (php 5.2.6, Server Api: Apache 2.0 Handler):
abc123_æøå
Result on server B (php 5.2.5, Server Api: CGI/FastCGI):
1...
Hi
I want to develop one simple api using php.
My functionality is that if some one enter some required values then they will get calculation result from the algorithm beside on my site.
I am not getting from where can i start.
and also not getting any sample code for API using PHP.
Thanks
Aviansh
...
Hi,
I have 16 million records and need a 8 digit UNIQUE random number for each record, also I want all the numbers to start with 01, and store them in a seperate table, so I can assign the UNIQUE numbers to each record.
I am unsure of how to do this in PHP in order to get 16 million UNIQUE numbers?
Please help?!
J.
...
I get this warning sending mails with php
Warning: mail(1) [function.mail]: failed to open stream: Permission denied in /home/...
using ssmtp and gmail as smtp
PHP 5.3.1
nothing in the logs (no errors)
the mail gets to destination
the permissions of the files are rwxrxrx
Permission denied to what?
Even calling something as simple as...
Hello!
I try to make an "advanced" search field for users. (the users have 5-8 field to short the search list..)
I think i have to build the query depending on which posted field is not empty.
This is my original query, but with this, i got all the row from table..
$query = "select * from MYTABLE where FIELD1 LIKE '%$sample1%' OR FIE...
Fairly straightforward question. In C++ the parent constructor will be implicitly called before the child constructor, so what logic is there for PHP not to do things this way?
EDIT: I've got a good answer from Lukman, but I was hoping for more of a reason why there is a difference. Maybe the question should be why does C++ not allow cu...
I need to run several functions at the same time. I had successfully implemented in C# by creating an ElapsedEventHandler and executing it when a timer gets elapsed. In this way I could run a number of functions at the same time (delegates). How can I do the same thing using php?
...
I have 3 tables in my MySql database.
-------------
| countries |
-------------
| iso |
| name |
-------------
--------------------
| documents |
--------------------
| id |
| country_iso |
| publication_date |
--------------------
---------------
| files |
---------------
| document_id |
| ...
<form method = "post" action = "<?php echo $_SERVER['PHP_SELF']; ?>" />
Username:<input type = "text" name ="user"> <br />
Password:<input type = "password" name = "pass"><br />
<input type = "submit" value ="View Logs!"><br />
<?php
$user = $_POST['user'];
$pass = $_POST['pass'];
//Problem here, I need to only allow the user to see lo...
I have two tables on my page and they appear side-by-side. The first one contains an entry form and the second one contains a grid that displays rows of records.
When the user clicks on a row, the data related to that row must appear on the boxes of the form in the first table.
I know how to call a .php file through AJAX. But when I h...
I have written a PHP extension library in C++. I am writing the extension for PHP 5.x ad above.
I need to access PHP superglobals in my C++ code. Does anyone know how to do this?. A code snippet or pointer (no pun inteded) to a similar resource (no pun ...) would be greatly appreciated.
...
I want to add several headers to all PHP output on my server. In a perfect world, I could just use Apache2s' mod_headers, but unfortunately I'm using WordPress "pretty permalinks", so my PHP files do not end in .php, thus I cannot use the FilesMatch directive. Changing the permalinks to include .php is not an option.
So is it possible t...
We are using a mod rewritten URL within our PHP site, this is the rewrite rule we are using:
RewriteRule ^category/([^.]+)/([0-9]+)/([^.]+)/([0-9]+) categories.php?c_id=$2&filters=$3&_p=$4&area=category&areaname=$1
However, a user of a different system is switching to our setup and wants to 301 all their old pages to their new equival...
I have now spent several hours trying to figure this out.
I have this function to take an image on the server,copy it, resize it, and save it in a temporary location.
The function works and is tested inside another php file.
But THIS PHP FILE refuse to find the folder '../temp_images' (you can see it in the variable $temp_path).
I hav...
I have a controller with different methods, but they all have to set a variable containing a list of items to be shown in a box in the view, I extract data from the DB and set $data['categories'].
Can I set it once and have it visible by all methods?
...
I am sure this is really easy, but I can't find the right function.
I have two arrays, one for x values, one for y and now I want to combine them xyxyxy.
for example:
$x = array(
0=>10,
1=>20,
2=>30
);
$y = array(
0=>15,
1=>25,
2=>35
);
Mixed would leave:
$xy = array(
0=>10,
1=>15,
2=>20,
3=>25,
4=>30,
5=>35
);
...
I have a concatenated string and I want to pass it as query string. For security, I want to encrypt the concatenated string using gpg private key that resides in the same folder where this .php file resides on the remote server.
I want to know whether it is safe to keep the public and private keys on the remote server and use it for enc...
The following code
echo $lastmoment."<br/>";
echo time();
echo "<br/>";
echo strtotime($lastmoment);
outputs:
2009-12-15 17:40:53 1260876829
1260898853
What's wrong? $lastment is a past time stamp in MySQL, why is strtotime($lastmoment) bigger than time()?
...
I am thinking of writing a PHP extension library that will use the memcached library. It is trivial to simply link my library to the memcache shlib.
However, I am not sure what will happen if my (extension library) user already uses memcache on his/her website. My questions are:
Is it possible to have (possibly different versions) of...
Hi there,
Got this working
$i = 0;
foreach ($_FILES["image"]["error"] as $key => $error) {
if ($error == UPLOAD_ERR_OK) {
$tmp_name = $_FILES["image"]["tmp_name"][$key];
$image_name = $_FILES["image"]["name"][$key];
$image.$i = move_uploaded_file($tmp_name, "uploads/$image_name");
$i ++;
}
}
I cant seem to get the...