close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Sessions problems from search

Thread began 6/25/2019 10:28 am by mrs | Last modified 6/27/2019 6:32 pm by Ray Borduin | 1148 views | 7 replies |

mrs

Sessions problems from search

I'm having a couple of problems with search results and sessions. I've got a session being created that is called WASearch_WADAtbl_product and it is filtering the results as expected, but in order to clear the search results to display all products again I have created a page called search-clear.php which kills the afore mentioned session.

I've added a section on the page that should show when the session has content and hide when it's empty by way of 'WebAssist Show If'... but it's constantly showing and I don't know why!

Added to that, I have tried to show what the user has searched for, but all I am getting is 'Array'.

I seem to have a mass of search sessions available to use for some reason, but none of them are displaying anything apart from the session WASearch_WADAtbl_product, and when I kill it off, it still shows!

What have I done wrong? It's as though the behaviour of the upgraded DA has changed because it seems to be going something different to what I am used to, but I assume it's something I've done.

Files attached.

Thanks.

Attached Files
rental-furniture.php
search-clear.php
Sign in to reply to this post

Ray BorduinWebAssist

Update your IF statement from:

php:
<?php

          
if ("".$_SESSION['WASearch_WADAtbl_product']  ."" != "") {  // WebAssist Show If
        
?>
        <div class="row mbtm30 col-12">
            Search filter active: <?php echo $_SESSION['WASearch_WADAtbl_product']; ?>. <a href="search-clear.php">Remove filter</a>
        </div>
        <?php
          
// ("".$_SESSION['WASearch_WADAtbl_product']  ."" != "")
        
?>



to:


php:
<?php

          
if ("".((isset($_SESSION['WASearch_WADAtbl_product'])&&sizeof($_SESSION['WASearch_WADAtbl_product'])>0)?"1":"")  ."" != "") {  // WebAssist Show If
        
?>
        <div class="row mbtm30 col-12">
            Search filter active: <?php echo $_SESSION['WASearch_WADAtbl_product']; ?>. <a href="search-clear.php">Remove filter</a>
        </div>
        <?php
          
// ("".((isset($_SESSION['WASearch_WADAtbl_product'])&&sizeof($_SESSION['WASearch_WADAtbl_product'])>0)?"1":"")  ."" != "")
        
?>



That should fix it.

The session variable that saves the search settings is stored as an array in the latest version of the rsobj.php file. So you check for it has to make sure that it exists and that its length is not zero.

Sign in to reply to this post
Did this help? Tips are appreciated...

mrs

Cheers Ray, that worked.

How do I build that in the show region utility tool to work with the search results, or is it a case of just knowing that code?

Also, my understanding of an array is that it is one or more results returned and those collectively are called an array of results. So, how do I get at the contents of the array in order to show the search term entered?

Basically, I want to create a box with a bit like this below:

[ X King size bed ]

where the user can get the visual cue to click on the X to kill the search.

Sign in to reply to this post

Ray BorduinWebAssist

You would have to know that code to add a conditional region.

The values stored are based on the search inputs you are using. If you add this:

<?php
var_dump($_SESSION['WASearch_WADAtbl_product']);
?>

and send me the result... then I can tell you how to reference a particular value based on that.

Sign in to reply to this post
Did this help? Tips are appreciated...

mrs

I just tried that and got NULL

So I tried dumping all sessions rather than a specific one and got:

array(3) { ["WAENCRYPTEDRETURNUSED"]=> bool(false) ["WAENCRYPTEDRETURNSUCCESS"]=> bool(false) ["WASearch_WADAtbl_product"]=> array(0) { } }




I've also tried this:

<?php print_r($_SESSION['WASearch_WADAtbl_product']) ?>

and am getting this:

Search filter active: Array ( [0] => Array ( [0] => Array ( [0] => Array ( [type] => v [comparison] => Includes [join] => AND ) [1] => Array ( [0] => fld_p_name [1] => fld_p_descrption [2] => fld_p_collection [3] => fld_p_manufacturer ) [2] => s [3] => King size bed ) ) ) .


Which I think kind of contradicts the results of the dumping of the session! The session has no value when dumped, but does when printed!



I've just noticed that I had the @ missing from the line of code <?php @session_start(); ?>. Would that have a bearing? I have just tried and it seems to have done nothing.

Sign in to reply to this post

Ray BorduinWebAssist

Then try this for writing the search value:

php:
<?php echo(<?php

echo($_SESSION['WASearch_WADAtbl_product'][0][0][3]);
?>); ?>
Sign in to reply to this post
Did this help? Tips are appreciated...

mrs

Cheers Ray, that worked a treat.

Quick question that is unrelated, but I thought I'd ask it here as it not really worth starting a new thread over; I've had a website hacked and they have placed files all over the place that are doing god only knows. I have been through and deleted many files that I know aren't mine or created by WA wizards, but I want to check that WA wizards don't create .htaccess files and especially within the WebAssist directory. I've deleted them from the live server because they didn't exist in my development server, but just wanted to make sure that I have done the right thing!

Cheers.

Sign in to reply to this post

Ray BorduinWebAssist

The first thing to do is figure out how they were able to add files. Do you have a file upload field or file manager in a place where it isn't password protected that would allow a hacker to upload files to your server?

We only have .htaccess files in the KCFinder folder and file upload folder for that tool. I think you can safely remove most, but I'm more concerned about how a hacker was able to do that and closing the security hole. If you send me FTP access to your server I can take a look and see if I can spot the security hole they might be taking advantage of.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...