Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x

PHP

118K

Solutions

32K

Contributors

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

Share tech news, updates, or what's on your mind.

Sign up to Post

Most of Companies want a person who have 2 years experience.and Why they want experience or in 2 years what we learn.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE
LVL 4
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Hi

My latest blog is finished.
It is a musicians' upload blog, with a general theme/topic for discussion, and quarterly contests for a user-made topical video for five or some thousand dollars.

Is this a potential hornet's nest? lots of legal risk ? What are the hornets?

Thanks
0
How can I remove the button and make it that if $_POST['a'] == 1
Then display the pop up? else dont? Is this possible?

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Modal Header</h4>
      </div>
      <div class="modal-body">
        <p>Some text in the modal.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>

Open in new window

0
I have the following mysql query which find duplicate urls in Magento 1. I would like to run an update query which will add a unique value onto the end of any duplicate urls ('value' in the query), probably just -1, -2, -3 etc for each duplicate it finds.

Could someone advise on how to do?

SELECT COUNT(DISTINCT entity_id) AS amount, `value`, entity_id FROM catalog_product_entity_varchar v WHERE EXISTS ( SELECT * FROM eav_attribute a WHERE attribute_code = "url_key" AND v.attribute_id = a.attribute_id AND EXISTS ( SELECT * FROM eav_entity_type e WHERE entity_type_code = "catalog_product" AND a.entity_type_id = e.entity_type_id ) ) GROUP BY v.VALUE HAVING `amount` > 1 ORDER BY `amount` DESC

Open in new window

0
I have a PDO prepared Insert statement.
	$dbh->bindParam(1,  $_POST['FirstName']);
$dbh->bindParam(2,  $_POST['LastName']);

Open in new window


If the fields are blank or not there , it's coming through blank.

Is there a way to change the prepared statement, if it's blank, it should keep it NULL?
Also, if the information coming through is too long for the field, it errors and fails the insert.
Is there a way to ask it to just cut off at the extra characters instead of failling?
0
how to generate qr code and scan qr code in PHP
0
Hi Experts.

I'm having trouble configuring Flume to stream data from a website to my HDFS. As some tutorial i've read on the Internet such as TutorialPoint, Hadoop Pravendees... They all have the same example that stream data from Twitter to HDFS using Twitter Apps API.

Is there any source code PHP, Java or ASP.NET to do this without getting token like that example? The thing i want to do is setup an Agent in the website i want to get data and have data stream to my HDFS architecture.

Thanks for reading this, best regards.
0
Hi,

When entering a POST in Wordpress, you can enter Categories a particular post is related too (see screen shot).

Screen shot showing Categories in Wordpress
Where is the information stored?

Using WP_Query, I can retrieve the information in a PHP plugin, but I like to retrieve it via SQL directly from the MYSQL database. I looked for it in WP_POSTS and WP_POSTMETA and could not identify anything.

Thank you
0
I have the following code that  the Elements on line 4 assigns results to all rows not just the matching resource_id.  How do I limit that column to only records that match resource.id=Elements.resource_id?  

SELECT CONCAT(p.key_tag,"-",r.resource_num) AS KeyTag, 
CONCAT(p.address_number," ",p.address_street) AS address, 
CASE WHEN p.suite IS NULL THEN p.address_number ELSE CONCAT(p.address_number,p.suite) END AS PropCode,
(SELECT GROUP_CONCAT(element_type_id) FROM elements GROUP BY resource_id) AS Elements, 
r.assignedto,
r.assigneddate
FROM property p
LEFT JOIN resource r ON r.property_id=p.id
ORDER BY p.key_tag,r.resource_num

Open in new window

0
How do I fix this error and structure this code correctly?

Warning: Cannot modify header information - headers already sent by (output started at index.php:3) in index.php on line 32

<?php

//collection of allowed IP addresses
$allowlist = array(
    'xxx.x.xxx.xx',
    'xxx.x.xxx.xx',
    'xxx.x.xxx.xx',
);

//if users IP is not in allowed list kill the script
if(!in_array($_SERVER['REMOTE_ADDR'],$allowlist)){
    die('Sorry, you do not have access to this page.');
}

?>


<?php

	$str_apl = 'Calls';
	if(is_file("_lib/friendly_url/" . $str_apl . '_ini.txt'))
	{
		$str_apl = file_get_contents("_lib/friendly_url/" . $str_apl . '_ini.txt');
	}
	else
	{
		$str_apl = $str_apl . '/';
	}
    header("Location: " . $str_apl);

?>

Open in new window

0
Tech or Treat!
LVL 10
Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

I've googled this but I have yet to find an answer that makes sense.

Here's what I've got:

<?php
$terms=array(
	array("snare"=>"piccolo", "tom"=>"ride", "bass"=>"kick"),
);
array_push($terms, $terms['throne']="hydraulic");

foreach($terms as $drum)
{
	echo $drum['snare'];
	echo "<br>";
        echo $drum['tom'];
	echo "<br>";
        echo $drum['bass'];
	echo "<br>";
        echo $drum['throne'];
	echo "<br>";
}
?>

Open in new window


I want to add a value to my array. In the end, when I loop through everything, I want it to look like this:

piccolo
ride
kick
hydraulic

Instead, I get this:

piccolo
ride
kick


Warning: Illegal string offset 'snare' in /home/content/09/6568309/html/adm/array_merge.php on line 14
h

Warning: Illegal string offset 'tom' in /home/content/09/6568309/html/adm/array_merge.php on line 16
h

Warning: Illegal string offset 'bass' in /home/content/09/6568309/html/adm/array_merge.php on line 18
h

Warning: Illegal string offset 'throne' in /home/content/09/6568309/html/adm/array_merge.php on line 20
h

Warning: Illegal string offset 'snare' in /home/content/09/6568309/html/adm/array_merge.php on line 14
h

Warning: Illegal string offset 'tom' in /home/content/09/6568309/html/adm/array_merge.php on line 16
h

Warning: Illegal string offset 'bass' in /home/content/09/6568309/html/adm/array_merge.php on line 18
h

Warning: Illegal string offset 'throne' in /home/content/09/6568309/html/adm/array_merge.php on line 20
h

What am I doing wrong?

Thanks!
0
Can someone please help me and explain why this  script isn't  working properly? It does what i want which gets the latest image filename as a string. I then match the string to see if it contains the same serial number as an image folder and import into the image folder if it does. It imports into the correct folder fine, but also gets imported into the root directory of the image folder? An the code if statement code is echo'd twice!

<?php
$imagesDir = '/Pictures/irrigation/';
$images = glob($imagesDir . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);
array_multisort(array_map('filemtime', $images), SORT_NUMERIC, SORT_DESC, $images);
$latestimage = $images[0]; 

//print($latestimage);

$path = 'images/';
$results = scandir($path);
$folder = array_diff($results, array('.', '..'));

//var_dump($folder);


foreach ($results as $folder) {
    //if (strstr($string, $url)) {
    if (strpos($latestimage, $folder) !== FALSE) { 
      
       $file = basename($latestimage);
$dest = "images/$folder/$file"; 
          
        if (copy($latestimage, $dest)){

    echo '<strong>copied!!</strong>';
} else {
    echo "<strong>didn't copy :(<strong>";
}
        
     
    }
}

?>

Open in new window

0
Need someone to show me how to properly make good use of  phpunit testing
0
I have a file management app that I can upload smaller files to the server with no problem. I tried to upload a 45MB and I get the following error. Those numbers don't even add up. How can I resolve this?

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 94601573 bytes) in /home/glennstewart7/public_html/fm2/dirlist.php on line 202

The memory_limit is set to 120M
The Max Upload and Post size is set to 120
Max_Input time is -1 which  means no limit.
0
I have data in the wp_postmeta table in a field named _product_addons.  I'm not sure what the format of the data is, but it is the below:

a:1:{
    i:0;a:6:{
        s:4:"name";s:8:"Warranty";s:11:"description";s:35:"323.tv includes a one year warranty";s:4:"type";s:6:"select";s:8:"position";i:0;s:7:"options";a:3:{
            i:0;a:4:{
                s:5:"label";s:60:"1 Year Limited Warranty Included";s:5:"price";s:1:"0";s:3:"min";s:0:"";s:3:"max";s:0:"";
            }i:1;a:4:{
                s:5:"label";s:30:"2 Year Limited Warranty";s:5:"price";s:3:"600";s:3:"min";s:0:"";s:3:"max";s:0:"";
            }i:2;a:4:{
                s:5:"label";s:30:"3 Year Limited Warranty";s:5:"price";s:3:"900";s:3:"min";s:0:"";s:3:"max";s:0:"";
            }
        }
        s:8:"required";i:1;
    }
}

Open in new window


I need to update the highlighted areas so that if the label is "1 Year Limited Warranty Included" it sets the circled area to s:1:"1" then if "2 Year Limited Warranty" it sets circled area to s:1:"2"

Circled Fields
I need to do an update on this field across 500 products, so manually isn't ideal. Can I write a database update or php script that will do the work for me?
0
Hi guys, i was wondering what is the best way to remove dates from all posts

You can see the date here


http://mediastreet.ie/interview/mediastreet-interview-ciaran-cunningham-ceo-carat-media/
0
Dear Experts,
I need to post the location ( lat and lng) variable to another page to save it.
how can I write the variable inside hidden input?
I use HTML5 and PHP.  My code is below

Thank you


<script>
      // Note: This example requires that you consent to location sharing when
      // prompted by your browser. If you see the error "The Geolocation service
      // failed.", it means you probably did not give permission for the browser to
      // locate you.
      var map, infoWindow;
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 6
        });
        infoWindow = new google.maps.InfoWindow;

        // Try HTML5 geolocation.
        if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(function(position) {
            var pos = {
              lat: position.coords.latitude,
              lng: position.coords.longitude
            };

            infoWindow.setPosition(pos);
            infoWindow.setContent('Location found.');
            infoWindow.open(map);
            map.setCenter(pos);
          }, function() {
            handleLocationError(true, infoWindow, map.getCenter());
          });
        } else {
          // Browser doesn't support Geolocation
          handleLocationError(false, infoWindow, map.getCenter());
        }
      }

      function handleLocationError(browserHasGeolocation, infoWindow, 

Open in new window

0
Hello Experts,

I am using the php mail function on many forms. On this specific one I need to attach a pdf document to the sender.
After searching the NET I came with this code below... But the received PDF file is ZERO KB.  Hopping someone can track the bug?

// to kontakt
    
    $mail_to = $validEmail;
    $from_mail = "info@company.com";
    $from_name = "The company";
    $reply_to = $from_mail;
    $subject = "Your PDF";
    $message = "Thank you testing";
    
    /* Attachment File */
    $file_name = "testing file name";
    $path = "http:/companydomain.com/doc/test.pdf";
    
    // Read the file content
    $file = $path.$file_name;
    $file_size = filesize($file);
    $handle = fopen($file, "r");
    $content = fread($handle, $file_size);
    fclose($handle);
    $content = chunk_split(base64_encode($content));
    
    /* Set the email header */
    // Generate a boundary
    $boundary = md5(uniqid(time()));
    
    $header = "From: ".$from_name." \r\n";
    $header .= "Reply-To: ".$reply_to."\r\n";
    $header .= "MIME-Version: 1.0\r\n";
    
    // Multipart wraps the Email Content and Attachment
    $header .= "Content-Type: multipart/mixed;\r\n";
    $header .= " boundary=\"".$boundary."\"";
    
    // Email content
    // Content-type can be text/plain or text/html
    $message .= "This is a multi-part message in MIME format.\r\n\r\n";
    $message .= "--".$boundary."\r\n";
    
    // Attachment
    // Edit content type for different file 

Open in new window

0
Can anyone tell me where the domain name checker function is located in WHMCS and what its called?? I just want to add a jQuery function to it to make the page scroll down to the results.

Screen-Shot-2017-10-15-at-18.16.39.png
Here is the url : https://crazyhost.co.uk/account/cart.php?a=add&pid=1
0
[Webinar] Lessons on Recovering from Petya
LVL 10
[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Hi guys,

I am having some trouble with my jQuery scroll function, Basically it works however, Only after the second time you click the button

You can see an example here : https://crazyhost.co.uk/account/cart.php?a=add&pid=1

I want it to start the domain name search and scroll down at the same time on the 1st click.

I am using WHMCS so Im not 100% sure if its calling the domain name check function on the 1st click then the scroll on the second click??

any suggestions is highly appreciated, Thanks.
0
Hi,

I have this code which inserts a new record to my SQL table 'stednavne'. The code works fine, but I need to add a check that the record I try to add does already exist en the database and a corresponding message.

What I want to check is if the input in the formfields named 'stednavn' and 'amt' exists in the table columns named Stednavn and Amt. If they do I need a message telling that the place exists, and if not I want the INSERT code to be executed.

I'm sure that I need to run a while-loop here, but I need a little help to create it with the right syntax.  

I hope that someone can help me with that :)

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Start the session
session_start();

// Prevent direct access to the script
if (!isset($_POST['stednavn'])) die("Access Denied!");


    
    $link = mysqli_connect("db credentials");
    $link->set_charset("utf8");
 
// Check connection
    if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}

        $sqlStr = sprintf("INSERT INTO stednavne (id, Stednavn, Sogn, Herred, Amt, Kort ) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", $_POST['id'], $_POST['stednavn'], $_POST['sogn'], $_POST['herred'], $_POST['amt'], $_POST['kort']);
        //$link->query($sqlStr);

        $message = "Data er opdateret";

        //var_dump ($_POST);


// Let's generate a response
$response = array(
   "success" => $link->query($sqlStr),
    "message" => $message
);

// Let's 

Open in new window

0
Hi

At the bottom of my humanity changing blog, it says ' © 2017 YOUR COMPANY.  DESIGNED BY THEMEUM'

Can I annihilate this and put my privacy policy link there? or just above it?

not sure

Thanks
0
I have a simple form where a user fills in a few text fields. There is also a button which when pressed, launches a modal with images in it. The user can select multiple images and then close the modal. The image names are stored with HTML 5 local storage.

The user should be able to then submit the form with the text fields inserting into one database table, and the image names inserted into another table. The issue I am having is with the foreach loop when inserting the image names. I think that the issue may be the way in which the image names are sent via ajax and the format in which they are sent.

This code displays the images and after selecting and clicking the submit button for the image modal, the names are stored in local storage and outputted on the screen.

$(function () {
        $.get('t2637.php', function (resp) {
            $('#gallery').html(resp);
        });
        $('#gallery').on('click', 'img-box', function (i, e) {
            $(e).toggleClass('selected');
        });
        $(".btn-danger").on("click", function (e) {
            e.preventDefault();
            var form = $("#imgs").serialize();
            $.ajax({
                    url: 'reflect.php',
                    type: 'POST',
                    data: form,
                })
                .done(function (data) {
                    localStorage.setItem("picnames", data);
                    $("#filenames").empty().append(localStorage.getItem("picnames"));
                

Open in new window

0
Need a simple tech guys for a real estate project with web services with mls data  And wordpress
0
 
LVL 7

Expert Comment

by:Brian Matis
Hi Jeff! If you're looking to get help with a short-time, one-off project, I'd recommend checking out the Gigs feature here on Experts Exchange. If it's more of a long-term hire, then take a look at Careers. Best wishes!
1
I have a username and password for the real estates agent theysaid I have to call the web service and get a response but
How can I integrate to my theme in wordpress if u want to help me will be good or I can hire you too but I like to learn anny I wait for your answer guys thank you
0

PHP

118K

Solutions

32K

Contributors

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.