![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Wolphie
-
Posts
682 -
Joined
-
Last visited
Never
Posts posted by Wolphie
-
-
function href_d($string) { $string = preg_replace("#<a[?: href=('|\")((\w:/\.\?\#&=\-)*)\\2]?[\w\"'_\s]*>#iU","1 \\2", $string); $string = htmlspecialchars($string); return $string; }
-
Yes, ScotDiddle is right, you need curly braces for code blocks. If it's just a single line of code then you don't need the braces.
e.g.
$name = 'Wolphie'; if($name == 'Wolphie') print 'My name is ' . $name; // For braces $name = 'Wolphie'; $age = 19; if(($name == 'Wolphie') && ($age == 19)) { print 'My name is ' . $name; print '<br />'; print 'My age is ' . $age; } else print 'Your name is not ' . $name;
-
To be honest I've never looked into this in depth but I've always been curious. But I would recommend taking a look at sockets in PHP. Remember PHP isn't jut a web development language. It is an actual language.
-
Then an array would work, but you would need some fail safe way of searching the pages for each particular word in the array and then replacing it with the translated work. Take a look at http://uk2.php.net/manual/en/function.preg-replace.php and regular expressions.
-
Xyn: If you've been reading, that is what we've been discussing.
bluejay: I suppose it is, I guess in any languages people will have their own experiences, but Lodius2000 there's no reason why you shouldn't at least try nl2br(), it may or may not work and if it does it's just saved you a lot of time and effort.
-
You would need some kind of dictionary, or an array which has the original words and then the translated words, this could also work with two fields in a database.
-
I know *nix uses \n, hence why I specifically said Windows machines. But based on this I've never had a problem. On both kinds of servers, nl2br() has always worked perfectly fine for me.
-
It shouldn't make a difference, \n\r is just a newline for windows machines.
-
I'm not even going to attempt to help you until you use the BB
tags to post your code.
-
I think what you may be looking for is nl2br();
This function turns new lines (\n or \n\r) into HTML line breaks (<br />) for you. I find it a very useful function.
-
Please in future use the Code BB tags.
If you want to move them to different directories based on their ID, either get the ID from a database and store it in a variable and use a switch statement, or if you already have the dynamic ID's use a witch statement still.
switch($uid) { case 'G1061': $homeDir = 'client1'; break; case 'G1059': $homeDir = 'client2'; break; default: print 'Invalid user ID!'; break; }
-
If you look around on google, you'll find free articles such as privacy policies, terms of use etc.. which only requires a small amount of changing and are free to use.
-
FireFTP is a free FTP client, it's also an Add-on for Mozilla Firefox.
-
Good ol' localhost eh Daniel
-
My post isn't really all that helpful, but from my experience I don't think there is a way of doing this without an additional library.
-
I don't use facebook, but I assume you're referring to inline editing. For example, you click on an element i.e. a paragraph, and then a text area appears with the contents of the element inside allowing you to edit it and then update it. For this I would recommend using jQuery, there's a plug-in named jEditable which allows you to do this in conjunction with Ajax.
-
Surely anyway wouldn't you need to call the body of the blog post, title of the blog post, etc..?
If I was doing the same thing, I would also have an author field in the same table. In which case, it wouldn't be that difficult to add an extra line or so to get the author from the database.
But ID's are the best way to retrieve hierarchical data, or any kind of data to be honest.
-
It should be something like
if((!strpos($email, 'domain1.edu')) || (!strpos($email, 'domain2.edu'))) { die('Please enter a valid e-mail address.'); } else { // do something else... }
-
Well, first of all you're calling the function before it's being defined and then exiting. Exiting stops everything beyond it from being parsed by the PHP engine.
<?php session_start(); function createimage() { ... } createimage(); exit; // exit is a language construct, not a function. Parentheses aren't necessary. ?>
<?php session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/EN/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <br>Login Page : <form action="tologin.php" method="post" > username : <input type="text" name="username"> password : <input type="password" name="password"> securitycode : <img src="securitycode.php" width="100" height="25" alt="Security Code"> Submit </form> </body> </html>
You have a whitespace <?php session_start(); ?>, use <?php session_start(); ?>
The whitespace may not do any harm, but it's best practice to avoid them.
-
Haha, thanks for the reply! Not what I initially expected but still an interesting one. I know a lot of things are just a theory, but it would be annoying if I were to point out that everything I was talking about is just a theory!
Lol @ That picture!
-
The more records you add, the greater the load on the server is, therefore the server is trying to allocate more memory to compensate for the increase.
-
Yeah, I would agree with Nightslyr, using a complex regular expression wouldn't be necessary for a definite amount of domains allowed. You should just use a wild card before the domain, or check to see if the domain even exists in the string.
-
If that's the case, then you shouldn't use list().
list() assumes a known amount of elements in an array. Using the example you provided, exploding it would only make the array have 3 elements, therefore if the array were to have 4 elements you wouldn't be able to use list() because the amount of elements wouldn't be definite. In which case, you should ditch list().
-
If it returned true then there is obviously a problem. 5 is NOT less than 1, hence why it should return false and hence why returning true is a problem. A regular human can even notice that.
Security
in PHP Coding Help
Posted
Erm, why not just use PHP's pre-built is_numeric() function?