I have a wordpress website, and I am getting an error message above the form on my contact page.
Error message reads:
Notice: Undefined variable: success in /home/crea6303/public_html/westafricanplumbing.com/wp-content/themes/waseps-custom/template-contact.php on line 92
template-contact.php code is:
<?php if($success) {
echo "
<div class=\"info-message\" style=\"background-color: #75a226;\">
<i class=\"fa fa-times\"></i>
<p><strong>".__('Success:', DAT_NAME)."</strong>".__('The Message has been sent', DAT_NAME)."</p>
</div>";
} ?>
I don't have a clue how to fix this...can anyone help?
Thank you kindly
Ferg
Related
I am having an issue with my Google+ Api. It was working fine, but suddenly stopped retrieving data from Google+ page.
This is the code, which was working fine and nothing is changed in it.
<?php
$guserid = get_field('google_plus_user_id','option');
$gplus_api = get_field('google_plus_api_key','option');
if(empty($guserid))
$guserid = "***ID***";
if(empty($gplus_api))
$gplus_api = "***API***";
$gactivity_url = "https://www.googleapis.com/plus/v1/people/".$guserid."/activities/public?maxResults=1&key=".$gplus_api;
$gactivity = json_decode(file_get_contents($gactivity_url));
$items = $gactivity->items[0];
$created_time = $items->updated;
$link = $items->url;
$title = $items->title;
$attachments = $items->object->attachments[0];
$full_picture = $attachments->image->url;
?>
<img src="<?php echo $full_picture; ?>" alt="Google+"/>
<div class="gp_content">
<div><?php echo $attachments->content ?></div>
<a target="_blank" href="<?php echo $link; ?>"><?php echo $title; ?> </a>
<dt> <?php echo date('d/m/Y', strtotime($created_time)); ?> </dt>
I am receiving the following errors
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 114
Warning: file_get_contents(): Failed to enable crypto in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 114
Warning: file_get_contents(https://www.googleapis.com/plus/v1/people/USERID/activities/public?maxResults=1&key=APIKEY): failed to open stream: operation failed in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 114
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 115
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 117
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 118
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 119
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 121
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 121
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 122
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 122
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 126
Notice: Trying to get property of non-object in C:\Inetpub\vhosts\abc.com\httpdocs\fc\wp-content\themes\abc\social-feeds-tpl.php on line 126
Any help is appreciated.
This should do it:
$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
]
]);
$data = file_get_contents($gactivity_url, false, $context);
I am trying to upload files using laravel5.1.But i am facing error like
FatalErrorException in Handler.php line 25:
Uncaught TypeError: Argument 1 passed to App\Exceptions\Handler::report() must be an instance of Exception, instance of Error given, called in E:\xampp\htdocs\mp-admin\vendor\compiled.php on line 1720 and defined in E:\xampp\htdocs\mp-admin\app\Exceptions\Handler.php:25
Stack trace:
#0 E:\xampp\htdocs\mp-admin\vendor\compiled.php(1720): App\Exceptions\Handler->report(Object(Error))
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Error))
#2 {main}
thrown
Here is my view
<div class="form-group">
<label >Logo</label>
<input type="file" name="image" >
</div>
Controller:
$entry = new companyprofiles();
$file = Input::get('image');
$extension = $file->getClientOriginalExtension();
Storage::disk('local')->put($file->getFilename().'.'.$extension, File::get($file));
$entry->mime = $file->getClientMimeType();
$entry->original_filename = $file->getClientOriginalName();
$entry->filename = $file->getFilename().'.'.$extension;
$entry->save();
But first when i was trying it was storing in database and folder as well.after that continuously giving the same above error.
Please help me with this.if i do dd the value also its giving me the same error i could not able to find where is the error.Not getting stored in database.
Remove or delete vendor/compile.php
Run composer dump-autoload
if not work then
run composer update
Hi how do you post the login error message within the originating page where the user was attempting to login ?
Below I was able to stay on the current page if user login successfully but for login error it will obviously just go to the logonprocess page and display the error message.
Sorry that I remove a lot of validation below as the codes can really be very long.
Index.php
<?php
//set the session cookie parameter
ini_set("session.save_path", "sessionData");
session_start();
?>
<?php
if (!isset($_SESSION['uName'])) { ?>
<form method="post" action="logonProcess.php">
<div>Username <input type="text" name="userName" placeholder="Username"></div>
<div>Password <input type="password" name="pwd" placeholder="Password"></div>
<div><input type="submit" value="Logon"></div>
</form>
<?php } else { }?>
<?php
if (isset($_SESSION['uName'])) {
$username = $_SESSION['uName'];
echo "<p>Welcome $username</p>\n";
?>
Logout</br></br>
LogonProcess.php
$loginerror = array();
if (empty($username)) {
$loginerror[] = "You have not entered all of the required fields";
}
elseif (strlen($passWD) < 8) {
$loginerror[] = "You have not entered all of the required fields";
}
if (!empty($loginerror))
for ($a=0;$a<count($loginerror);$a++)
{
echo "$loginerror[$a] <br />\n";
}
else
if (mysqli_stmt_fetch($stmt))
{
if (password_verify($passWD, $passWDHash))
{
$_SESSION['uName'] = $username;
echo "<p>Login successful</p>";
header('Location: ' . $_SERVER['HTTP_REFERER']);
}
else
{
echo "<p>Please try to login again</p>";
}
why dont you put ur login error in $_SESSION["login_error"] and check in ur origin page if the session exits show the error then destroy the session after it.
I want delete my model via post , but I always get Invalid Request
this is my view
<?php
echo CHtml::link(CHtml::encode('Delete image'), array('gambar/delete', 'id' => $data->id), array(
'submit' => array('data/delete', 'id' => $data->id),
'class' => 'delete', 'confirm' => 'This will remove the image. Are you sure?'
)
);
?>
and this is my action in GambarController
public function actionDelete() {
if (Yii::app()->request->isPostRequest) {
// we only allow deletion via POST request
$this->loadModel()->delete();
if (!isset($_GET['ajax']))
$this->redirect(array('index'));
}
else
throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.');
}
But I always get Invalid Request, I have read some forums, but I cannot get it. Anyone can help me ?
In most cases you can not use link (<a>) to POST. Instead, use the <form> like this
<form action="<?php echo $this->createUrl('/gambar/delete/'.$model->id);?>" method="post">
<button
type="submit"
name="id"
value="<?php echo $model->id?>"
onclick="if (!confirm('Are you sure to delete this image?')) return false;">
<i class="icon-white icon-trash"></i> Delete
</button>
</form>
You are using CHtml::link, this will generate an html <a> tag. When you click on a <a>, your browser send HTTP GET request(not POST request) to the server. So if(Yii::app()->request->isPostRequest) is always false and therefore you see Invalid request error. You should remove this condition from the action. Also, $this->loadModel()->delete() is invalid, because loadModel get an id as parameter. So $this->loadModel($_GET['id'])->delete() is correct.
Use the below code
$this->loadModel(primarykey, 'TableName')->delete();
Should work!
After I send the request, I will announce the result to the user via SET FLASH. What is the way to show a message when the user sends a request?
For example when sending a message form : Display -> form is being send and then a flash message is displayed
Check the wiki on the Yii framework website:
http://www.yiiframework.com/wiki/21/how-to-work-with-flash-messages/
In your controller you can put:
Yii::app()->user->setFlash('success', "Form posted!");
In your view you can echo the flash message by:
<?php echo Yii::app()->user->getFlash('success'); ?>
Optionally you can check if a flash message exists by using the hasFlash method, so the code in your view would look like this:
<?php if(Yii::app()->user->hasFlash('success')):?>
<?php echo Yii::app()->user->getFlash('success'); ?>
<?php endif; ?>
Add setFlash in your controller. Something like this:
if($comment->save())
{
Yii::app()->user->setFlash('commentSubmitted','Thank you for your comment.');
$this->refresh();
}
And in your views, display flash message something like this:
<?php if(Yii::app()->user->hasFlash('commentSubmitted')): ?>
<div class="flash-success">
<?php echo Yii::app()->user->getFlash('commentSubmitted'); ?>
</div>
<?php endif; ?>
In your controller you can put:
if(conditions)
Yii::app()->user->setFlash('success', "Success text");
else
Yii::app()->user->setFlash('error', "Error text");
In your view you can echo the flash message by:
<?php
if(Yii::app()->user->hasFlash('success'))
Yii::app()->user->setFlash('success', '<strong>Well done!</strong> '.Yii::app()->user->getFlash('success').'.');
else
Yii::app()->user->setFlash('error', '<strong>Error!</strong> '.Yii::app()->user->getFlash('error').'.');
$this->widget('bootstrap.widgets.TbAlert', array(
'block'=>true, // display a larger alert block?
'fade'=>true, // use transitions?
'closeText'=>'×', // close link text - if set to false, no close link is displayed
'alerts'=>array( // configurations per alert type
'success'=>array('block'=>true, 'fade'=>true, 'closeText'=>'×'), // success, info, warning, error or danger
),
)); ?>