Jump to content

Destramic

Members
  • Posts

    969
  • Joined

  • Last visited

Everything posted by Destramic

  1. hey guys im using a session cookie to store a user_id, only if user has clicked to remember me on the login form...that way when autenticating it checks id in db and if matching a user it logs in automatically. now the problem i want to just remove user_id from a session cookie. if i use the code below to delete the user_id session then it will remove all session cookies. is there a way just to remove 1 session cookie? thank you // create session cookie session_start(); session_set_cookie_params('3600', 'C:\Users\Ricky\Desktop\www\BiSi\private\tmp\session', 'http://127.0.0.1/', true, true); ini_set('session.gc_probability', 1); session['user_id'] = 1; //delete session cookies setcookie (session_name(), null, time() - 3600); session_regenerate_id(true); any help/advise would be greatful...cheers guys
  2. like what?...basically im just after the views of items users browse well i was thinking of only adding to view count if user hasnt viewed page within 1 day. although i could get all records and DISTINCT the results?
  3. hey guys im trying to make a page statistics, where i get a view count of certian pages users visit. now im after a bit of advise on how the best way to achieve this here are my tables: CREATE TABLE IF NOT EXISTS `statistics` ( `statistic_id` int(11) NOT NULL AUTO_INCREMENT, `statistic_page_id` int(11) NOT NULL, `user_id` int(11) NOT NULL, `reference_id` int(11) NOT NULL, `ip_address` varchar(15) NOT NULL, `created_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`statistic_id`) ) CREATE TABLE IF NOT EXISTS `statistic_pages` ( `statistic_page_id` int(11) NOT NULL AUTO_INCREMENT, `page_name` varchar(90) NOT NULL, `created_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`statistic_page_id`) ) what i was thinking is when a user views the page it will check if user has already visited in the database SELECT user_id FROM statistics WHERE user_id = '1' OR ip_address = INET_ATON('1.1.1.1') AND statistic_page_id = '1' AND refernce_id = '10' if user or guest hasnt visited then add to database INSERT INTO statistics (statistics_page_id, user_id, refernece_id, ip_address, created_timestamp) VALUES ('1', '1' '10', INET_ATON('1.1.1.1'), UTC_TIMESTAMP()) statistics_page_id, would be the id representing a page ie. ITEMS and reference_id would be the id of the ITEM any advise on a better way on how it should be done would be super...cheers guys
  4. ummm im not usinfg a mail function...im connection to my stmp server and sending it from there
  5. I have the same retrun and from path, not sure what you mean about recieved-SPF but here is the the output im getting when i send the email. Thank you
  6. hey guys im using phpmailer (https://github.com/PHPMailer/PHPMailer) to send mail from my server to users using SMTP...the problem im getting is that when i send a mail it goes stright into the junk mail...how can i please stop this please? $mail = new \Mail\Mail; $mail->isSMTP(); $mail->Debugoutput = 'html'; $mail->Host = "****"; $mail->Port = 25; $mail->SMTPAuth = true; $mail->Username = "****"; $mail->Password = "***"; $mail->setFrom('***', '****'); $mail->addAddress('email@hotmail.co.uk', 'user'); $mail->Subject = 'BiSi - Welcome'; $mail->msgHTML('<a href="test">hello</a>'); $mail->AltBody = "This is the body in plain text for non-HTML mail clients"; if (!$mail->send()) { echo "Mailer Error: "; } else { echo "Message sent!"; }
  7. ok well thank you both for your views and your time ...for now i'll just scrap a password validation and allow the user to choose, possibly giving advise. thank you again guys
  8. i agree with what your saying...although you see all major websites ask users to have certain criteria in thier passwords...but what i was trying to achieve is: as all these password contain 2 of the wanted criteria (that was the regual expression i was looking for)...as long as the password is encrypted correctly it should secure, but...allowing a user to choose a simple password such as "mypassword" or something of that nature only reduces security.
  9. hey guys im trying to make a regual expresion for a password with the conditions that it must contain 2 of each character: upper case letter, lower case letter, number or symbol...i have the regular exprssion below individually but how do i put it into one expression please? possible matches: des$tramic destram1c Destramic ^ (?=.*[A-Z].*[!@#$&*]) // upper case letter with symbol (?=.*[A-Z].*[a-z]) // upper case letter with lower case letter (?=.*[A-Z].*[0-9]) // upper case letter with number (?=.*[!@#$&*].*[0-9]) // symbol with number (?=.*[a-z].*[!@#$&*]) lower case character with symbol (?=.*[a-z].*[0-9]) // lower case character with number $ thank you
  10. i managed to get the positoning right although im still having a few css issues if someone could please help if you view here http://139546017.reseller20.grserver.gr/test.html 1. basically when the image is hovered over it goes transparent then the overlay goes over the top of that....but for some reason the overlay is also transparent which i dont want. 2. also i put two divs inside the overlay div called left and right...what im trying to do is make the cropped image icon and the delete icon on the overlay as a active link advise or any help would be great thank you
  11. hey guys im trying to impliment a overlay to images uploaded by the user to allow to delete and crop...now im not sure if im going aroung this the right way (but it works sort of)...the problem im having is that the overlay.gif which is a transparent image which has 2 small images at the top of each corner...but when the original image is hovered over the overlay is out of position showing the 2 small images at the bottom of the div and not at the top where it should be. im guessing it is a css issue...any advise would be greatly appreciated...thank you #overlay { width: 110px; height: 110px; } .selected-image{ width: 110px; height: 110px; } #overlay:hover .selected-image { opacity: 0.4; filter: alpha(opacity=40); } #overlay:hover { background-image: url('overlay.gif'); width: 110px; height: 110px; } <div id="overlay"><img class="selected-image" src="logo.png" /></div>
  12. hey guys im trying to make a file upload script so that when the user uploads a pic it gets shown in a div...when you add another it is the added by the side of the 1st pic...but some reason when selecting a image nothing shows... what am i doing wrong? here is my code below if anyone can tell me what it is wrong im doing...thank you <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> <script> $( document ).ready(function() { var files = $('.input-file').prop("files"); var file_count = files.length; var names = $.map(files, function(val) { return val.name; }); $('#input-file-button').click(function() { $('.input-file').click(); }); $('.input-file').change(function (){ var file_name = $(this).val(); var file_path = URL.createObjectURL(event.target.files[0]); $('#uploaded-images').append('<div><img src="'+ file_path +'" /></div>' + file_name); }); if (file_count < 1) { $('#uploaded-images').text("No images are selected."); } }); </script> <style> .input-file { display: none; } </style> </head> <body> <div id="uploaded-images"></div> <br /> <input type="file" name="files[]" class="input-file"/><span id='input-file-button'>Upload Photo</span> </body> </html>
  13. well this is embarrassing...yeah it works now for me...well sorry to have wasted your time, but thank you for you posts
  14. i've google but no luck on finding what i need....is there a way in javascript to compare 2 variables ie. var him = "jack"; var her = "jill"; if (him == her){ alert('same name'); } thank you
  15. lovely!, thanks alot for your help guys
  16. well i did a simple test and still did get the variable passed accross...but didnt work...i dunno what im doing wrong <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <?php $timezone_offset = "test"; ?> <script> var time = "test"; </script> <script src="global.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </body> </html> global.js alert(time); var timezone_offset = "<?php echo $timezone_offset; ?>"; alert(timezone_offset);
  17. i think the only way to put a php var in js is if the script is internal and not external
  18. i tested by putting <?php $test="hello"; ?> in my template file above where the script get loaded... when tyring to see if i could get the variable value in the script...no luck just doesnt make sense
  19. but the variables are extracted first before the template is included...so when rendering the template my variable should be accessable to the js file =/
  20. just shows up as var timezone_offset = <?= $timezone_offset ?>; the php variable isnt being executed
  21. well the php variable is in the extental js file which is included in the head...is this what your asking for? <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8" /> <script src="http://127.0.0.1/bisi/media/js/library/jquery/2.1.1/jquery.min.js"></script> <script src="http://127.0.0.1/bisi/media/js/library/jqueryui/1.11.2/jquery-ui.min.js"></script> <script src="http://127.0.0.1/bisi/media/js/scripts/global.js"></script> // here is the line of the file where php var is in <script src="http://127.0.0.1/bisi/media/js/scripts/user_timezone.js"></script> <link rel="stylesheet" type="text/css" href="http://127.0.0.1/bisi/media/css/items/items.css" /> <title>BiSi</title> </head>
  22. when tyring to pass a variable to a extenal javascript file it just shows up as a sting and the variable isnt beening executed var timezone_offset = <?= $timezone_offset ?>; im guessing its probably down to the fact the variable is being passed from my framework controller... so im wondering how do you send a variable to a external javascript file when using a framework? $this->view->timezone_offset = "test"; // in my controller // passing varibales to template in my view if (preg_match("/\.html$/i", $file_name)) { extract($this->_variables); require_once PRIVATE_DIRECTORY . 'application' . DS . 'views' . DS . $file_name; } thanks guys
  23. well i'm trying to be resourceful with my query's so i dont have to basically write the same one up with a bit of change...but that left join worked great thank you thank you
  24. when looking i bumped into this script, which i had to alter a few things function pad(number, length) { var str = "" + number while (str.length < length) { str = '0'+str } return str } var offset = new Date().getTimezoneOffset(); offset = ((offset <0 ? '-' : '+') + pad(parseInt(Math.abs(offset/60)), 2) + ':' + pad(Math.abs(offset%60), 2)); alert(offset); seems to do the trick in return the offset i need....+00:00
×
×
  • 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.