Jump to content

SalientAnimal

Members
  • Posts

    366
  • Joined

  • Last visited

Everything posted by SalientAnimal

  1. Thanks again Jacques, I'm going to get cracking on trying to get this to work. I am assuming that with this solution each user would only appear in the activity table once? Once I have the heartbeat up and running, the next thing I want to achieve, is to use this as a tracking system to see when a user logs in / out on a daily basis and use it as a register. Would you recommend using the same table to track this information? Or should I then look at doing this in a completely separate table? I was thinking of possibly creating a view and updating it daily with the first login event of a day, and last logout event.
  2. Gizmola, I have two questions: How do I know if my webhost will support websockets to perform this function? If I decide to run my site as an intranet, how would I gain access to the websockets? I'm looking for a solution that it rather easy to implement and understand, but from what I have read thus far I am left scratching my head... Thanks
  3. You need to grab the user's id from your session data and add it to your url. It appears as if you are assigning the user to the id variable, instead of assigning the id variable to id. affiliate-profile.php?id=$id
  4. Based on what you have said Jacques, would it be correct in assuming that you could use the Ajax heartbeat as an activity status, i.e. online, away, offline. The HTTP request, would be on every single page and would therefore only update if and when some sort of link is clicked on the page? So based on this I would have a table with a structure such as memberID, activity_status, heartbeat, last_active The columns will function as follows: activity_status - HTTP request timestamp, heartbeat - Ajax request timestamp, last_active - the time of the logout request. How will it identify if a user goes offline? The HTTP request will only update when a request is sent, but what happens if JavaScript is blocked and the user simply closes the browser? What are your thoughts? Any idea where I could read up on a good tutorial for implementing what you have mentioned? Thanks
  5. Hi All, I have been searching for quite some time now for a script / process to check user online / offline status. I know there is no real "Ideal way" to check the status, as there could be a number of reasons for a user being "Offline / Online". My search for an updated way to check this has been fruitless and I was hoping that someone could either direct me to where I could read up on this, or perhaps give me some guidance. My thought process is that a user sessiontable would have to be created, this table will update when a user logs in in one column and logs out in another column... This way I can check when a user was last online, coupled with a current active session. The catch here is a user needs to physically logout... What of they don't logout? What if they go "Inactive" but are still online, so set an "Away" status. Any advice / guidance will be greatly appreciated. Thanks.
  6. I thought they would have it setup because I can't access or see any of the config files. So what could be missing / preventing the e-mails from coming through? Is there a check I can run?
  7. I am using / attempting to use PHP's mail function. How would I get access to the pgp.ini file though if I'm having my files run by a hosting company? Wouldn't / shouldn't these setting then already have been applied?
  8. Thanks again for your help, I have gone with the $_SERVER['DOCUMENT_ROOT'] option, and now have my form processing correctly and generating an activation e-mail with the link as expected (all data written to database). Now I just need to figure out as to why the activation e-mail delivery is failing / being rejected. A slow process to building this, but so far I am liking what I am seeing.
  9. Thanks Ch0cu3r, I'm going to implement your recommendations now and will hopefully sort out my issues. I really appreciate the help here. I didn't really want to use the absolute files paths, but I wasn't / am not sure how to refer back to the correct files without either duplicating a dbconfig file as an example inside each folder, but this makes it tedious to update each time. I like to try and add "files" that perform different functions in different folders... But I'm not always entirely sure of how to do this. From what you saying, is it safe to assume that I could always just have the $_SERVER['DOCUMENT_ROOT']. prefixed in front of any path / url and this will work? At the moment I am using file paths instead of url's because I'm doing a test build on my local machine.
  10. Hi there, I have included my code below. I uploaded the files here just in my earlier post. Form Page: <!DOCTYPE html> <?php //INCLUDE ANY INCLUDE FILES error_reporting(E_ALL & ~E_NOTICE); require_once('C:/xampp/htdocs/includes/dbconfig.php'); //CHECK IF THE USER IS ALREADY LOGGED IN //IF THE USER IS LOGGED IN REDIRECT THEM TO THE HOMEPAGE if( $user->is_logged_in() ){ header('Location: C:/xampp/htdocs/home.php'); } ?> <html> <head> <meta charset="utf-8"> <!-- LINKING TO FAVICON FILES --> <!--[if IE]><link rel="shortcut icon" href=="img/favicon.ico"><![endif]--> <link rel="icon" href="img/favicon.png"> <link rel="apple-touch-icon-precomposed" href="favicon.png"> <link rel="stylesheet" type="text/css" href="css/demo.css" /> <link rel="stylesheet" type="text/css" href="css/style3.css" /> <link rel="stylesheet" type="text/css" href="css/animate-custom.css" /> <!-- THIS IS THE TITLE TAG FOR THE CONTACT CENTRE MANAGEMENT SYSTEM --> <!-- <title><?php if(isset($title)){ echo $title; }?></title> --> <title>TechDesignLab - CCIS</title> </head> <body> <div class="container"> <!-- CODROPS TOP NAVIGATION BAR START --> <div class="codrops-top"> <a href=""> <strong>« Some Links</strong>Here </a> <span class="right"> <a href="http://www.techdesignlab.co.za"> <strong>System designed by TechDesignLab.co.za</strong> </a> </span> <!-- TRANSPARENT HIGHLIGHT OVER TOP NAVIGATION --> <div class="clr"></div> </div> <!--/ CODROPS TOP NAVIGATION BAR END --> <header> <h1>YOUR COMPANY NAME / LOGO <span>Contact Centre Information Systems</span></h1> </header> <?php //CHECK PAGE FOR ANY ERRORS if(isset($error)){ foreach($error as $error){ echo '<p class="bg-danger">'.$error.'</p>'; } } //IF THE ACTION IS JOINED SHOW SUCCESS if(isset($_GET['action']) && $_GET['action'] == 'joined'){ echo "<h2 class='bg-success'>Registration successful, please check your email to activate your account.</h2>"; } ?> <section> <div id="container_demo" > <!-- hidden anchor to stop jump http://www.css3create.com/Astuce-Empecher-le-scroll-avec-l-utilisation-de-target#wrap4 --> <a class="hiddenanchor" id="toregister"></a> <a class="hiddenanchor" id="tologin"></a> <div id="wrapper"> <div id="login" class="animate form"> <form action="processing/login.php" autocomplete="on" method="post"> <h1>Log in</h1> <p> <label for="username" class="uname" data-icon="u" > Username / E-Mail </label> <input id="username" name="username" required="required" type="text" placeholder="YourUserName OR [email protected]" value="" tabindex="1"/> </p> <p> <label for="password" class="youpasswd" data-icon="p"> Password </label> <input id="password" name="password" required="required" type="password" placeholder="eg. X8df!90EO" tabindex="2"/> </p> <p class="keeplogin"> <input type="checkbox" name="loginkeeping" id="loginkeeping" value="loginkeeping" tabindex="3"/> <label for="loginkeeping">Keep me logged in</label> </p> <p class="login button"> <input type="submit" value="Login" /> </p> <p class="change_link"> Not registered yet ? <a href="#toregister" class="to_register">Register Here</a> </p> </form> </div> <div id="register" class="animate form"> <form action="processing/register.php" autocomplete="on" method="post"> <h1> Sign up </h1> <p> <label for="usernamesignup" class="uname" data-icon="u">Username </label> <input id="usernamesignup" name="usernamesignup" required="required" type="text" placeholder="YourUserName" value="" tabindex="4"/> </p> <p> <label for="emailsignup" class="youmail" data-icon="e" > E-Mail </label> <input id="emailsignup" name="emailsignup" required="required" type="email" placeholder="[email protected]" value="" tabindex="5"/> </p> <p> <label for="passwordsignup" class="youpasswd" data-icon="p"> Password </label> <input id="passwordsignup" name="passwordsignup" required="required" type="password" placeholder="eg. X8df!90EO" tabindex="6"/> </p> <p> <label for="passwordsignup_confirm" class="youpasswd" data-icon="p">Password Confirmation </label> <input id="passwordsignup_confirm" name="passwordsignup_confirm" required="required" type="password" placeholder="eg. X8df!90EO" tabindex="7"/> </p> <p class="signin button"> <input type="submit" value="Register" name="register"/> </p> <p class="change_link"> Already registered ? <a href="#tologin" class="to_register"> Login Here </a> </p> </form> </div> </div> </div> </section> </div> </body> <script> </script> </html> Submission Page: <?php //IF THE FORM HAS BEEN SUBMITTED, PROCESS IT error_reporting(E_ALL & ~E_NOTICE); require_once('C:/xampp/htdocs/includes/dbconfig.php'); if(isset($_POST['submit'])){ //VERY BASIC VALIDATION OF USERNAME if(strlen($_POST['usernamesignup']) < 6){ $error[] = 'Your username is required to be a minimum of 6 characters.'; } else { $stmt = $db->prepare('SELECT username FROM sys_members WHERE username = :username'); $stmt->execute(array(':username' => $_POST['usernamesignup'])); $row = $stmt->fetch(PDO::FETCH_ASSOC); if(!empty($row['usernamesignup'])){ $error[] = 'The username you have entered is already in use.'; } } if(strlen($_POST['passwordsignup']) < 6){ $error[] = 'Your password should be at least 6 characters in length.'; } if(strlen($_POST['passwordsignup_confirm']) < 6){ $error[] = 'Your confirmation password should be at least 6 characters in length.'; } if($_POST['passwordsignup'] != $_POST['passwordsignup_confirm']){ $error[] = 'Passwords do not match.'; } //VERY BASIC VALIDATION OF E-MAIL if(!filter_var($_POST['emailsignup'], FILTER_VALIDATE_EMAIL)){ $error[] = 'Please enter a valid email address'; } else { $stmt = $db->prepare('SELECT email FROM sys_members WHERE email = :email'); $stmt->execute(array(':email' => $_POST['emailsignup'])); $row = $stmt->fetch(PDO::FETCH_ASSOC); if(!empty($row['emailsignup'])){ $error[] = 'The e-maill address you have entered is already in use.'; } } //IF NO ERRORS HAVE BEEN CREATED CARRY ON if(!isset($error)){ //HASH THE PASSWORD $hashedpassword = $user->password_hash($_POST['passwordsignup'], PASSWORD_BCRYPT); //CREATE THE ACTIVATION CODE $activasion = md5(uniqid(rand(),true)); try { //CREATE THE USER IN THE DATABASE USING A PREPARED STATEMENT $stmt = $db->prepare('INSERT INTO sys_members (username,email,password,active) VALUES (:username, :email, :password, :active)'); $stmt->execute(array( ':username' => $_POST['usernamesignup'], ':email' => $_POST['emailsignup'], ':password' => $hashedpassword, ':active' => $activasion )); $id = $db->lastInsertId('memberID'); //SEND A VERIFICATION / ACTIVATION E-MAIL TO THE USER $to = $_POST['emailsignup']; $subject = "Registration Confirmation"; $body = "<p>Thank you for registering at demo site.</p> <p>To activate your account, please click on this link: <a href='".DIR."activate.php?x=$id&y=$activasion'>".DIR."activate.php?x=$id&y=$activasion</a></p> <p>Regards Site Admin</p>"; $mail = new Mail(); $mail->setFrom(SITEEMAIL); $mail->addAddress($to); $mail->subject($subject); $mail->body($body); $mail->send(); //REDIRECT THE USER TO THE INDEX PAGE header('Location: .C:/xampp/htdocs/index.php?action=joined'); exit; //ELSE CATCH THE EXCEPTION AND SHOW THE ERROR. } catch(PDOException $e) { $error[] = $e->getMessage(); } } } //DEFINE THE PAGE TITLE $title = 'Demo'; ?>
  11. Included the dbconfig.php file as well as the error reporting at the top of each page. I'm back to getting a blank white page on submission. I've had to change some of my paths to absolute paths as the files are in different folders. Is there not a better way than using absolute paths?
  12. Does the dbconfig.php file have to be on both the form page and the submit page? Will include the error reporting now to check for additional info
  13. Named the submit button, but still no luck on writing to the database....
  14. I can't believe I missed the method... Feel like a fool... Ok so now that I've added that I checked and can confirm that the array now holds the data, but now it's not writing to the database. I still have to read through everything again so see what I may be missing.
  15. Hi, I am using POST. I have uploaded my files to verify. index.php register.php
  16. Hi All, I am currently working on a login / registration page combination. My form seems to not be passing any of the data into the array to be written to the database. Could someone perhaps help me in identifying where this issue may be? When clicking submit on registration, I get take to a blank page, and all the information entered in the form is displayed in the browser address bar (http://localhost/processing/register.php?usernamesignup=MyUsername&emailsignup=Mye-mail%40myemail.com&passwordsignup=123456&passwordsignup_confirm=123456) , adding var_dump($_POST);exit; to my form submit page, the array is shown on a blank white page as array(0) { } Please let me know if I show add my code, or if there are other error / validation checks I can do. Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.