why PHP results in HTML are not defined when using JavaScript

I need to get the IP of the client. I am able to get it through PHP variable "$_SERVER['REMOTE_ADDR']". I get this ip from server side php to html page through AJAX request but when I want to use this IP value in JavaScript it is showing that th

Illuminate the result of eloquent manipulation

In Eloquent 5.2.7 I was able to add to the result set using foreach($page as $xp => $xv) { $content[0]->{$xp} = $xv; } Where $content was a DB::table()->get() result. Now, on the latest version I get the following errors: Indirect modification of

Unable to send links in the email after setting the header

I am not able send links in email. I am using wp_mail() function to send email. When i set header $headers .= "Content-Type: text/html; \r\n"; this header removes href attribute in received email. i am using wp_editor for textarea. I also tried

How can I customize category pages in Wordpress?

I'm creating a blog with wordpress, I'm using the DIVI theme and I need to change the appearance of the category pages of the blog... what's the easiest way to do that? I understood I should look for category.php in the editor and create a new php fi

Yii, Yiimailer does not send the mail (no error displayed)

i'm trying to send a mail. i want to use Gmail server to send, for now i just want it to send to the same account from its being sent. i'm using YiiMailer extension because it seems to be easy to use, this is the action i have in my controller: publi

Nginx + php-fpm on Amazon Linux = output on the signal 11

Amazon Linux lastest PHP 5.4.19 (cli) (built: Sep 3 2013 23:19:23) nginx version: nginx/1.2.9 installed PHP-FPM: PHP 5.4.19 (fpm-fcgi) (built: Sep 3 2013 23:22:01) phpinfo() is working pma.nginx.conf: server { listen 80; server_name pma.my.server; ro

Show the warning area when submitting the form

So I have these two pages: pageOne.php and pageTwo.php.The form is in pageOne.php: <form method="post" action="pageTwo.php"> .... </form> and doing all the data collection-validation-insertion and sending out mails in pageT

Manual rendering of Zend_View with the layout enabled

I'm creating a mail service within my application that has the body of the email stored in the database prior to sending it out to recipients. Each mail body is a partial view script that has the necessary parameters injected into it via Zend_View. W

Scala Lift - Run PHP file since scala run

I'm not entirely sure the wording for the title is correct, but what I'm attempting to do is run and execute PHP files from within the Lift framework. I'm not after any url queries to a PHP file residing on a server, more interested in somehow gettin

PHP: preg_replace (), `e`-modifier and object

I'm writing a method which returns an function argument by its number. protected function parseArgs($str, $args) { return preg_replace('|#(\d)|e', '$args[\\1 - 1]', $str); } $str - a string with '#N' where N is a number of argument $args - array of a

Dynamic radio buttons, different with unlimited names

I am doing a form that displays the questions and answers in a database and now I need to save the answers marked by the user. I need a name for each RadioButton or select dropdown. PROBLEM: I combine php and html and i don't know how to pass the rad

Do you want to retrieve unread emails from Gmail?

I want to know that how can i fetch unread emails from gmail account. I have a gmail account i want that all the unread emails from gmail accounts are coming to my site though php. I have been implementing various codes but they are not helping me. P

How to reduce the number of IF statements?

I have many IF sentences that each start a function. Is there an obvious way to write this code much simpler? Every IF starts different function, but it still looks like an overkill. if ($this->machine == '' AND $this->date_from == '' AND $this->

Zend framework management error with ACL

I have implemented database driven ACL functionality using controller plugin predispatch() function. It's working fine. But it stopped requests to be sent on my error controller. for example if specified controller / Action is not defined then system

Can PHP foreach have if / else inside?

I am doing an OpenCart modification to an order total. This is the snippet of the code: <?php foreach ($data['totals'] as $total) { if ( $this->db->escape($total['code'])=="sub_total" || $this->db->escape($total['title'])="Su

Form submission using $ _SESSION data - safer / correct method?

I currently have a form that has a hidden form field, populated based on a variable in the user's session. A function is called when this form is submitted, which processes the form, and this hidden variable is pretty important to it. Is it better to

mysql query for both distinct and sum

I have a mysql fields like this: url_id time_spent ------- ---------- 120 14 120 97 120 14 120 97 I want to display only 14 and 97 based on url_id(DISTINCT). select * from table group by url_id,time_spent

Build a flat table from CSV files

I have 500 CSV files in this format: IndicatorA_Name.csv 1900 1901 1902 ... Norway 3 2 Sweden 1 3 3 Denmark 5 2 3 ... IndicatorB_Name.csv 1900 1901 1902 ... Norway 1 3 4 Sweden 1 2 Iceland 1 6 3 ... Years in columns, countries in rows. Notice that co

How to structure a PHP service that responds to Ajax requests

I'm struggling to design the server-side script that responds to requests from an Ajax application. In its current state, the app is divided into discrete pages (e.g., Orders, Items, Finances, etc.). Only when you switch between these pages does the

Adding tasks to the Windows scheduler with PHP

I'm unable to find any information on adding tasks to Windows Task Scheduler with PHP. I can use exec(). This has to work on IIS.Windows Schedule Task has a command line utility called Schtasks you can use this utility to add your task to Scheduled t

Deleting redundant line breaks with regular expressions

I'm developing a single serving site in PHP that simply displays messages that are posted by visitors (ideally surrounding the topic of the website). Anyone can post up to three messages an hour. Since the website will only be one page, I'd like to c

Zend Framework: How to get the default param?

How do I get the 'default' param if not specified? Consider the following: http://localhost/controller/action/id/123 In my controller, I can get the value of 'id' using $request = $this->getRequest(); $id = $request->getParam('id'); If the URL is ht

benefits of & ldquo; HTTP authentication with PHP & rdquo;

what are the benefits of using HTTP authentication with PHP (HTTP 401 headers) instead of using a normal form submit authentication??From security perspective, both the form based and HTTP Basic Access Authentication use plain text for sending the au