I have a web-site based on PHP, to which I would like to add a members-only area. Instead of creating my own registration/login pages, I would like to make a piece of code which will look if the user is logged on a particular site (for simplicity, we could assume that this site is Facebook) and if yes, allow him to navigate on my site. I...
I have a database table that looks like this:
CREATE TABLE IF NOT EXISTS `articles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`texte` varchar(255) NOT NULL,
`rubrique` varchar(255) NOT NULL,
PRIMARY KEY (id)
);
Which is PDO mapped like this:
class Application_Model_DbTable_Articles extends Zend_Db_Table_Abstract
{
prote...
I run this script:
define('SECRET', "vJs;ly-W\XDkD_2'-M7S2/ZRRBobxt5");
echo sha1(SECRET . 'zcbkeyky' . '[email protected]') . "\n";
Locally with PHP 5.3.2 (cli) it gives me: 3baa47e50394cd2dce236dcbf2f409fdb9010f2a
On a remote machine with PHP 5.1.6 (cli) it gives: d1bcf4ea83e50593d3df19a8455a5f5cd32d63ef
Why does the same calculation dif...
In my bootstrap file, I have a heck of a lot of routes. Is there a way to use a previous route as part of a new route?
For example, if I want to change the url structure of route 'admin', instead of changing it 30 times for all the other routes, can I just include the route 'admin' in front of everything else? Something like:
$router-...
Hi guys, i used an example to build an push notification service....it worked greate on the development version, but now that my application is in production, i can not get it to work....i have rebuild my .pem file with production certificates, but by now...,nothing....heres my code in PHP to push:
<?php
$token = '504e06eeeeee26b82c084a...
How would I convert uderscores surrounding words and sentences from a chunk of text into italic tags with PHP. Thanks in advance.
So -
This is _just_ a test string for the _purposes of this example_.
Would become -
This is <i>just</i> a test string for the <i>purposes of this example</i>.
...
$match = array('~(?:face\=[\'"]?(\w+)[\'"]?)~i', '~~i');
$replace = array('font-family:$1;', '<span style="$1">');
I want to replace the old <font> element which has a "face" attribute with a new <span> element with "style" attribute but the regex always fail when the font name in the "face" attribute contains whitespace, e.g : Co...
I come from a SQL Server background and thought that it might mean it was a temporary table, but after reading up on MySql temp tables I don't think that's true.
I'm seeing it in the following context:
SELECT ID, Name FROM #_SomeName
UPDATE
This query is defined in a PHP string and then run against the MySQL Database. I'm not sure ...
PROBLEM RESOLVED
My Problem: I want to count inverse in the for loop.
This is the opposite of what I want to do:
for($i=1;$i<=10;$i++){
echo $i;
}
If I put $i-- doesn't works (my server crashes).
Help meeee!
Best Regards,
Adam
...
I need extract data from a string. Heres an example:
Mozilla/5.0 (Macintosh; U; PPC Mac OS
X; tr-tr) AppleWebKit/418 (KHTML, like
Gecko) Safari/417.9.3
I want to get what's after the "Safari/" (417.9.3) but:
The "Safari" string can be in any character case and can be anywhaere in the string.
The version is separated from "Saf...
What is the fastest way to beautify my urls?
I always have a single id ('page'). I want the url to be www.mysite.com/page
Thanks
...
I'm been looking through the Internet for an answer for a long time.
How could I control users and connections between php and MySQL.
My question is, when we create a mysql database through php, actually we create the user in a user table in mysql. When I connect to the database, all the user we created is using same mysql user account t...
I am currently translating my PHP application using gettext with POEdit. Since I respect the print margin in my source code, I was used to writing strings like that:
print $this->translate("A long string of text
that needs to follow the print margin and since
php outputs whitespaces for every break line I do
my sites renders...
Well as the question says am trying to insert a string value into a Soapclient request I know there should be some sort of term before the $searchTerm parameter, but I don't have a clue what it is any help would be much appreciated.
$searchTerm = $_GET['search'];
$client = new SoapClient('http://stuiis.cms.gre.ac.uk/dd615/' .
'aspwe...
I need to access 3 values of color that are contained in my theme's currently active skin folder. In each of my theme's "skin" folder's I have 3 images: header.gif, footer.gif and spot.gif.
These images are all the same size and are just used for background colors in my theme skins. The theme owner can create a custom color for each of ...
can i debug or trace formally by help of zend studio
i am not having any debugger is any debugger is bydefault integrated in zend debugger or not help me
...
I need to generate a random number.
But the twist is that the % of lower numbers should be greater than the higher.
For example.
rand > 1 to 100
13,
15,
12,
16,
87,
15,
27,
12,
1,
12,
98,
12,
53,
12,
14....
The bold integers will be the ones return from the 1-100 range.
The math should be like so rand = a number lower than max/2
...
I've been wondering for the longest time WHY I actually need a live resource to SQL connected in order to use mysql_real_escape_string ( string $unescaped_string [, resource $link_identifier ] )
Does this function not simply escape the data? What's the point of connecting? I want to use the function without a connection, I'm debating cr...
Hi,
I have a very trivial problem with str_replace.
I have a string with the En Dash character ( - ) like this:
I want to remove - the dash
The html output is
I want to remove the – the dash
I want to do this:
$new_string = str_replace ('-','',$string);
I've tried to parse the string with html_entity_decode, to parse the ...
Is there a reason why certain pages are made as .php when you can put php into a .html file? Is it simply for the sake of organizing your files? Or does it affect how the page loads?
(I'm talking about the file extension)
...