<?php
if (!isset($_COOKIE['firsttime']))
{
setcookie("firsttime", "no", time()+1500);
?>
<div class="row-fluid">
<div class="span4 center">
</div>
<div class="span4 center">
<div style="">
<div class="alert alert-info">
<button type="button" href="<?php setcookie("firsttime", "no", time()+1500); ?>" class="close" data- dismiss="alert">×</button>
<strong>Welkom</strong> <br />Dit is je eerste bezoek op wijktoernooi.nl ! <br /> Wil je je direct registreren? Klik hier!
</div>
</div>
</div>
<div class="span4 center">
</div>
</div>
<?php
}
else
{
// do or show nada !
}
?>
Based upon code above if no cookie is set it should set cookie firsstime and show the alert box
But it doesnt....when i reload the page i still see the alert box, where am i making a mistake?
You cannot send output before setting cookies. You need to understand HTTP.
So do this test: var_dump(headers_sent()); before you try to set a cookie.
If headers are sent, you're doing it wrong.
href="<?php setcookie(...); ?>" is by far the most creative use of PHP ever. PHP prints stuff. It does not react to HTML/DOM/JS events. It takes input and produces output. That's all it does.
I cannot give you any code that works here as you don't have the understanding required to make heads or tail of it. So figure out HTTP (client/browser & server/php communication), cookies and only then will you be able to fix this and do it right in the future.
Related
I noticed that the login function and registration function is clearly not working and keeps giving an error, not giving the option to register nor login to the previous account registered on the database. Here is the code of login.php and user.php. The website uses CodeIgniter and that could be where the problem is I think.
Code for login.php in JustWallet 2.0.4\application\views\user:
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<div class="header-st mb-4">
<div class="container">
<div class="row">
<div class="col-md-12">
<h3>
<?php echo lang('core button sign_in') ?>
</h3>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row mt-5">
<div class="col-md-6 offset-md-3">
<div class="card">
<div class="card-body">
<?php echo form_open('', array('class'=>'')); ?>
<div class="form-group">
<label for="exampleInputEmail1"><?php echo lang('core button username_email'); ?></label>
<?php echo form_input(array('name'=>'username', 'id'=>'username', 'class'=>'form-control', 'placeholder'=>lang('core button enter_username'), 'maxlength'=>256)); ?>
</div>
<div class="form-group">
<label for="exampleInputPassword1"><?php echo lang('core button password'); ?></label>
<?php echo form_password(array('name'=>'password', 'id'=>'password', 'class'=>'form-control', 'placeholder'=>lang('core button enter_password'), 'maxlength'=>72, 'autocomplete'=>'off')); ?>
</div>
<div class="row">
<div class="col-md-12">
<div class="g-recaptcha" data-sitekey="<?php echo $this->settings->google_site_key; ?>"></div>
</div>
<div class="col-md-6">
<?php echo lang('core button forgot'); ?></br>
<?php echo lang('core button create'); ?>
</div>
<div class="col-md-6 text-right">
<button type="submit" class="btn btn-success"><?php echo lang('core button login'); ?></button>
</div>
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
</div>
</div>
I am getting these errors:
When using the correct login details from the database):
Invalid username or password
When trying to login to an account that already exists in the database:
Unable to access an error message corresponding to your field name Password.(_check_login)
When trying to register a new account (even though that is a new account to be created):
Your account could not be created at this time. Please try again.
Here is an image of the existing account in the database and the whole database:
Your <?php form_open() ?> still empty.
please provide your controller/method link inside form_open('controller/method',$parameter)
We couldn't see because u still don't provide your controller code.
My thoughts: You still have blank form_open. And Why are you use google recapthca?, I mean, you should check your "recaptcha" validation in your controller. This cannot be done until you have given the controller segment to this question.
UPDATED:
Hmm, I confused, why did u update a Plain text to your password here?
Next this is under your login callback method inside User.php:
Red circle explanation:
Your password supposed to be hashed programmatically when the user create their account. When you validate it using callback _check_login() here, It might be verified with hash comparation under password_verify() function inside your model. Why did you do that? (updating the password manually with the plain text ? :D)
And this is my biggest question to you.. Did you know about google recaptcha before? Google recaptcha only work in hosted site not localhost. Are you using your own program, I mean your own recaptcha's site /secret key? well.. it seems you don't own this program. When you try to validate with another site/secret's key, you cannot continue (see here https://www.google.com/recaptcha/about/), otherwise you have to delete every recaptcha validations in this program.
I need help with the Wordpress plugin - WP Simple Membership (https://simple-membership-plugin.com).
I have a problem to display the Message when a user try to login but is not registered. I can see it in my source code, this snippet:
<!--
<div class="swpm-forgot-pass-link">
<a id="forgot_pass" class="swpm-login-form-pw-reset-link" href="http://lions.giftgruen.com/anmelden/password-reset/">Passwort vergessen?</a>
</div>
<div class="swpm-join-us-link">
<a id="register" class="swpm-login-form-register-link" href="">Noch kein Mitglied? Registriere dich hier! </a>
</div>
<div class="swpm-login-action-msg">
<span class="swpm-login-widget-action-msg">Benutzer unbekannt</span>
</div>
-->
But it is somehow not displayed. I don't know how to fix that. Can anyone help? Thanks in advance.
it's commented out, the <!-- and --> are html comment brackets
replace that snippet with:
<div class="swpm-forgot-pass-link">
<a id="forgot_pass" class="swpm-login-form-pw-reset-link" href="http://lions.giftgruen.com/anmelden/password-reset/">Passwort vergessen?</a>
</div>
<div class="swpm-join-us-link">
<a id="register" class="swpm-login-form-register-link" href="">Noch kein Mitglied? Registriere dich hier! </a>
</div>
<div class="swpm-login-action-msg">
<span class="swpm-login-widget-action-msg">Benutzer unbekannt</span>
</div>
I don't know if that will fix your problem though,
It's probably meant to be commented out if it was.
I am trying to use the php code to display a comment box on a page:
$object_id = 'article_12';
include('commentanything/php/loadComments.php');
For some reason the comment box is not appearing where i want it to appear,it keeps throwing the comment box to header, is there any way i can make it appear exactly where i want it to?, here is where i am trying to use it(not a complete code):
<!--<h1 align="center" style="font-size:1.2em"><strong>'.$row['title'].'</strong></h1>-->
<div class="song-art"><img src="'.$this->url.'/thumb.php?src='.$row['art'].'&t=m&w=112&h=112" id="song-art'.$row['id'].'" title="'.$row['title'].'" alt="'.$row['title'].'"/></div>
<div class="song-top">
<div class="song-timeago">
<a href="'.$this->url.'/mp3download/'.$row['id'].'/'.$this->genSlug($row['title']).'.html"><span id="time'.$row['id'].'">
<div class="timeago'.$b.'" title="'.$time.'">
'.$time.'
</div>
</span>
</a>
</div>
<div data-track-name="'.$row['name'].'" data-track-id="'.$row['id'].'" id="play'.$row['id'].'" class="track song-play-btn">
</div>
<div class="song-titles">
<div class="song-author"><a onmouseover="profileCard('.$row['idu'].', '.$row['id'].', 0, 0);" onmouseout="profileCard(0, 0, 0, 1);" onclick="profileCard(0, 0, 1, 1);" href="'.$this->url.'/index.php?a=profile&u='.$row['username'].'">'.realName($row['username'], $row['first_name'], $row['last_name']).'</a></div>
<div class="song-tag">
'.$tag.'
</div>
<div class="song-title">
<div class="track-link"><h2 style="font-size:1.0em">
<!--<div id="song-name'.$row['id'].'">'.$row['title'].'</div>-->
</h2></div>
</div>
</div>
</div>
<div class="player-controls">
<div id="song-controls'.$row['id'].'">
<div id="jp_container_123" class="jp-audio">
<div class="jp-type-single">
<div class="jp-gui jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="track-actions-container">
</div>
'.$extra_links.'
'.$seo_links.'
'.$comment.'
'.$charts.'
</div>';
$object_id = 'article_12';
include('commentanything/php/loadComments.php');
$start = (isset($row['extra_id'])) ? $row['extra_id'] : $row['id'];
}
}
I am trying to display it right after '.$charts.' but it keeps showing up in header
it's looking like you haven't worked to match HTML in index and loadComments.php .
first copy your loadComments.php code in place of include('commentanything/php/loadComments.php');
and check for html/css errors. It's there.
And if it failed too, your php/html nesting is wrong which i cant tell because u don't have even used to know us how and where u are stuffing php. You simply added variables in above displayed code
I have successfully added a tab to my view.phtml page located at app/design/frontend/enterprise/aps/template/catalog/product.
I tried an if statement to hide it if the Specifications field is empty, i.e. no content. The issue is, it doesn't work. It still shows the tab even if there is no content.
My code is below at the end of post.
2 Questions:
Am I taking the correct approach? Basically, I am making a tab to have an Expert Review tab. I originally was going to use a cms block, but figured purposing the Specifications field was easier, for one, but also I could ignore the tab if no content
Can you please help ? :)
Thanks so much and here is my code and I attached a screenshot of the empty tabs.
<div class="wa-product-details-tab product-description">
<div class="wa-product-details-tab-heading product-desc-tab">
<div rel=".wa-product-tab-details-item-1" class="wa-product-heading-item wa-product-heading-item-1 wa-product-heading-item-active">
<span>Description</span>
</div>
<div rel=".wa-product-tab-details-item-2" class="wa-product-heading-item wa-product-heading-item-2">
<span>Specs</span>
</div>
<div rel=".wa-product-tab-details-item-3" id="review-form" class="wa-product-heading-item wa-product-heading-item-3">
<?php
$summaryData = Mage::getModel('review/review_summary')
->setStoreId(Mage::app()->getStore()->getId())
->load($_product->getId());
?>
<span >Reviews (<?php echo $summaryData->getReviewsCount();?>)</span>
</div>
<div rel=".wa-product-tab-details-item-4" class="wa-product-heading-item wa-product-heading-item-4">
<span>APS Advisor Review</span>
</div>
</div>
<div class="wa-product-tab-details product-desc">
<div style="display: block;" class="wa-product-tab-details-item wa-product-tab-details-item-1">
<?php echo $_product->getDescription(); ?>
</div>
<div style="display: none;" class="wa-product-tab-details-item wa-product-tab-details-item-2">
<p> <?php echo $this->getChildHtml('additional')?></p>
</div>
<div style="display: none;" class="wa-product-tab-details-item wa-product-tab-details-item-3">
<p>
<?php echo $this->getChildHtml('review_form') ?>
<?php echo $this->getChildHtml('product_additional_data_review') ?>
</p>
</div>
<div style="display: none;" class="wa-product-tab-details-item wa-product-tab-details-item-4">
<?php if ($_product->getSpecifications()); ?>
</div>
</div>
I am not sure if I understood your issue correctly. I am assuming that you want to hide the "APS Advisor Review" tab if there is no content in it.
For this you can use an if condition to check if $_product->getSpecifications() has any content, and show the tab title only if there is any content like this
<?php if( !empty($_product->getSpecifications()) ){ ?> <!-- displays the tab title only if the product has any specifications -->
<div rel=".wa-product-tab-details-item-4" class="wa-product-heading-item wa-product-heading-item-4">
<span>APS Advisor Review</span>
</div>
<php } ?>
I have the following html code:
<div class="media row-fluid">
<div class="span3">
<div class="widget">
<div class="well">
<div class="view">
<img src="img/demo/media/1.png" alt="" />
</div>
<div class="item-info">
Title 1
<p>Info.</p>
<p class="item-buttons">
<i class="icon-pencil"></i>
<i class="icon-trash"></i>
</p>
</div>
</div>
</div>
<div class="widget">
<div class="well">
<div class="view">
<img src="img/demo/media/2.png" alt="" />
</div>
<div class="item-info">
This is another title
<p>Some info and details go here.</p>
<p class="item-buttons">
<i class="icon-pencil"></i>
<i class="icon-trash"></i>
</p>
</div>
</div>
</div>
</div>
Which basically alternates between a span class with the widget class, and then the widget class without the span3 class.
What I wanted to know was if there was a way to have php "echo" or populate the details for and details under the "item-info" class. Would I need to use a foreach statement to get this done? I would be storing the information in a mysql database, and while I can get it to fill in the info one by one (repeatedly entering the and echoing out each image and item title) it's not practical when the content needed to be displayed is over 15 different items. I'm not well versed in foreach statements so I could definitely use some help on it.
If someone could help me perhaps structure a php script so that it can automatically output the html based on the number individual items in the database, that'd be greatly appreciated!
I'm wondering if the html + php (not including the foreach) would look like this:
<div class="span3">
<div class="widget">
<div class="well">
<div class="view">
<img src="img/<? $file ?>" alt="" />
</div>
<div class="item-info">
<?$title?>
<p>Info.</p>
<p class="item-buttons">
<i class="icon-pencil"></i>
<i class="icon-trash"></i>
</p>
</div>
</div>
</div>
EDIT:
I wanted to add some more information. The items populated would be based on a type of subscription - which will be managed by a group id.
I was initially going to use <? (if $_SESSION['group_id']==1)>
echo <div class="item-info">
$title
<p>$info</p>
</div>
so that only the subscribed items would populate. But, I would need it to iterate through all the items for group1 table and list it. Currently I know that I can do
<? (if $_SESSION['group_id']==1)
while ($row=mysql_fetch_assoc($sqlItem))
{
$itemInfo = $row['info'];
$image = $row['image'];
$title = $row['title'];
$url = $row['url'];
};
>
$sqlItem for now can only be assigned one thing (manually - as in: $sqlItem = '123'), unless I iterate through which is what I'm trying to figure out.
Just read that 'mysql_fetch_assoc' is being depreciated with 5.5, here is the new way and looks better, easier I think.. Hope this helps, was updated today.
I hope this helps http://php.net/manual/en/mysqli-stmt.fetch.php
replace the printf with echo '//then your html stuff
This will iterate through the rows in your database until their are no more matching records.
shouldn't a while be enough? It depends on the structure of your database and website (we didn't need so much HTML I think. Some more PHP maybe). Hope this helps.