php

Is it better to store redundant information or join tables when necessary in MySQL?

I have an online shop where users can have little shops with their own products. Each of this products can have questions associated to it and the owner of the shop has the ability to answer those questions. This information is stored in 3 tables a "Questions"(QuestionID,ProductID,...) table, a "Products"(ProductID,ShopID,...) table and ...

Print ">" on every line

How would I do to print a ">" before every line? if ($quoteid) { echo ' > '.$quote['message'].' '; } Currently It Looks like this: > I would move Heaven and Hell and anything in between to get to you. You wouldn't be safe anywhere if I was mad at you. And that's not bull; that's truth. I've went up against people. You could pull ...

need to read line by line order by date

if have file ex (news.txt) and i need php to read my words in this file just one lind by day every day php read one line only>> i write this code but it not work >>>any help $wordfile = "words.txt"; $open = fopen($wordfile, "r"); $read = fread($open, filesize($wordfile)); fclose($wordfile); $array = explode("\n",$read); $date ...

How to test a cron job in Local Server like WAMP?

How to test a cron job in Local Server like WAMP? ...

MVC where to format numbers?

shell i format my numbers 1234.20 => 1'234.20 in model or in view using php and codeigniter? ...

Connect GIMP with PHP or Python

Hi all, is there any way to connect GIMP with python or PHP and use its libraries? It seems that all i can find on the web is pygimp which is not supported anymore. ps. i do my development on mac and i use linux as a production server ...

PHP OpenID Library that allows facebook / openid / twitter, etc;

I am looking for an already completed openid login library that I can just 'plug' into my application and allow for access using any of the openid, facebook, twitter, methods that you would see on many well accessible websites. An example would be Woot.com's login: https://account.woot.com/login?returnurl=http%3a%2f%2fwoot.com%2fdefaul...

PHP preg_replace - finding the replacement from an array using the match as the key

I have a string which can contain multiple matches (any word surrounded by percentage marks) and an array of replacements - they key of each replacement being the match of the regex. Some code will probably explain that better... $str = "PHP %foo% my %bar% in!"; $rep = array( 'foo' => 'does', 'bar' => 'head' ); The desired result ...

Using OpenID with an existing website login sytem

I have recently implemented Google and Yahoo's OpenID endpoints into my authentication system on my site so that users can avoid creating an account on my site. Pretty common practice, right? I have a specific question though, but first a little background information. When I get through the three-legged authentication I used Attribute...

How to calculate the percentage of similarity or difference between two texts / strings ?

Explaining it further Assume i have two strings like below I am a super boy who can Fly! Really . I am super boy who can Break walls! Really . So some characters are similar I am super boy who can and Really . . Is there anything ready to use to find percentage similarity/diffrence between those two strings. ...

filter_input(INPUT_GET, ‘my_string’, FILTER_SANITIZE_STRING); VS Regular Expression Preg Match PHP

Hi, Out of experience which is better to use filter_input(INPUT_GET, ‘my_string’, FILTER_SANITIZE_STRING); Or a regular expression preg_match for sanitizing user in-putted data ? ...

(PHP) rawurlencode/decode seems to encode '£' sign as '£' (%C2%A3 instead of %A3)

So, I've run into a problem with PHP's rawurlencode function. All text fields in our web app are of course converted before being processed by the web-server, and we've used rawurlencode for this. This works fine with almost every character I've found, expect for the "£" sign. Now, there is no reason for our users to ever enter a pound s...

validation link via email

When a user subscribes to my newsletter via their email address, using php, how would I send them an 'Activation Link' via email to confirm it is their email address and not a fake one. so at the moment I have PHP: <?php $to = "[email protected]"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)...

Implement a PHP singleton: static class properties or static method variables?

So, I've always implemented a singleton like so: class Singleton { private static $_instance = null; public static function getInstance() { if (self::$_instance === null) self::$_instance = new Singleton(); return self::$_instance; } private function __construct() { } } However, it recently struck me th...

PHP values inside an arrays in a PHP file are displaying an error when that file is called via Ajax!

I call a php file in the following way using Fancybox index.php: <div class="pic"> <a id="showcase1" href="showcase/showcase1.php"><img src="images/showcase1t.png"/></a> </div><!-- .pic --> inside showcase/showcase1.php I have the following code: <?php include_once '../localization.php'; ?> <div id="inline"> ...

facebook fbml application confused

Hi, I'm newbie in creating application on facebook My app type is FBML, Why cant i use <fb:share-button href="http://apps.facebook.com/example" type="box_count"></fb:share-button> ...

i have a problem with setting up the connection for a site using dreamweaver and wampp 5: Http Error 404

i use dreamweaver to develop a website but when i tryd to connect it with the wampp 5, it displays http error 404. i have checked the configuration and nothing seems to be wrong, don't know what i am missing, pls can someone pls help me out? ...

Saving modular user permissions in a database.

I have a PHP MySQL application which has a modular design. There are about 5 modules total now, and I don't really foresee there ever being more than 10. I currently have 2 types of users - "User and Admin". These user types have the same perms except the Admins can edit users, whereas regular users can't. I want to implement modular p...

Escape "+" with JS and PHP

Hi, i have made an app, you write some text, and text will be saved over ajax. Before sending the request, i escaped it with js. But somehow, the "+" Character will be converted to " " Space Character... So i tryed to find and replace before sending in "%plus%" but i get thes error message: Uncaught SyntaxError: Invalid regular exp...

Help on creating a new z-push backend

Hello, I'm currently trying to create a new z-push backend for SOGo. I've been looking for simple code snippets or samples, but I've found only quiet large stuffs. It lets the user push mail, or calendars. For now, I can't test the input myself (the application is on a private network, and I'm having troubles with my android emulator)...