PHP

120K

Solutions

33K

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

I have a simple form that posts to a page that process the information and inserts it into a database table.
for some reason some of my people are coming through duplicated exactly .

After much narrowing down the problem, and tracking the browser in the table, I see it's only happening in chrome. all other browsers are coming through once.

i looked in the network tab and the page is only being called once.
i put a die(); right after the insert so make sure it's not doing anything else, and the page stops, but I still get 2 inserts

What else might this be?  My page was working fine for months, and suddenly last week this just started.
 try {

    $dbh = $conn->prepare("INSERT INTO dbo.[ ... ] ( ........) VALUES (?, ?,?,?,?,?, ?,,?)");
	$dbh->bindParam(1,  $firstname);
    $dbh->bindParam(2,  $lastname);
    $dbh->bindParam(3,  $address);
    $dbh->bindParam(4, $_POST['city']);
.....
	

 
	 $dbh->execute();
 			}

			//catch exception
			catch(Exception $e) {
		var_dump($e);
			}
die();

Open in new window

0
CompTIA Network+
LVL 13
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

So I buld dynamic websites. As CMS I use something I have built by myself because I wanted to offer something very simple and easy to use to my client: they are small clent and they can't spend time to learn how to use Wordpress, OpenCart or other complex CMS. They just have to add, delete and modify some products data, or even just add some news to publish in the homepage.
So I have developed my own CMS. My problem is that I always work on it to improve it and everytime I change somewthing I have to manually upload changed files to the clients websites in order to always be sure I have the same code running in the various Control Panels.

As you guess, this becomes soon a crazy task, subject to errors and confusion. I would like to automate this process but I'm not sure how to do it.

Let me say that the develpment version of the code uses Git as Version control system. I also have to specify that between the various versions of the Control Panel, only one file is specific to that specific client, a configuration file in json format which my classes read to do the various tasks.

This config files holds specific settings and many times, as I improve the doce and some new features, the config file itself needs to be changed and I have some doubt this can be automated because here I need to preserve orginal specifi settings whil I add new sections with new settings and their default values.

So I think I could manually update only this file, but how can I make the …
1
Hi,

I am working on this page:
https://kroweb.dk/gfdev/gravsten_pk/gravsten/

At the top od my index.php file I have these lines:
<?php
session_start();
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>

<?php
$link = mysqli_connect("mysql60.unoeuro.com", "kroweb_dk", "passsword", "kroweb_dk_db_gravsten");
$link->set_charset("utf8");
 
// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}

$id = $_GET[ 'id' ];
$sql = "SELECT id, Sogn, Stift, Provsti, navn, tlf, email, besked FROM gravsten WHERE id = $id"; 
$result = $link->query($sql);
$row = $result->fetch_object();
?>

Open in new window


But when entering the page I get this error message, which I can't figure out how to fix:

Notice: Undefined index: id in /var/www/kroweb.dk/public_html/gfdev/gravsten_pk/gravsten/index.php on line 16

Fatal error: Uncaught Error: Call to a member function fetch_object() on boolean in /var/www/kroweb.dk/public_html/gfdev/gravsten_pk/gravsten/index.php:19 Stack trace: #0 {main} thrown in /var/www/kroweb.dk/public_html/gfdev/gravsten_pk/gravsten/index.php on line 19.

Hope that somebody can lend me a hand with this :)
0
Dear Experts,
I use PHP and https on my web site

I need your opinion on how to securely pass credit card information between two pages in PHP?

thank you in advance.
0
Dear Experts,
I use PHP 7.2
I create variable as $headers to put inside the autorization information.
I connect a server which use Auth2 when ever I need it. When I got the Authorization code I insert it into database so that I can use it without calling it every time I need it. The authoraization code lives 30 minutes.
 
I select it from my database assign the password $myvariable so that I can use it efficiently.

However, it doesn't work inside the header variable. When I write the authorization code instead of $myvariable it works.
could you help me out? thank you

//it doesn't work like this. When I remove $myvariable and put the same information instead, it works.
$headers = ['Content-Type: application/json','Authorization: Autotype' . $myvariable.  " ' "];
0
I have this code to create a zip file.

$path = "zips/z" . $pid . ".zip";
$dels = array();
$nd = 0;
if ($zip->open($path, ZipArchive::CREATE) === TRUE)
{
    // Add files to the zip file
	for ($i = 0; $i < $ns; $i++) {
		$typ = substr($fs[$i],0,2);
		if($typ == "NP" || $typ == "NT" || $typ == "RU" || $typ == "TR") {
			$dels[$nd] = $fs[$i];
			$nd++;
			$str = "../pselsumms/" . $fs[$i];
			$ctfile = "temp/" . $fs[$i];
			copy ($str, $ctfile);
			$zip->addFile($ctfile);
		} else {
			$zip->addFile($fs[$i]);
		}	
    }
    // All files are added, so close the zip file.
    $zip->close();
	// delete temp files here
	/*if ($nd != 0) {
		for ($j = 0; $j < $nd; $j++) {
			$dfile = "temp/" . $dels[$i];
			unlink ($dfile);
		}	*/
	// download
	header('Content-type: application/force-download'); 
    header('Content-Transfer-Encoding: Binary'); 
    header('Content-length: ' . filesize($path)); 
    header('Content-disposition: attachment; filename=' . basename($path)); 
    readfile($path);
}

Open in new window


It appears to work fine, except when the name of the zip file already exists (from an earlier time).

For example, if $pid is 3512 and file zips/z3512.zip already exists, it does not overwrite the existing file, it just changes the date, but the content is as before, NOT the new content. I could of course write code to insure a unique name, based on what is already there, but why is that necessary.

FYI, I tried php unlink on the file, no dice, same thing happens.

Thanks
0
I have this php code.

<?php
include "db_connect_nb.php";
$pid = $_GET['pid'];
//echo "pid = " . $pid . "<br>";
$str = $_GET['str'];
echo "str = " . $str . "<br>";
$files = explode("~", $_GET['str']);
$nf = count($files);

// get rid of dupes
$fs = array();
$ns = 0;
for ($i = 0; $i < $nf; $i++) {
	echo "files " . $i . " = " . $files[$i] . "<br>";
	if ($files[$i] != "doc_files/" ) {
		if ($ns == 0) {
			$fs[0] = $files[0];
			$ns++;
		} else {
			$found = false;
			for ($j = 0; $j < $ns; $j++) {
				if ($files[$i] == $fs[$j]) {
					$found = true;
					break;
				}
			}
			if (!$found) {
				$fs[$ns] = $files[$i];
				$ns++;
			}
		}
	}
}
for($i = 0; $i < $ns; $i++) {
	echo "files = " . $fs[$i] . "<br>";
}

Open in new window


There is some more beyond that, I can't see they are relevant.

All the echos are to determine why an incoming file in $_GET['str'] that is equal to "doc_files/" is not deleted by the second loop.

See attached for output. Some how one of these gets through & screws up everything after that.

Thanks
0
Hello everyone !

I ask for your help concerning a javascript script.
I do not really know myself and I am faced with a delicate situation.

So here I have a page that contains this piece of code :
function CALCUL_PRIX_DLVR() {
    var c_Weig = $('#Poidt').html();
    var c_Deli = $('#Dlvry').html();
    var c_Zone = $('#Zones').html();
    var c_Table;
    switch (c_Deli) {
        case "SIVOP":
            c_Table = null;
            break;
        case "DHL":
            c_Table = "tb_shop_prices_dhl";
            break;
        case "LA POSTE":
            c_Table = "tb_shop_prices_laposte";
            break;
        default:
            c_Table = null;
            break;
    }
    var data = {
        c_Weig: c_Weig,
        c_Deli: c_Deli,
        c_Table: c_Table,
        c_Zone: c_Zone
    };
    $.ajax({
            type: "POST",
            url: "_shop-calcul.php",
            cache: false,
            data: data,
            async: true,
            dataType: "json"
        })
        .done(function(reponse) {
            var erreur = typeof(reponse.Error) != 'undefined' ? reponse.Error : null;
            var result = typeof(reponse.success) != 'undefined' ? reponse.success : null;
            if (!erreur) {
                if (result != null) {
                    console.log('Resultat', result);
                    var v = "";
                    $.each(result, function(i, vx) {
                        $.each(vx, function(colonne, valeur) {
        

Open in new window

0
Dear Experts,

{"ReturnData":"PT0001 : ","ReturnCode":1,"junks":[{"VirtualId":54,"junkCode":"015","Name":".... ...","paymentSets":[{"InstalmentAmount":0.0,"InstalmentNo":1,"TransactionType":"one","BankCode":"015","CommissionAmount":0.0,"CommissionRate":0.69,"CommissionfId":064,"Amount":0.0,"TransactionAmount":0.0},{"InstalmentAmount":0.0,"InstalmentNo":2,"TransactionType":"two","BankCode":"015","CommissionAmount":0.0,"CommissionRate":0.78,"CommissionfId":068,"Amount":0.0,"TransactionAmount":0.0}]}],"products":null,"transactions":null}

$book = json_decode($result);

Open in new window


I got the paymentSets details like below.

$firstAmount = $book->banks[0]->paymentSets[0]->InstalmentAmount;

However I want to use foreach loop to show them all on the page.

if($book) {
  foreach($book->banks->paymentSets as $product) {
    echo "InstalmentAmount: {$product->InstalmentAmount}<br>";
    echo "InstalmentNo: {$product->InstalmentNo}<br>";
  }
}

Open in new window


I tried it like this, but it didn't work.
what do you suggest I should do?
0
Dear Experts,
the below code, it works perfectly fine,

$xmlDATA = '<?xml version="1.0" encoding="utf-8"?><VposResponse><MerchantId>000000000125427</MerchantId><TransactionType>Sale</TransactionType></VposResponse>';

$xml = simplexml_load_string($xmlDATA);

echo $MerchantId = $xml->MerchantId;
echo "<br><br>";
echo $TransactionType = $xml->TransactionType;

Open in new window


however it doesn't work, altough it is the same data.

 $xmlDATA = htmlentities($_POST["BankResponse"]);


$xml = simplexml_load_string($xmlDATA);

echo "MerchantId :" .  $MerchantId = $xml->MerchantId;
echo "<br><br>";
echo "TransactionType :" . $TransactionType = $xml->TransactionType;

Open in new window


I don't understand why it is not working. what do you suggest I should do?
0
Rowby Goren Makes an Impact on Screen and Online
LVL 13
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Dear Experts,
Some results are being posted to my page,
I got the results like below.
$raw = file_get_contents('php://input');

var_dump ($raw);
With this I saw the raw input.

I got the results like this and it works,
echo "MLGOCode: " . $_POST["MLGOCode"];

however when I get KLPWResponse  the most part of the data is missing.

How can I decode below input? thank you

$raw= "MLGOCode=7335&ResponseCode=0000&KLPWResponse=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F&CVResponse&CMerchantId%3E000000000156777%3C%2FMerchantId&CLPOType%3ESale%3C%2FLPOType&CLPOId%3ETOYTR203%3C%2FLPOId&CResultCode%3E0000%3C%2FResultCode&CResultDetail%3E%C4%B0%C5%9ELEM+BA%C5%9gulnbvf%3C%2FResultDetail&CInstallmentTable+%2F&CCampaignResult+%2F&CMLGOCode%3E734637%3C%2FMLGOCode&CHostDate%3E20190315082437%3C%2FHostDate&CRrn%3E000696354522%3C%2FRrn&CTerminalNo%3EVP124287%3C%2FTerminalNo&CSDFA%3E4.11%3C%2FSDFA&CSDFACode%3E949%3C%2FSDFACode&CECI%3E05%3C%2FECI&CThreeDSecureType%3E2%3C%2FThreeDSecureType&CLPODeviceSource%3E0%3C%2FLPODeviceSource&CBatchNo%3E704%3C%2FBatchNo&CTL%3E4.11%3C%2FTL&C%2FVposResponse%3E&KLPWMessage=&HostRefNum=&KLPWTransId=&ClientReferenceCode=413252&HostKey=&InternalMessage=%C4%B0%C5%9Flem+Ba%C5%9Far%C4%B1l%C4%B1&IsSuccess=True&ReferenceCode=TOYTR203"

Open in new window

0
I'm working through a tutorial on Node where I've got an MCV architecture going on.

This is the relevant piece of my Controller:

const Product = require("../models/product");

exports.postAddProduct = (req, res, next) => {
  const product = new Product(req.body.title); // right here I'm establishing a new instance of my Product class and I'm passing a variable into that class that's coming from my form
  product.save();
  res.redirect("/");
};

Open in new window


This is the relevant portion of my Model:

const products = [];

module.exports = class Product {
  constructor(title) {
    this.title = title;
  }

  save() {
    products.push(this);
  }

Open in new window


What you see works and there's nothing about it that's especially confusing, but I did have a question.

When I saw this syntax, I was able to understand its logic based on my experience with PHP, as far as creating an instance of a class and having a constructor sitting at the top of that class.

All good.

But that I started looking at it a little bit closer and noticed that I was passing a variable into a class.

You don't do that with PHP do you?

I know that's a bizarre question, but when I think of constructors in PHP, I'm thinking of defining some properties and the attaching values to those properties that I can then access throughout my class depending on their visibility.

But do you  / can you pass variables into a class in PHP?

There you go! A random question to kick off your Thursday morning...
0
Dear Experts,
I get the result like this from an API. I use PHP 7.2

How can I get the object inside an array in PHP?

[InternalMessage] => somoething [IsSuccess] => 1 [ReferenceCode] => 12345  ) ) ) 
object(stdClass)#1 (5) { ["lpo"]=> bool(true) ["ReturnCode"]=> int(1) ["ReturnData"]=> string(57) "S40021 : - something/sdf985" ["outResultToReturn"]=> array(1) { [0]=> object(stdClass)#2 (14) { ["ReturnCode"]=> int(0) ["ReturnData"]=> NULL ["Code"]=> string(1) "0" ["ErrorCode"]=> string(4) "3D00" ["Message"]=> string(9) "fghdfghe" ["Results"]=> string(0) "" ["ClientReferenceCode"]=> string(6) "413252" ["HostKey"]=> string(0) "" ["InternalMessage"]=> string(0) "" ["Last"]=> float(0) ["Process"]=> float(0) ["ReferenceCode"]=> string(8) "dgsd456" ["Status"]=> int(1) ["TransactionType"]=> int(0) } } ["outResultToContent"]=> array(1) { [0]=> object(stdClass)#3 (6) { ["FormPostContent"]=> string(1748) "

Open in new window


I get the resutl like this
$book = json_decode($result);
// access title of $book object

//I got ReturnCode like this
$ReturnCode = $book->ReturnCode;

But I don't know how to get FormPostContent

How can I get FormPostContent ? thank you
0
Hello Experts,

I would like to position an html table wrapped in a <div> in the $mail->Body = ' of a php mailer. In html I can place a html table anywhere on a web page using the following code:

<div id="Layer1" style="position:fixed; left:250px; top:159px; width:218px; height:55px; z-index:7">
  <table width="250" border="1" cellpadding="1">
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</div>

Using the above code in the php $mail->Body the table aligns to the left margin. I've tried various CSS <style> methods as well but I am unable to place the html table where i want in the ->Body. Is there a way to place the table where I want?  Other than the html table placement the php mailer performs as expected. Attached is a graphic of how I would like to place the html table in the ->Body of the php mailer, any help would be greatly appreciated.

Thank you,
Visionet
html_table.png
0
Hi everybody.
So I'm using a cde in .htaccess to remove php extension from the url:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} ^(.+)\.php$
RewriteRule (.*)\.php$ /$1 [R=301,L]

Open in new window

It works fine. But I have some dynamic url I want to make SEO compliant. For instance, I would like that
wines?wine=bordeaux

Open in new window

become
wines/bordeaux

Open in new window

So I looked around and I found this to put in my .htaccess
RewriteCond %{THE_REQUEST} \s/vinos\.php\?v=(\w+)\s [NC]
RewriteRule ^ /vinos/%1? [R=301,L]
RewriteRule ^vinos/(\w+)$ /vinos.php?v=$1 [L]

Open in new window

With this the url is rewritten as expected but in the page which is open php just doesn't work. And all css is lost...
Any idea about how can I remove the extension from the simple page and make dynamic urls seo friendly?
Thank you in advance for any suggestion :)
1
Looking to move audio player from development site.

Hi Guys, i was wondering if i could move the player thats here http://88.202.183.16/~iradiotest/ (when you hit play) to the main site https://iradio.ie (when you hit listen live)

I cant seem to find where the first player lives
0
 $('#email-attachment-form').submit(function (e) {
        e.preventDefault();
    
         alert("test");
    });

Open in new window


Just testing if submit is triggering.

how the form is created

   $html .=                        '<form id="email-attachment-form" name="email-attachment-form" class="email-act-form-validation"';
            $html .=                              'style="padding:20px 10%;border-top:1px solid #ccc;"';
            $html .=                              'enctype="multipart/form-data" novalidate>';
            $html .=                           '<div class="input-group cf mb-1">';
            $html .=                               '<input type="text" class="form-control" name="attachment-title"';
            $html .=                                       'id="attachment-title" placeholder="Title" required="">';
            $html .=                               '<div class="invalid-feedback">';
            $html .=                                   'Please provide file title.';
            $html .=                               '</div>';
            $html .=                          '</div>';
            $html .=                           '<div class="input-group cf">';
            $html .=                                '<div class="custom-file mb-5">';
            $html .=                                   '<label class="custom-file-label" for="attachment-file">Choose file...</label>';
            $html .=                                 

Open in new window

0
Hi Guys,

I was wondering can you help me, i want to move the billboard ad above the title of the page here at https://iradio.ie/123carinsurance and implement the following tracking add on the page, so have it above the 2nd heading "The driving test survival guide" i want it to just show for this page and not every other page on wordpress site?

I thought i had implemented the tracking code, but agency are saying they cant see it

<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/trackimpj/N1397.2105305MEDIACENTRAL/B22239169.241803622;dc_trk_aid=438535703;dc_trk_cid=113136882;ord=[timestamp];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=?"></SCRIPT>

Open in new window

0
Dear Experts, I use PHP 7.2

I get json file from an API, and I get the data like below.

 "{"ReturnData":"k01 : ","ReturnCode":1,"page":null,"products":[{"ProductId":1,"ProductName":"someting"},{"ProductId":4,"ProductName":"something else"}],"transactions":null}"
 
 
I get the variables like this :

echo "<br>" . "ReturnCode: " . $book->ReturnCode;

However I can not get the data of with the products which is an array I suppose.


My code works like this:
 $book = json_decode($result);
// access title of $book object
echo "ReturnData :" . $book->ReturnData; 
echo "<br>" . "ReturnCode: " . $book->ReturnCode;
echo "<br>" . "page: " . $book->page;
echo "<br>" . "transactions: " . $book->transactions;

Open in new window



I don't know how to get products?
How can I get the products and the variables inside of the products?

thank you
0
Microsoft Azure 2017
LVL 13
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

PHP ZipArchive appears not to work.

The source  code of my program that uses it (with a lot of echo's) is attached.

When evoking download_docs.php, I get the following:

passed files = doc_files/LS-910-eTCX-System-Brochure.pdf|doc_files/LS-710-TowerClean-Brochure.pdf|doc_files/LS-910-eTCX-System-Brochure.pdf|doc_files/LS-910-eTCX-System-Brochure.pdf~doc_files/LS-911_eTCX_Sample_Spec.doc|doc_files/LS-711-TowerClean-SpecSheet.rtf|doc_files/LS-911_eTCX_Sample_Spec.doc|doc_files/LS-911_eTCX_Sample_Spec.doc~NP_3512.pdf

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/lakoshva/public_html/devdev/download_docs.php:4) in /home/lakoshva/public_html/devdev/download_docs.php on line 27
nd = 8
nf = 3
docs = doc_files/LS-910-eTCX-System-Brochure.pdf
docs = doc_files/LS-710-TowerClean-Brochure.pdf
docs = doc_files/LS-910-eTCX-System-Brochure.pdf
docs = doc_files/LS-910-eTCX-System-Brochure.pdf
docs = doc_files/LS-911_eTCX_Sample_Spec.doc
docs = doc_files/LS-711-TowerClean-SpecSheet.rtf
docs = doc_files/LS-911_eTCX_Sample_Spec.doc
docs = doc_files/LS-911_eTCX_Sample_Spec.doc
internal file name = LS-910-eTCX-System-Brochure.pdf
ifn = doc_files/LS-910-eTCX-System-Brochure.pdf
internal file name = LS-911_eTCX_Sample_Spec.doc
ifn = doc_files/LS-911_eTCX_Sample_Spec.doc
internal file name = NP_3512.pdf
ifn = ../pselsumms/NP_3512.pdf
path = zips/15169zip.zip

Warning: Cannot modify header information - headers already sent 

Open in new window

0
I'm new to Laravel and I'm trying to figure this out.

I'm working through the tutorial at https://www.youtube.com/watch?v=v6SZerzfgIg.

My code right now looks like this:

Here's my "home.blade.php:"

<form action="/insert" method="Post">

Open in new window


My web.php page has my routes structured like this:

Route::get('/home', 'HomeController@index')->name('home');

Route::get('/display','InsertController@index');

Route::post('/insert', 'InsertController@add');

Open in new window


My InsertController looks like this:

use Illuminate\Http\Request;

class InsertController extends Controller
{
	
	public function display() {
		
	}
	
    public function add(Request $request) {
		
		add::display(Request::all());

	}
   
}

Open in new window


I'm thinking that "add::display(Request::all())" is targeting my "add" model sitting in my "app" directory. At that point, I've got this:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class add extends Model
{
    protected $fillable = ['question_text', 'keywords', 'required', 'type', 'answer_a', 'answer_b', 'answer_c', 'answer_d', 'answer_e'];
}

Open in new window


I'm wrong, apparently. Because when I submit my form, I get this error:

Class 'App\Http\Controllers\add' not found

What am I doing wrong? And am I right in assuming that this code:

add::display(Request::all());

...is going to submit my data and then grab the "display" method and show that page?

I'm a mess...

Straighten me out, please...
0
Php - ResetPassword page for users. The following code does not change the password in the database OR give me any error messages if the fields happen to be left blank.

if (!isset($_SESSION['user_id'])) {
	

// If it's a POST request, handle the form submission:
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
	

// Check for a new password and match against the confirmed password:
	$p = FALSE;
	if (strlen($_POST['password1']) >= 6) {
		if ($_POST['password1'] == $_POST['password2']) {
			$p = password_hash($_POST['password1'], PASSWORD_DEFAULT);
		} else {
			echo '<p class="error">Your password did not match the confirmed password!</p>';
		}
	} else {
		echo '<p class="error">Please enter a valid password!</p>';
	}
	if ($p) { // If everything's OK.
		// Make the query:
		$q = "UPDATE users SET pass='$p' WHERE id={$_SESSION['user_id']} LIMIT 1";
		$r = mysqli_query($db, $q) or trigger_error("Query: $q\n<br>MySQL Error: " . mysqli_error($db));
		if (mysqli_affected_rows($db) == 1) { // If it ran OK.

// Let the user know the password has been changed:
				echo '<h3>Your password has been changed. This will take effect the next time you log in.</h3>';
				include ('footer.html'); // Include the HTML footer.
				exit();

			} else { // If it did not run OK.

				trigger_error('Your password could not be changed due to a system error. We apologize for any inconvenience.'); 

			}

		} else {
			
			$pass_errors['current'] = 'Your current password is incorrect!';
			
		} // 

Open in new window

0
Making a custom Wordpress page and using the  while loop:
while ( have_posts() ) : the_post(); 

Open in new window


i want to make the output 2 colums

i use bootstrap grid in our code so i should be able to do
<div = row>
  <div = col-md-6>left
  <div = col-md-6>right
</div>

Open in new window

and the
%2 mod operator

Open in new window

but that doesn't seam to work

here is my current code
<div class="clearfix">&nbsp;</div>			 

<?php 
$counter = 1;
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
	<?php 
	$class = ($x%2 == 0)? 'RowWhiteBackground': 'RowGraybackground';
	?>
<?php 
       if ($counter == 1)
        {
               echo '<div  id="'.$counter.'" class="'.$class.'">';
		               echo  '<div class="col-md-4">';
					   ?>
					   	<div class="panel panel-primary">
							<div class="panel-heading"><h5><a href="<?php the_permalink(); ?>" style="color: #fff;" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h5></div>
							<div class="panel-body">
							<img height="150" width="150" style="padding : 0px 10px 0px 10px;"  vspace="10" class="alignleft" alt="<?php the_title_attribute(); ?>" src="<?php echo catch_that_image()?>" />
							<?php echo get_the_excerpt(); ?> 
							</div>
						</div>
						<?php 
					    $counter++;
					   echo  '</div>';
        } else if ($counter == 2) {
		                echo  '<div class="col-md-4">';
					   ?>
					   	<div class="panel panel-primary">
				

Open in new window

0
Hi everybody.
A client wants I implement a simple chat in order to get in touch with the visitors of his website. So I don't need to build a chat room but a one-to-one chat between the website owner and the website visitor. I'd need some guidance about hot to do it using jQuery and Php. I have found some script around the web, but, for instance, I don't understand how to manage the website owner side: It can happen that many visitors want to chat at the same moment and I can't guess how I have to manage this.

Can you give me some idea, suggestions and help?

Thank you so much
0
Installed new Microsoft Server 2012 R2 with new MySQL 8.0, PHP 7.2 and wordpress 5.1.
Server is functioning correctly however when I download a plugin I get this error:
cURL error 60: SSL certificate problem: self signed certificate in certificate chain

I downloaded the newest cacert.pem file and placed it on the server in this directory:
C:\php\cacert.pem

I edited the php.ini file in this path C:\Program Files\PHP\v7.2 to this:
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =
curl.cainfo = "C:\php\cacert.pem";

However, I'm still getting the same error "cURL error 60: SSL certificate problem: self signed certificate in certificate chain" when I download a plugin.
Can you provide any suggestions on how to fix or bypass this?
0

PHP

120K

Solutions

33K

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.