PHP

Support group for those afflicted with PHP. Don't ask to ask, ...
Aug 7, 2017 14:10
Hi, can you guys help me with this IMG LINK i don't know how to make when i select gender for example Male, and when i try to select again, i get twice Male options, but i want to keep first because it is showing the currently one.
Aug 4, 2017 06:15
Can someone help me? I've made reset password for my site, but i'm stuck on part when i get url to my email "http://test.com/reset.php?cf0b80c0dec12f97f03e1718c529bd7193b0d67ccbeb14ddd1231‌​[email protected]" how to make it redirect user to change password page? How can i make check for that hash and email?
Aug 3, 2017 23:01
@IROEGBU That's not the point. I'm working on my project more then a year. I'm not gonna throw it away and download others scripts...
Aug 3, 2017 22:59
@tereško I'm just trying to make it with PDO
Aug 3, 2017 22:56
@tereško Nope
Aug 3, 2017 22:50
Hello guys again. I'm making "forgot password" function for my website, and i made all but i have a problem getting my input email adress. It sends to my email but if you open my github and page reset.php on line 6, that code is not working, that's the code i use to get email from input, but on line 7 when i type my email, everything is working fine. I upload all files there seperately.
Aug 3, 2017 19:35
Thank you guys, learned something new today :)
Aug 3, 2017 19:30
@fabor sry
Aug 3, 2017 19:29
$stmt = $handler->prepare("SELECT password FROM users WHERE email=:email");
$stmt->bindValue(':email', $email, PDO::PARAM_INT);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo $rows->password;
Aug 3, 2017 19:29
This is ok right?
Aug 3, 2017 19:29
$stmt = $handler->prepare("SELECT * FROM users WHERE email=:email");
$stmt->bindValue(':email', $email, PDO::PARAM_INT);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo $rows->password;
Aug 3, 2017 19:20
i tried ...WHERE email= '".$email."'"); but it's not working, and when i type my email like i show above...it's working
Aug 3, 2017 19:18
How to use variable to secure this from injection? $test = DB::getInstance()->query("SELECT password FROM users WHERE email= '[email protected]'");
Jul 26, 2017 08:33
It's ok, thank you for trying :)
Jul 26, 2017 08:33
Oh
Jul 26, 2017 08:32
What is wrong? Time(...) or just inside (...)
Jul 26, 2017 08:31
Complete or just insite it?
Jul 26, 2017 08:29
@JoeWatkins You mean mktime?
Jul 26, 2017 08:26
@JoeWatkins Ok then, what's wrong here? if(strtotime($r['activity']) > time("Y-m-d H:i:s", mktime(0, -2, 0)))
Jul 26, 2017 08:22
@JoeWatkins Ok because i'm in the same situation as i was without timestamp :P
Jul 26, 2017 08:18
Can someone help me about that timestamp?
Jul 26, 2017 08:05
Ok i set in phpmyadmin to timestamp, and now when i refresh the page, date is saved...but how to check now if user is not active?
Jul 26, 2017 08:00
@PaulCrovella if(strtotime($r['activity']) > date('Y-m-d H:i:s','-120 sec')) something like this?
Jul 26, 2017 07:57
@PaulCrovella I know what it is, but no experience with that...
Jul 26, 2017 07:55
@PaulCrovella Any example?
Jul 26, 2017 07:51
Nah, that's the whole code...i have when user refresh the page, his activity get update to current time, so if he doesn't refresh the page, after 2minutes, the code i showed you will show him offline icon.
Jul 26, 2017 07:45
This is the code...
Jul 26, 2017 07:44
if(strtotime($r['activity']) > time() - 60 * 2)
Jul 26, 2017 07:44
I made when user is not online 2 minutes, his green icon goes red. It's working fine, but when user is offline and real time goes to 00:00 he automatically switch to online, but he is not there. So it's the problem in time...i tested sometin, for example if it's 15:00 and if he goes offline after 2 minutes (15:02) and in phpmyadmin i change his activity time to 14:50 (for ex.) he went online lol I hope you understand me. if(strtotime($r['activity']) > time() - 60)
Jul 26, 2017 07:38
Can someone help me with datetime? It's half working...
Jul 26, 2017 07:37
hi
Mar 20, 2017 02:33
@Wes Hi, still didn't figured out how to fix scrollbar in chat :P damn
Mar 19, 2017 06:13
$user = new User();
if(empty($_POST['message'])){

}else{
    if(isset($_POST['message'])){
        $user = new User();
        if(!$user->exists()){

        }else{
            $data = $user->data();
            $owner = $data->username;
            $avatar = $data->avatar;
            $message = $_POST['message'];
            $created = date("h:i:s");
            $sql = "INSERT INTO `chat` (message, owner, created, avatar) VALUES (:message, :owner, :created, :avatar)";
            $query = $handler->prepare($sql);
Mar 19, 2017 06:10
@Wes Damn, i cannot get it work to check when the second user type a message, so the first get scroll update.
Mar 19, 2017 05:49
i belive that is not correct right?
Mar 19, 2017 05:48
if(!$("#chatbox").animate({ scrollTop: $("#chatbox").height() }, "fast"))
Mar 19, 2017 05:48
how to check if it's not on bottom?
Mar 19, 2017 05:40
It's working but now when i want for example to see old messages and scroll up, but the timer will scroll me to the bottom.
Mar 19, 2017 05:37
and i'm reading messages from load.php
Mar 19, 2017 05:37
Don't focus on that line...that just update online users...$("#chatbox").html(data); is the chat.
Mar 19, 2017 05:36
function auto_load(){
    $.ajax({
        url: "load.php",
        cache: false,
        success: function(data){
            $("#chatbox").html(data);
            $("#online-users").load(location.href + " #online-users>*", "");
            setTimeout(auto_load, 3000);
        }
    });
}
Mar 19, 2017 05:36
i already have...
Mar 19, 2017 05:34
Do you know how can i make that happen? It's ajax chat...
Mar 19, 2017 05:33
That was just my try...i don't know what to try else...
Mar 19, 2017 05:32
I want to make when other user type something in chat, the script automaticly scroll to bottom for everyone.
Mar 19, 2017 05:30
no...i used <script> in php
Mar 19, 2017 05:30
i did it in <script> tag
Mar 19, 2017 05:28
I did put that on message isnert in base, so if someone type a message i made i check for ex if(isset($_POST['message'])) and then i put that for scroll and it's not doing anything.
Mar 19, 2017 05:26
or that div...
Mar 19, 2017 05:26
But i'm having a problem when that page updates