samedi 27 juin 2015

Postgre user without password and PHP

I have a PostgreSQL database with a user and a database owned by that user. A local program written in C uses that user to manipulate that database without a password. I want to use HTML and PHP to create a web interface to access that database.

I've read conflicting things about PostgreSQL and using it without passwords. I also don't want to interfere with the way the current software is accessing and manipulating the database without a password.

Do I simply add a password for that user to use as log-in information for the PHP queries? Is there a better way to securely access that database through PHP?

When to use RDS service in amazon? I have mysql installed in ec2 instance

I have a dynamic website and I need to migrate to AWS. I am new to AWS and linux. I have a doubt while setting the environment. I have installed Mysql,Phpmyadmin separately.

I have the following questions :

  1. How to connect this installed Mysql with this installed Phpmyadmin ? How to access Phpmyadmin through browser in aws.
  2. Why do we need RDS then? Do I really need RDS instance?

Please help me..

Trying to use Path API but failing to deal with access token

I want to use the Path Api, what is the right URL to get access_token ?http://ift.tt/1eRoGH6

if else condition in htaccess for for admin and frontend in open cart?

i have .htaccess in which i want 301 redirect.So when I add 301 redirect code in .htaccess it works fine but i can not login to my backend.But if I remove this code it works fine.I just want it to work in frontend but now because of this code my I cannot login into backend.

Here is the CODE

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://ift.tt/VAk5HC [L,R=301,NC]

now i want if else condition or something which helps me to solve this error which works only for frontend of my open cart site and admin remains as it is without redirection.

Remove duplicates from PHP array but ignoring one parameter

I have an array comprised of PHP objects as such.

$objects[0] => $object->type => 'President'
               $object->name => 'Joe Blogs'
               $object->address => '123 Harry Street'

$objects[1] => $object->type => 'Secretary'
               $object->name => 'Joe Blogs'
               $object->address => '123 Harry Street'

$objects[2] => $object->type => 'Treasurer'
               $object->name => 'Jane Doe'
               $object->address => '456 Upton Street'

I would like to ignore the 'type' parameter and end up with

$objects[0] => $object->type => 'President'
               $object->name => 'Joe Blogs'
               $object->address => '123 Harry Street'

$objects[2] => $object->type => 'Treasurer'
               $object->name => 'Jane Doe'
               $object->address => '456 Upton Street'

I have tried a few difrent things one of which was to unset the parameter "type using a foreach loop and then trying to reset it but I wasn't sure how to tie the two indexes together to reset them. Another was trying to use the union in the select command but that wasn't working 100% correctly either.

I am just not sure how to best manage the type parameter

group_concat only display's one column?

I have a database structure like so

 Car
 - id   
 - carname
 - image
 - category
 - status

Parts
 - partid
 - partname

CarParts
 - carpartid
 - carid(fk)
 - partid(fk)
 - amountid(fk)

Category
 - id
 - categoryname

Amount
 - amountid
 - amountvalue

and here is my query:

SELECT group_concat(parts.partname) as parts FROM car left join  carparts on car.id = carparts.carpartid 
left join  parts on parts.partid = carparts.carpartid
left join amount on amount.amountid = carparts.amountid where status = 1
group by car.id

but this only display parts and nothing else i want

  • carname
  • image
  • category
  • status

PHP code inside Laravel 5 Blade Template

I have to place some PHP code inside Laravel 5 Blade Template. Like below

@foreach ($farmer->tasks as $task)
    @if ($task->pivot->due_at) < date(now))
        $style = 'alert alert-danger';
    @elseif ($task->pivot->due_at) > date(now))
        $style = 'alert alert-success';
    @else
        $style = '';
    @endif
@endforeach

Which is the actual procedure to place PHP code inside Laravel 5 Blade Template ??