Jump to content

Destramic

Members
  • Posts

    960
  • Joined

  • Last visited

Everything posted by Destramic

  1. works great thank you requinix
  2. hey guys im trying to match a certain string with possible matchs like: :action(activation-key|activation_key2|activation_key3) ...etc :action(activation-key|activation_key2) :action(activation-key) (activation-key) ...etc unfortunatley im not getting the results im after and am now scratching my head. here is my code: $text = ":action(activation-key|activation_key2|activation_key3)"; if (preg_match_all('/<parameter>(.*?)\((.*?)|(.*?)\||\|(.*?)\)$/', $text, $match)) { print_r($match); } my result: a result like this is what im after if anyone could help please: thank you guys
  3. Well the only way I can think of validating account other than link is for them to fill out a form so the user can enter the code. Thank you for the link...had some great information on it...but I got a little confused on how it's best to generate a action request For instance you said using a uri like user/123/delete would be a bad way, which I agree...but what would be the best way to get around this? user/delete would be great but how to reference the id across? Thanks for your help
  4. yeah i did read up about how complex email address' are...although there are characters that as url unfriendly, mostly all email accounts only allow you to use a certian few characters which are url friendly. but i think i'll go with a user id instead. by the way i use urls to trigger actions?...well when a certian url is requested it will load the controller and action to it passing parameters which in this case is email address and activation key....what is it im doing wrong please? thank you
  5. hey guys im after a bit of advise on routing within my framework please. now i've created a route: which will be then interpurated into now my question is having a email address in a url is good idea? if so i can decode the :email_addres parameter in the route like so: $router->add_route('account/verify/email-address/:email_address/activation-key/:activation_key', array('controller' => 'users', 'action' => 'activate_account', 'decode' => 'email_addres' => 'string_to_email') )); would like your thoughts on this please guys (go easy)...if not a user_id would be sufficient i suppose thanks
  6. Is there a way of accomplishing what I need in a rewrite?
  7. this is what im using...is there a way of doing things better here to get $_GET as it should be? Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?uri=$1 [PT,L] thanks
  8. hey guys im having a bit of trouble getting $_GET in my framework. now the ony way to get query from a url such as: i have to use $_SERVER['REQUEST_URI'] unless im doing something wrong? by doing this: print_r($_GET); all i get is : just concerned im doing something wrong?...any advise on this please guys. was thinking of doing something like this in my request public function get_query($name = null) { $uri = $_SERVER['REQUEST_URI']; if (parse_url($uri, PHP_URL_QUERY)) { $query = explode("?", $uri); $query = explode("&", $query[1]); $array = array(); foreach ($query as $string) { $string = explode("=", $string); $query_name = $string[0]; $query_value = $string[1]; $array[$query_name] = $query_value; // $_GET[$query_name] = $query_value; possibly? } if ($name !== null && array_key_exists($name, $array)) { return $array[$name]; } return $array; } return null; } thanks
  9. Destramic

    timezones

    hey guys trying to think of a practical way for a user to select his/her timezone without having to listing all in a select element like so: Europe/London, Europe/Luxembourg, Asia/Singapore etc... i was thinking of having a select element listing +00:00, +01:00 etc... but i would have the problem of DST when clocks change what is the best solution for this please? thank you
  10. well my approach was to stop people accessing the page the json data is on unless it is a actual json request...was gonna put a script also which ensures the data is only gathered from my domain so its not local
  11. hey guys im tring to look for a good way of finding out if a ajax request is being performed on my page...now ive had a look about and found these two snippets. Both seems to work fine...any suggestions on what one is best to use or even if there is a better way to do this would be helpful...thank you if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === "xmlhttprequest") { // is ajax } if (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false){ // is ajax }
  12. hey guys i have like 4 spans which show at the bottom right hand side of my page which are currently overlapping...i've tried to display as block but no success. any help would be greatful...thank you live demo: http://jsfiddle.net/sr5fta4m/ here is my code: .notification { padding: 15px; margin-bottom: 20px; border: 1px solid #eed3d7; border-radius: 4px; position: absolute; bottom: 0px; right: 21px; float: right; clear: right; diplay: block; } #alert-notification { color: white; background-color: #DA4453; } #success-notification { color: white; background-color: #37BC9B; } #information-notification { color: white; background-color: #4A89DC; } #error-notification { color: white; background-color: #DA4453; } <span class="notification" id="success-notification">Registration complete. Please check your mail.</span> <span class="notification" id="alert-notification">Account already activated.</span> <span class="notification" id="information-notification">Please check you email.</span> <span class="notification" id="error-notification">Wrong login detials.</span>
  13. thank you for your post i got what i was after using if ($_SERVER['SERVER_NAME'] === parse_url($url, PHP_URL_HOST ) ) { return true; } thank you again
  14. hey guys im interested in the jquery notification scripts...where a user registers and then gets redirected to homepage where a notification pops up saying "thank you for registering". now ive looked at a few examples online but im clueless to how each individiual notification pops up is it activated by the refering url? would be good to know...but thats the only way to me that makes sense on how it works. thank you
  15. hey guys im making a script where the user gets redirected...but im wanting to make sure the redirection is within the same domain and not being shipped off to another site when using ($_SERVER['HTTP_REFERER']) now what im using seems to do the trick but im wondering if there is a better method of doing this?...i dont want to use regex either thank you guys <?php $match = strpos("http://127.0.0.1/login", $_SERVER['SERVER_NAME']); if ($match && $match > 0 || $match === 0) { echo "domain match"; } ?>
  16. 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
  17. 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?
  18. 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
  19. ummm im not usinfg a mail function...im connection to my stmp server and sending it from there
  20. 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
  21. 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!"; }
  22. 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
  23. 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.
  24. 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
×
×
  • 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.