Hello,
I've seen around the web the following regex
(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$
which validates only if the string:
* contain at least (1) upper case letter
* contain at least (1) lower case letter
* contain at least (1) number or special character
* contain at least (8) characters ...
I noticed that there're some similar questions about this problem when I typed the title,but they seem not be in PHP.So what's the solution to it with a PHP function?
To be specified.
$a="/home/apache/a/a.php";
$b="/home/root/b/b.php";
$relpath = getRelativePath($a,$b);//needed function,should return '../../root/b/b.php'
Any good ide...
How do you query a MySQL table columns highest entry and store it in a variable. Here is what I have but it is not working.
$query = "SELECT MAX(date) FROM Records WHERE ips='$currentip'";
$result = mysql_query($query) or die(mysql_error());
echo $result;
Update:
<?php
$db = mysql_connect("localhost", "123", "123");
mysql_select_db(...
Hi, I always use ASP.NET but I'm making a site of my own with a friend of mine so we don't have the money to use webhosts which can use asp.net & sql server. So I'm planning on using a free php based webhost. I actually already created my entire site in asp.net, so I'm researching in php equivalents. I managed to find as good as anything...
I have names like this:
$str = 'JAMES "JIMMY" SMITH'
I run strtolower, then ucwords, which returns this:
$proper_str = 'James "jimmy" Smith'
I'd like to capitalize the second letter of words in which the first letter is a double quote. Here's the regexp. It appears strtoupper is not working - the regexp simply returns the unchang...
i want to get an ip addres of visitors.
could you tell me what element of $_SERVER[] i should use?
$_SERVER['HTTP_CLIENT_IP'];
$_SERVER['HTTP_X_FORWARDED_FOR'];
or
$_SERVER['REMOTE_ADDR'];
thanks
UPDATE:
If your client is connected to the Internet through Proxy Server then $_SERVER['REMOTE_ADDR'] in PHP just returns the the IP addre...
I have a SOAP service that returns an array of a complex type. The definition in NuSOAP in PHP looks like this:
// The type itself
$server->wsdl->addComplexType(
"Clip",
"complexType",
"struct",
"all",
"",
array(
"Id" => array(
"name" => "id",
"type" => "xsd:int"
)
// ---snip---
...
Afternoon chaps,
Trying to index a 1.7million row table with the Zend port of Lucene. On small tests of a few thousand rows its worked perfectly, but as soon as I try and up the rows to a few tens of thousands, it times out. Obviously, I could increase the time php allows the script to run, but seeing as 360 seconds gets me ~10,000 row...
I am using this class to create zip
<?php
// vim: expandtab sw=4 ts=4 sts=4:
class zipfile
{
var $datasec = array();
var $ctrl_dir = array();
var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
var $old_offset = 0;
function unix2DosTime($unixtime = 0) {
$timearra...
Rails relies on some of the neat aspects of Ruby. One of those is the ability to respond to an undefined method.
Consider a relationship between Dog and Owner. Owner has_many :dogs and Dog belongs_to :owner.
If you go into script/console, get a dog object with fido = Dog.find(1), and look at that object, you won't see a method or attri...
Can anyone please tell me how to write a small div container in HTML that refreshes its contents from the data in mysql every 5 min.
This is similar to twitter updates in some webpages which show updates as and when tweeted.
Thanks.
...
I am moving from Perl to PHP and am struggling to get my head around PHP sorting.
Here's what I have in Perl:
$log{'11111'}{'1'}{'20100102'}{'name'}='blah';
$log{'11111'}{'1'}{'20100101'}{'name'}='blah';
$log{'11111'}{'1'}{'20100103'}{'name'}='blah';
$cook='11111';
foreach $entry (sort {$log{$cook}{$a}{time} cmp $log{$cook}{$b}{time}...
The Problem
I am tring to do an ajax request to a PHP script, however I am having a problem getting the data into the format that the PHP is expecting it, the PHP is expecting the data to come in as array within an array something like,
Array
(
[cv_file] => Array
(
[849649717] => Y
[849649810] => Y
...
I'm making a site, and will be allowing guests to vote/comment. How should I go about storing the user info?
I wouldn't like the info to be cleared if someone deletes the cookie (SO handles guest users via cookies I guess). If someone clears cookies and changes the ip at once, then only should the guest user info should be lost.
Should...
As per the HTML Purifier smoketest, 'malformed' URIs are occasionally discarded to leave behind an attribute-less anchor tag, e.g.
<a href="javascript:document.location='http://www.google.com/'">XSS</a> becomes <a>XSS</a>
...as well as occasionally being stripped down to the protocol, e.g.
<a href="http://1113982867/">XSS&...
I have a problem of web pages being cached even though I specify that it should not. Take the simple example :
<html>
<head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
</head>
<?php
print date("Y/m/d H:i:s");
?>...
Is it possible to translate everething written in OCaml to PHP? for example will it be hard to translate such lib as lib for Fast content-aware image resizing
...
Hello, can't understand mysql error:
UPDATE static_pages SET order = " Some
new data 222222
"Database error: You have an error in
your SQL syntax; check the manual that
corresponds to your MySQL server
version for the right syntax to use
near 'order = "
$query = 'UPDATE someTable SET '.$key.' = "'.$value.'"';
Here ...
I need to take an array that looks something like ...
array( 11 => "fistVal", 19 => "secondVal", 120=> "thirdVal", 200 =>"fourthVal");
and convert it to...
array( 0 => "fistVal", 1 => "secondVal", 2=> "thirdVal", 3 =>"fourthVal");
This is what I came up with -
function compressArray($array){
if(count($array){
$counter...
I am using cURL for the first time. I need to login to a site.
I have problem with setting cookie file and to retrive, so that i can acces that page not just one time, but several times.
I found the code on the web, for logging in to a site and Scrap a page for some detailed info, cause to get that page it takes to much time.
so i just w...