trq
Staff Alumni-
Posts
30,999 -
Joined
-
Last visited
-
Days Won
26
Everything posted by trq
-
Responding to a request with a static file is almost always more efficient than re-generating a new page dynamically upon each request.
-
<?php echo $list_f['username'];?>
-
Its never a good idea to code with short tags <? ?> because some servers have this option disabled. Always use <?php ?> Does that answer your question? Fix your problem?
-
How should we know? You haven't exactly described your problem well.
-
I'm really not sure what gave you the idea that that method would be at all efficient.
-
What exactly is the problem? To see if the username is already in use execute a SELECT query with the username as part of a WHERE clause.
-
You can't. Think about it. Firstly, there is no such thing as a connection using http, you simply make a request and the server responds. Now, if you where to fool a server into thinking you where using some one else's ip address, where do you think the server would send the response to?
-
Where is realEscape() defined?
-
There is no substitute for filter_var, you would need to write it yourself.
-
Calling functions from external class within functions
trq replied to birdzhavefangs's topic in PHP Coding Help
function bob2(Bob $obj) { would force $obj to be of type Bob which is in this case what you want. -
Calling functions from external class within functions
trq replied to birdzhavefangs's topic in PHP Coding Help
$B does not exist within your bob2 function, you will need to pass it in as an argument. <?php require_once("bob.php"); $B = new Bob; $B->loud(); function bob2(Bob $obj) { $obj->loud(); } bob2($B); echo "oh noes"; ?> -
There are clear descriptions and examples within the link to the manual I already posted.
-
If the script you want executed is a php script it should contain a shebang line on the very first line. This lets the shell know what program should execute your script. eg; #/usr/bin/php <?php // some php script ?> You can now simply put; 10 * * * * /path/to/your/script.php in your crontab. Otherwise, without the shebang, you need to actually specify what program to use to execute your script within the crontab entry; 10 * * * * /usr/bin/php /path/to/your/script.php
-
I'll just repeat my last response. You really should look into what Ajax actually is.
-
So, take a look at the link in the previous reply.
-
Your registration form should already have an action pointing to a processing script. Within that script you would need to insert a call to the mail function.
-
You might want to look into what Ajax actually is. It has nothing to do with page element effects.
-
Is there any particular reason you have chosen to use php to create these dumps? MySql is quite capable of doing this alone.
-
Your best (and most logical) approach would be to change the DNS records to point to the new server. Otherwise, you could nfs mount the remote directory locally and do it that way but it would slow your site down considerably.
-
Using jQuery this would be a simple task. A VERY simple example, not tested. <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script> $('#thumbs ul li').hover( function() { img = $(this).find('img').attr('src').replace('-thumb', '-full'); $('#stage').html('<img src="' + img + '" />'); }, function() { $('#stage').html(''); } ); </script> </head> <body> <div id="thumbs"> <ul> <li><img src="image1-thumb.jpg" /></li> <li><img src="image2-thumb.jpg" /></li> <li><img src="image3-thumb.jpg" /></li> </ul> </div> <div id="stage"></div> </body> </html> You'll need the images image1-thumb.jpg , image1-full.jpg etc etc
-
IIS7 has url re-writing abilities, otherwise, you'll need to fork out for a third party isapi filter such as isapi_rewrite3.
-
The part in cPanel that asks for a remote host would need to be the hostname (or ip address) of the site you wish to allow access to your database. The part in your connection however would need to be the name of the server hosting the database.
-
Calling a function from inside a function - possible ?
trq replied to MacRedrum's topic in PHP Coding Help
The point of functions is to package code into small encapsulated, reusable, callable pieces of code. Globals break 2 of the three things functions set out to do, encapsulation and re-usability. They also (as you are now experiencing) make things very difficult to debug. -
Calling a function from inside a function - possible ?
trq replied to MacRedrum's topic in PHP Coding Help
With all those globals I'm not sure why your bothering with functions at all. Functions accept parameters, use them.