Hi,
I've a website where users can register. I would like to prevent all special characters, accents, etc in the nickname (used to login).
I use PHP. How can I do that ?
Edit: Another question, can you give me a regular expression (in PHP) who allow ONLY the 26 letters : abcdefghijklmnopqrstuvwxyz and no more ?
Thanks
...
Hello,
I would like to know if anyone knows of an online service where we paste the code and it generates back the colored html source code for that code. It could be PHP, HTML, CSS, Javascript, C, Java.
Idea is that once i have the colored html code, i could easily put that in my wordpress.com blog. I know about [sourcecode language="...
I have a function which gets the ids of all children of a parent from my DB. So, if I looked up id 7, it might return an array with 5, 6 and 10. What I then want to do, is recursively find the children of those returned ids, and so on, to the final depth of the children.
I have tried to write a function to do this, but I am getting co...
Hi all, I've been refactoring some code running on a simple LAMP box on my network. I noticed that there really isn't any particular reason why we're using Apache aside from being able to say it's a LAMP setup.
I've heard of some other options (lighttpd, nginx, etc.) and was wondering what benefit using these would provide over using Ap...
I am in a web scripting class and our teacher is very strict on the guidelines of the assignment, as he has scripts that grade our work. With that being said we are allowed to use only two forms for our assignment, one for logging in (form 1) and one for submitting data to be entered into a database (form 2).
My instructions say:
A us...
How can i check to see if a string only contains spaces?
...
I'm looking for php game engine/framework. Free or cheap, preferably open source (but it's not requirement). If there's nothing like this available I'd be fine with modifying some open source game...
I like Legend of the Green Dragon a lot (simple but enjoyable gameplay :) but it's use terms are very limited - they don't give you permis...
If you go to http://www.foxnews.com, and scroll down a little you would see the box "LATEST NEWS".
Now I want to do something like that, but with modification.
I have 3 queries, that get out information from 3 tables. But this doesn't give me the "latest news", because it's 3 separate queries.
Now I want to make a box, (I can do this ...
I'm trying to evaluate an xml node using xpath and i'm not sure why it's not evaluating to true.
xml
<?xml version="1.0"?>
<users>
<user>
<username>tom</username>
<password>d644cd4b1c72f563855e689d46d9198e</password>
</user>
<user>
<username>jeff</username>
<password>smith</password>
</us...
I'm trying to simulate browser with POST method using PHP/cURL.
When I looked at that live Http header it shows Content-Type: multipart/form-data.
I checked on the internet where it was suggested that cURL will send multipart/form-data when a custom headers is specified to Content-Type: multipart/form-data.
$headers = array(
'Con...
I'm trying to translate a Perl script to PHP and I'm having trouble with some Perl things. For instance, what does @_ -1 mean? And how do I write it in PHP?
The whole function is as follows:
sub variance {
my $sum = sum_squares (@_);
my $deg = @_ - 1;
return $sum/$deg;
}
...
When I send email on locally I don't have any problem with sending email.
However when I uploaded to my live site, I am not able to send email.
I use PHP mail function.
Can anyone tell me what I need to look for?
Thanks in advance.
...
Hello all,
I'm currently using SSH2 over PHP. This is my first time doing so, and I'm hoping I might be able to get some solid feedback on this.
Essentially, what I am attempting to do is authenticate to a server (via SSH), run a command, and then echo back the results of that command.
Here's what I am currently using:
if (!funct...
How can i unset a range of keys between say 70 to 80 in an array like this?
[63] => Computer Science and Informatics
[64] => Dentistry
[65] => Development Studies
[66] => Drama, Dance and Performing Arts
[67] => Earth Systems and Environmental Sciences
[68] => Economics and Econometrics
[69] => Education
[70] => Electrical and Electroni...
Can someone explain to me why in the world my DB_PREFIX variable is not accessible? When echoed, it just prints out DB_PREFIX to screen. All of my other defined variables are being printed to screen just fine, when called of course.
Help?
debug.php
require_once('db/config.php');
$conn = mysql_connect(DB_HOST,DB_USER,DB_PASS);
mysql_s...
Back to my JaxpTree object. The tree is supposed to convert a MySQL related-table pair into a nested tree that follows such relationship:
/**
* Generates a JaxpTree structure. Parameters are used by the recursive
* function. Normally, they shouldn't be specified.
*
* @param int $parent_id
* @param s...
My setup:
4 webservers
Static content server (NFS mount)
2 db servers
2 "do magic" servers
An additional 8 machines designated multi-purpose.
I'm writing a wrapper for three caching mechanisms so that they can be used in a somewhat normalized manner: Filesystem, Memcached and APC. I'm trying to come up with examples for use (and what...
Ive got a view helper in library/my/view/helper/gravatar and so in any view I can call $this->gravatar($email).
But how can I access this function in the models (or controllers)?
Sorry if its already been asked but Im new and the documentation is bloody awful in parts.
Thanks everyone
...
$allUsersResult = mysql_query("SELECT * FROM users");
// the purpose of this line was to grab the first row for use
// separately in a different area than the while loop
$user = mysql_fetch_assoc($allUsersResult);
while($users = mysql_fetch_assoc($allUsersResult)){
// the first row is not available here
}
So is this a bug or is ...
Before I used a framework, I'd often define things like so (so my code makes more sense to read)
define('MINUTE', 60);
define('HOUR', MINUTE * 60); // etc
Is anything like this built into Kohana 3, or should I specify this myself (perhaps in bootstrap.php)?
...