Hi,
From that loop, only unique values for $start.

-matti

Hello,

I have a problem to get unique values from dateperiod-loop.

There is a tons of examples how to do it, but after hours of searching, i couldn't find suitable solution for me.
The code starts like this. To put it into array_unigue is hard to accomplish for me.

Have you any simple proposals to make it working?

$intrvl =  strtotime("1970-01-01 00:30:00 UTC");

$dateTimes = new DatePeriod(
new DateTime($starttime),
new DateInterval('PT'.$intrvl.'S'),
new DateTime($endtime)
);

foreach ($dateTimes as $dt) {

    $start=$dt->format('H.i');
    $end=date('H.i',strtotime('+30 minutes',strtotime($start)));

    echo'<div>'.$start.' - '.$end.'</div>';

}

Yep, you wrote this open, as it is.
That SASS was new for me. As learning these tehcnologies some time. Maby i learn it also, and apply it to somewhere in my portal.
Just have to be sure, that my site do not crash for any case of updates, or security update.

Thanks to Koen "http://koen.kivits.com/articles/pure-css-menu/", i finally get rid of jquery-classes also. 9842 + 16617 rows less readable for server now. This is, how less css needs to create responsive menu for mobile use:

/*-- responsive-mediaquries --*/
@media(max-width:800px){
.onclick-menu {
position: relative;
display: inline-block;
}

.onclick-menu:before {
content: url(../images/menu.png);
}

.onclick-menu:focus {
/* clicking on label should toggle the menu */
pointer-events: none;
}

.onclick-menu:focus .onclick-menu-content {
/*  opacity is 1 in opened state (see below) */
opacity: 1;
visibility: visible;
/* don't let pointer-events affect descendant elements */
pointer-events: auto;
}

.onclick-menu-content {
position: absolute;
z-index: 1;
/* use opacity to fake immediate toggle */
opacity: 0;
visibility: hidden;
transition: visibility 0.5s;
background: rgba(0, 0, 0, 0.80);
}

Yes, i added moment.js for now, and date is now in correct format. There came 4040 more readable rows for this little convert...
With jquery, i had 9842 + 16617 rows taking care of dates :-D
I still continue search something else, because, this is so strange way to handle this kind of functionality. There have to be better solution for picking dates.

Hi,
Trying to replace jquery-modules, because i need only datepicker, not any additional stuff.
Found a light Pikaday datepicker, working just fine as common, but after hours of searching and reading articles, it seems that nobody has not found a good solution to fix date format issue of it, or without any another massive fix, like moment.js. Why this format has left to this annoying condition....
Have anyone found good solution, for get picked date in format YYYY-MM-DD?
I do not want to include 2 jquery-modules, just for one datepicker.....

And, i can see in my eye, how much faster, site response now, as before.

Just for info.
My style.css had 3250 rows + bootstrap.css 5776 rows before.
Now, i have style.css with 1166 rows. And responsive tags are included.
Isn't there lots of stuff or what, for in reserve!

I tested my site, and response was "Greate. This site fits to mobile device". My target is always check that functions works with mobile as well :-)
My site is more like a tool. For daily tasks and invoicing. I do not want to put users find needed function round blinking buttons and unnessesary graphics. So i do not need there "too fancy" design, for get people buy something.
Maybe bootstrap fits more for web-shops and similar, selling sites.

Hi,
I bought some months ago a template of site style. For learn, what is the current way of do that. It took a whole weekend, to remove bootstrap styling from my portal. And now, everything is working just fine, and with same style. CSS is including only what is needed.
Before removal, i had thousands of rows something. Divided between style.css and bootstrap.css. Harder to fix or style new functions.
If you try to add for example table or inputs. Somewhere some styling affects to it. Try to find out, what row....
For sure, my site doesn't deed that much of data. Put site respond slower, cause of thousands readable rows. What im doing with slidings and fogs, when opening page.
So, my question is. What is the purpose, generating massive stylings to sites?
If i'm doing business, i don't care, if some fields looks like "This is the current way to do web-portals". Im more interest, that site is working as it should, and i do not want extra knowledge, services, what generates more cost for site management.

After hard testig and basket of beer, i figure this out. Tested and working, with adding filter-value within startrow-variable in href-link:
<a href="'.$_SERVER['PHP_SELF'].'?icycle='.$icycle.'&startrow='.($startrow+10).'">

Yes, there is content in selection-list. That var_dump get those dissapering.
After selection, startrow is not functioning. It doesn't keep the selected value, and show next rows.

I tried that require, but no luck. It didn't do anything. So closest method is still header-function. But one by one effect.
Maybe the solution lie behind the java, but i'm bad with it, and my site have less java as possible. Just in practical cause. I have to manage it by my selve.
Well, i have to think more this. If there is totally different way to handle this. If the html file is created in same time, when offer has been made. Then it is already made, and do not need creation later.

I try to open more this issue.
Every html-file is like a bill or offer of items. It's in html format. Data for this file is generated by archiveinv.php, what builds up html-file with own query. Data can be fetched by offerid-number. It's a collection about numbers of rows (items), what have own id.
This loop-script generates list of offers, and have to send command for html-file generation. Currently, i can do this by button in offerid's grid. One by one.
If ever, there is like 900 offers. I do not like to click 900-times to generate files.

Yes, the target is to producing html-files. Create them as many as selected by first guery, like all offers included specified time-window.
So with this part of script, i can fetch this information, got those offer-numbers.
But when i try to generate them with archiveinv.php by loop, it doesn't do it for all, like in result:
header('location:archiveinv.php?offerid=160415132928);
header('location:archiveinv.php?offerid=160415135316);
Only one by one.
With PHP, can it be done as looping scripts, like with cmd-scripts. I have seen only query results done by loop, showing the data, but executing actions, can it?

Ok, i taught so with header-function. What else could be executed for multiple actions??
I think that rows 4 and 5 are not needed here. Results are the same without them.

But i got already results. And it works, but only one by one, with new refresh.

Hello,
Another issue came up, when needed to run mass-functions.
archiveinv.php is generating html-file with result of query function. This part is working fine. And launched from form-link "archiveinv.php?offerid=$offerid" does it's job.
But, when i need to launch many of them in same time, with array result, it's harder to get working.
I manage it almost with this part of script. This generates a result of needed rows for execution. But needs still a new query. Executing only one by one.
It doesn't do the loop for execute all in same time. I use here header-function, but can i use something else with this?

$keys = array($offerid);
    for($i = 0; $i < count($offerid); $i++) {
    header('Location:archiveinv.php?offerid='."$keys[$i]".'"');
    foreach($offerid[$keys[$i]] as $key => $value) {
    $key . " : " . $value . "";
    }

echoed output shows correct results as:
header('location:archiveinv.php?offerid=160415132928);
header('location:archiveinv.php?offerid=160415135316);

Hello,
I try to limit query results and fetched items in same time.
But, with my script, that is not functioning together. Selected item is not staying as variable in query. Something is badly ordered in this script.

    <?php
    if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
    $startrow = 0;
    }
    else {
    $startrow = (int)$_GET['startrow'];
    }
    echo '<table class="tabs">
    <td><a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+10).'"><input type="button" name="next" value="Next" class="nextbutton" /></a></td>
    <form name="deal" method="post" action="">
    <td><select required name="deal" onchange="javascript: submit()" class="tblselect">
    <option value="">Period</option>';
    $query = mysqli_query($db,"SELECT DISTINCT icycle FROM offer WHERE orderstatus='Billable' ORDER BY icycle ASC");
    $result = ($query) or die ('Error in query: $query. ' . mysqli_error());
    while($row = mysqli_fetch_array($result))
    {
    echo'<option value ='.$row['icycle'].'>'.$row['icycle'].'</option>';
    }
    echo'</select></td>';
    $prev = $startrow - 10;
    if ($prev >= 0)
    echo '<td><a href="'.$_SERVER['PHP_SELF'].'?startrow='.$prev.'"><input type="button" name="prev" value="Previous" class="prevbutton" /></a></td></form></table>';
    $fetch = mysqli_query($db,"SELECT * FROM offer WHERE icycle='Now' AND orderstatus='Billable' GROUP BY offerid ORDER BY custname LIMIT $startrow, 10")or die(mysql_error());

    if(isset($_POST['deal']))
    {
    $deal = $_POST['deal'];
    $fetch = mysqli_query($db,"SELECT * FROM offer WHERE icycle='$deal' AND orderstatus='Billable' GROUP BY offerid ORDER BY custname LIMIT $startrow, 10")or die(mysql_error());
    }

Thanks for info. I test that forced download script later on.
I modify the script with these suggestions, and was able to copy file. But only inside webroot.
Added also some echoes for file not found and file copied to target location, under banner. Here is the working code for it:

<div class="banner"><h5>
    <form method="post" action="">
    <select name="htmlfile" id="htmlfile">
    <option value="">Valitse...</option>
    <?php
    $dir_open = opendir("htmlinvoices/");
    while(false !== ($filename = readdir($dir_open))){
    if($filename != "." && $filename != ".."){
    echo "<option value='$filename'>$filename</option>";
    }
    }
    closedir($dir_open);
    ?>
    </select>
    <input type="submit" name="submit" value="Hae" class="basebutton" style="width: 55px;"></form></h5><br/>
    <?php
    if(isset($_POST['submit'])) {
    $htmlfile = $_POST['htmlfile'];
    $source="htmlinvoices/$htmlfile";
    if(file_exists($source))
    {
    $data=file_get_contents("$source");
    $path="download/$htmlfile";
    file_put_contents($path, $data);
    echo"Tiedosto kopioitu $path";
    }
    else {
    echo"Haettua tiedostoa ei löydy";
    }
    }
    ?>
</div>

Im fetching invoices, what are in html-format. For real, i need to fetch all invoices between whole month. That needs some extra functions, but due that i like to learn this coding from beginning, i test these with one function at time. I go blind, if i see 500-rows code from start, and try to figure out, how it is working :-D

Hi,
No luck still.
With this version part of script. It writes the filename to web-root folder, but nowhere else in local "laptop" shares. And the written file doesn't have nothing inside. It's empty. As this test is done in my laptop's web-environment, target is to put script to real web-site, and get files from it to local machine. Yes, there is another ways to do this, like ftp classes. But i try hard to avoid numbers of classes implemented on my site.

    <?php
    if(isset($_POST['submit'])) {
    $file = $_POST['file'];
    $source=$file;
    $data=file_get_contents("$source");
    $path="$file";
    file_put_contents($path, $data);
    }
    ?>

There is no updates. Did'n get how to put filename as variable,as it is already variable???

There is no warnings at all. Just a submit flash, when selectin filename from dropdown. Selected filename is displayed, but nothing else happen.
How to store contents? Tried to put it as variable, but no luck.

Hi,
Yes, there is examples of these strings, and using quotes differences by case. In this case, double quotes didn't make difference.
I think that in this case, issue is writing to local disk, because in other similar script, i can write to server-folder. That script uses ob_get_contents.
How to tell server, that do not try to find "download"-folder in server share. It is in local disk!

Hello,
Simple is not so simple i see,
Trying to save file in html-format from server to local disk.

    <?php
    if(isset($_POST['submit'])) {
    $file = $_POST['file'];
    file_get_contents('files/$file');
    file_put_contents('download/$file');
    }
    ?>
    <form method="post" action="">
    <select name="getfile" id="getfile">
    <option value="">Select file...</option>
    <?php
    $dir_open = opendir('files/');
    while(false !== ($filename = readdir($dir_open))){
    if($filename != "." && $filename != ".."){
        echo "<option value='$filename'>$filename</option>";
    }
    }
    closedir($dir_open);
    ?>
    </select>
    <input type="submit" name="submit" value="Get file" class="basebutton" style="width: 55px;">
    </form>

Looks simple, get filename, but writes nothing to download-share in local disk.
Local share is granted to everyone and IIS-users.

More bugs found...
If you want to reset password function work, remove

// BUG: I'm not sure this would work; if the boolean value false was returned, would it still be the boolean value false after being Sanitized?
      $username = SanitizeUsername($this->GetUsernameFromEmail($confirmedemail))

        to
       $username = $this->GetUsernameFromEmail($confirmedemail))

function NotifyOfnewpwd, is not working still, but you know the change of password, because you had the reset-link in eMail allready....

Well...
As eMail-functions doesn't work also with this script, i found a fix for that as well.
Skipping all "// $mailer->From = $this->GetFromAddress();" lines, enables sending eMails.
GetFromAddress doesn't work with any combination of using $host or what ever. Doesn't get this variable value to mailer From-tag.
Removing these lines, doesn't put effect to received eMail. From is there anyway.

Oh what a task to put this working. Im now allmost in completion, and happy that i got current level of more secured membersite-pages.
Let's see, iif i found still more unstability from fg_membersite ;-)

function CheckLogin() sets this same after login. Samekind of error as was with login-script... Doing things before the first steps are not yet done.

Testing testing...
Jumping over session_set_cookie_params, allows login, even it was just a minute ago denied.
Dummy question. Do i need cookie expiration necessarily?

    function Login()
    {
        if(empty($_POST['username']))
        {
            $this->HandleError("UserName is empty!");
            return false;
        }

        if(empty($_POST['password']))
        {
            $this->HandleError("Password is empty!");
            return false;
        } 

        if(!isset($_SESSION)) {
//            session_set_cookie_params(3600,'/','',true,true); // make it expire after 1 hour
            session_start();
            if ($this->CSRFTokenRequired) {
                $token = hash("sha512",mt_rand(0,mt_getrandmax()));
                $_POST['CSRFtoken'] = $_SESSION['CSRFtoken'] = $token;
            }
        }

When i login with old-site, what uses old version of membersite, login is successful. After i logout from old-site and try new site login, it is working. This oldsite generated session clears up sessions.
So the fault is in session functions in new version of fg_membersite.
I could try to replace session parts of code with old version, but rather figure out, what is wrong in new code, because it is more advanced.