php

PHP + MySQL encoding issues for Portuguese (PT-Br)

I'm developing a website in Brazilian Portuguese and I'm facing some really annoying encoding problems. Words that should be written this way: óbito are being written this way: �bito I have noticed that while the texts are still at the database they are ok. But when I use echo with PHP, the encoding problem comes up. List of things I ...

Converting data representations and managing errors

Hello, say you are implementing an api that usually takes data in the form of associative arrays, processes them for validation etc and converts them into a different format (still an array, although the keys and overall structure is different), and then sends them off to get processed further. What would be the best way to handle this....

[PHP]: Use function return as array data in static class definition.

I'm having problems with this class definition because of the definition of $directories. Please help: <?php ..... class Config { public static $directories = array( "resources" => realpath(__DIR__), "root" => $_SERVER['DOCUMENT_ROOT'], "branch" => $_SERVER['DOCUMENT_ROOT'] . "/branch", "templates" => re...

generate unique array values

hi all. I have a such problem which I couldn't solve in a good manner. My solution needs too much time and loop uses catastrophically big memory. So I need a help. I have 3 mysql tables. Gorups group_id group_name games game_id game_name questions question_id game_id question_name question_text question_groups question_i...

inline JSON syntax in PHP

PHP would be a lot cooler if you could write things like this: $array = [2, 3, 5]; $object = { "name" : "Harry", "age" : 23, "cats" : ["fluffy", "mittens", "whiskers"]}; but, I just spent a lot of time looking for an extension (even an experimental alpha or anything) adding json syntax to PHP but found nothing. Does anything like th...

Can someone recommend me a TTS solution in PHP for a CentOs server?

Hi, i own a translation service and now im wanting to implement a TTS solution. Do you know any software that can be executed from php to generate mp3s on the fly for a specific text? ...

Jquery not working

Hi, For some reason, my jQuery isn't working properly, and I can't spot the mistake, although I may have some idea. Below is some of the code from group2.php, its for a chat application: <div id="wrapper"> <div id="menu"> <p class="welcome">Welcome, <b><?php echo $_SESSION['name']; ?></b></p> <p class="logout"><a id...

PHP Integer Configuration (e.g. 1=apache,2=php,3=apache+php)

How can I parse a configuration value with PHP which is a number and a total of other numbers. One example of this is: 1 -> Logging Enabled 2 -> Error Reporting Enabled 4 -> E-Mail Reporting Enabled 3 -> Logging + Error Enabled 5 -> Logging + E-Mail Enabled ...

Best cipher for c# and PHP?

Hi, I have made a C# application that talks to my website via PHP(mcrypt) and visa versa. I was wondering which is the best cipher to use and if there are any ciphers that are tempermental when encrypt/decrypting over different lanuages. I also wondered if I need to convert the data to a different format before encrypting. E.g. Say...

PHP, possible to have multiple keys for one array value?

I'm getting an array of values back from a database where I get an array with values like this: Array ( [6712] => 64.79.197.36:43444 [6712] => 64.79.197.36:43444 [6711] => 64.79.194.56:41113 [6710] => 64.21.47.20:8080 [6709]) Where the numbers in brackets, like [6712] are the "id" field in the database.. the issue is that in my scrip...

Help with a possible performance problem (in a php pagination)

Hello I have a search engine, but in the pagination I have to redefine the searchterm in the url, I mean <a href='http://mysite.com/search.php?q=searchTerm&amp;currentPage=2'&gt;Next&lt;/a&gt;. Please tell me if I'm doing it well or there is another way to do it ...

How to get Joomla/Virtuemart to allow shopping group to be tax exempt?

Need php code to check shopping group and set tax rate to zero for Joomla/Virtuemart ...

How can I find the width of an image using PHP?

I was wondering how can I find the width of an image using php. ...

Which PHP String function to use?

Which string function can I use to strip everything after - ? The string is not predefined so rtrim() does not work. 9453-abcafaf3ceb895d7b1636ad24c37cb9f-100.png?1 ...

How to store multiple sets of values in a database?

Right now I'm creating a web-app which requires that multiple sets of data (including a URL, title, and date) be stored in a DB. So for example, User1 may be storing Item 1 which consists of Example, http://example.com, and YY-MM-DD HH:MM:SS. And he may have multiple items with the same types of data. Before, I was sotring all the item...

Web Service to Get Current UTC Time?

I'm building a PHP web application and need to know what the current date/time is. I cannot depend on the server's setting. Any web service I can use? I know there will be some delay accessing the time via web service, but I am fine with something that is not accurate to the last millisecond. ...

RegEx not working with look-aheads!

Hey guys, I am trying to match "address" in this page - http://www.bbb.org/norfolk/business-reviews/tax-return-preparation/liberty-tax-service-in-virginia-beach-va-48000604 The source of address part has this HTML <tr> <td align="right" class="generalinfo_left">Address:</td> <td class="generalinfo_right">1 S Main St Ste 1430<b...

Help with exploding a name in PHP and writing back into a .CSV file

I wrote the code below to split up a fullname from a .csv file into a first name, middle name, and last name. It works well and gives the following kind of output: Eric,T.,Nolan Mary,,Worth Jim,T.,Lane E.,Thomas,Powell William,Reilly,Smith Johnny,,Depp Stevie,de,la Soul I can get it to print to the screen, but need help putting it b...

Short URL Outbound Link Tracking in PHP and MySQL

I have a site that shortens links based on Noah Hendrix's tutorial on the subject. I decided that it would be great if I could track when users click the short URLs, similar to the way that HootSuite users can track their links with Ow.ly. I currently have a database which has the short URL stored along with the true URL and it's click...

PHP - How to allow only one email address and check for the @ sign to validate the email address?

I was wondering how do I allow only one email address? Also how can I only check for the @ sign in the email address to validate the email? Here is my PHP code. if (isset($_GET['email']) && strlen($_GET['email']) <= 255) { $email = mysqli_real_escape_string($mysqli, strip_tags($_GET['email'])); } else if($_GET['email'] && strlen($_...