I'm going to write a framework for my web projects in PHP.
Please don't tell me about considering to use some existing framework (Cake, CodeIgniter, Symfony, etc.) - I have already had a look at them and decided to write one for myself.
The framework itself will mainly consist of a module system, a database handler and a template parser...
Using ssh, I can use another computer as a proxy, for ex.
$ssh -D 9999 username@ip-address-of-ssh-server
Now, I can configure my application to use socks proxy on port 9999 at the above given up address.
If I own a web server, can i make a php script which also listens from connections on a particular port (preferably access provided...
I have a list of names (1-15 rows) I display from an array. I want the administrator to select the correct name from the list by clicking on the hypertext called "link." The record id is in the array and I want that passed to the called script.
I found this javascript that works except that I want the linkur.php page to print (with it...
I'm trying to use Security::allowedControllers and Security::allowedActions. So I have a controller which look more or less like this
class AppController extends Controller {
var $components = array('Security'); //other components
//other stuff
}
class BookController extends AppController {
function beforeFilter() {
...
The whole MVC design confuses me a little bit as I have never used it. Below is the general layout of my current project...
The account folder holds basicly all my core files for my user system
root/account/login.php
root/account/home.php
root/account/logout.php
root/account/settings.php
Then I have a seperate folder for ...
Hello everyone,
I am trying to run Example #1 from this page: http://php.net/manual/en/language.exceptions.php
However instead of the desired output I get:
0.2
Fatal error: Uncaught exception 'Exception' with message 'Division by zero.' in xxx:7 Stack trace: #0 xxx(14): inverse(0) #1 {main} thrown in xxx on line 7
I have absolutely ...
echo 'Tok: '.$tok.' Strpos: '.strpos($tok, "\"").' length: '.strlen($tok).'<br>';
And this:
echo 'Tok: '.$tok.' Strpos: '.strpos($tok, '"').' length: '.strlen($tok).'<br>';
Result in the following output:
Tok: "fresh Strpos: length: 11
Strpos is failing completely to find the double quote, it returns false (I checked with strpos(...
I have a checkbox which can make a post password protected-
<p><strong><label for="password">Password protect?</label></strong> <input type="checkbox" name="password" id="password" value="1" /></p>
My Php tries to post-
$password = htmlspecialchars(strip_tags($_POST['password']));
I get the undefined index error.
Now, if I try to...
Whats wrong with this function?
function yahooWeather(){
var loadPage = 'yahooweather.php?p='+ $("#myCity").val();
$("#yahoo").html('<img src="loading.gif" align="absmiddle">');
$("#yahoo").load(loadPage);
}
Is there another way to write this function. Im unsure if its able to read the .val required, tho i know it is se...
Hey Folks,
how can I remove an element of an array, and reorder afterwards?
<?php
$c = array( 0=>12,1=>32 );
unset($c[0]);
// will return sth. like array( 1=>32 );
?>
How can I do a "rearrange" like pointing the 1 to 0 after delete (automatically)?
Thanks!
...
I have a MySQL table of records, each with a lat/lng coordinate. Searches are conducted on this data based on a center point and a radius (any records within the radius is returned). I'm using the spherical law of cosines to calculate the distance within my query. My problem is that indexing the geodata is horribly inefficient (lat/lng v...
Ok my problem is as follows;
I have a class that describes a pet with this constructor;
public function __construct($name, $type, $age)
So what I want to do is make a number of pet objects, then I want to print all the attributes of all the objects of this class so that it looks something like this
What is the best way of going abou...
The title is quiet straightforward. I have to know on server side if the script called through HTTP request or by command line. I could examine the $_SERVER['argv'] or $_SERVER['argc'].
What is the pragmatic way to do that?
...
Using jquery is it possible to filter XML results that are loaded? Ideally i would like to do a mysql style filer/search like
SELECT * FROM "example_table" WHERE id="1"
I have an XML file loaded in to my application with the following structure
<country>
<state id="1">
<statename>Baden-Wurttemberg</statename>
<cities>
...
How would i go about counting the number of rows that match two variables?
I have a table called: users
and fields called: username & referral
I have another table called: comments
and fields called: *comment_username*
This is the situation, I need to fetch the number of referrals with at least 10 comments (rows in the comments' tab...
Hi !
Does anyone knows how can I have a relation 1 to many in doctrine but in this special way:
in my principal table I have some fields, almnost none of them are fields which could have translations
Table1:
table_id <- primary key
numeric_field1
numeric_field1
numeric_field3
now in my Table1_translations I have all the fields which ...
In my theme I'm trying to display the excerpts or teasers of child pages, yet I do not want to display any images, I want image tags stripped out.
Once I've gotten the teaser in all its html glory in a php variable, how do I strip out the img tags prior to using echo?
...
Hello Everybody,
I just wanted to take a look at Mongo-DB. But i just don't get it running. I've installed it with PECL and my phpinfo() tells me that the extension is loaded, but when i try to get a connection with
$mongo = new Mongo();
I get this:
Fatal error: Uncaught exception 'MongoConnectionException' with message ': Transport ...
So we all know that you should always, not only in PHP, separate code from content/design/html. (I have seen people that say the opposite here today)
I mean, you don't want one of these in bigger projects, do you?
<?php
echo '<div id="blah"><b>'
. $username . '</b>'
. $stuff . '<more HTML mixed with PHP...>';
?>
But: What...
I have managed finally to get Solr working, with the help of all you guys, so THANK YOU!
And I have to say, I now understand why you recommended it, it's really powerful.
Now, to the issue...
I have indexed all "Searchable" information into Solr, and my plan is to query Solr, and then get the ID:s of the query-results (of all records t...