-
Posts
960 -
Joined
-
Last visited
Posts posted by Destramic
-
-
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:
Array
(
[0] => Array
(
[0] => :action(activation-key|
[1] => activation_key2|
)
[1] => Array
(
[0] =>
[1] =>
)
[2] => Array
(
[0] =>
[1] =>
)
[3] => Array
(
[0] => :action(activation-key
[1] => activation_key2
)
[4] => Array
(
[0] =>
[1] =>
)
)a result like this is what im after if anyone could help please:
Array
(
[0] => Array
(
['parameter'] => :action
[0] => activation_key1[1] => activation_key2
[2] => activation_key3
)
)thank you guys
-
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
-
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
-
hey guys im after a bit of advise on routing within my framework please.
now i've created a route:
account/verify/email-address/:email_address/activation-key/:activation_key
which will be then interpurated into
account/verify/email-address/destramic-at-hotmail-dot-com/activation-key/12345
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
-
worked great thank you
-
Is there a way of accomplishing what I need in a rewrite?
-
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
-
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:
users/activate-account?email_address=test&token=test
i have to use $_SERVER['REQUEST_URI'] unless im doing something wrong?
[REQUEST_URI] => /bisi/user/activate-account?email_address=test&token=test
by doing this:
print_r($_GET);
all i get is :
Array ( [uri] => user/activate-account )
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
-
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
-
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
-
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 }
-
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>
-
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
-
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
-
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"; } ?>
-
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
-
Any reason why you don't use existing analytics tools?
like what?...basically im just after the views of items users browse
Don't bother checking that - just add the new record. It's okay to have more than one row for it. Plus you get a record of every time the user visited, not just the first time.
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?
-
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
-
ummm im not usinfg a mail function...im connection to my stmp server and sending it from there
-
Check the headers on the message and take a look at
Return Path:
From:
are they the same domain names or different?
Also What does it say by
Received-SPF
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
Connection: opening to bisi.bid:25, t=300, opt=array ()
Connection: opened
SERVER -> CLIENT: 220 rlinux20.grserver.gr ESMTP Postfix
CLIENT -> SERVER: EHLO bisi.bid
SERVER -> CLIENT: 250-rlinux20.grserver.gr250-PIPELINING250-SIZE 16777216250-ETRN250-STARTTLS250-AUTH PLAIN DIGEST-MD5 LOGIN CRAM-MD5250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
CLIENT -> SERVER: EHLO bisi.bid
SERVER -> CLIENT: 250-rlinux20.grserver.gr250-PIPELINING250-SIZE 16777216250-ETRN250-AUTH PLAIN DIGEST-MD5 LOGIN CRAM-MD5250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN
CLIENT -> SERVER: AUTH LOGIN
SERVER -> CLIENT: 334 VXNlcm5hbWU6
CLIENT -> SERVER: bm9yZXBseUBiaXNpLmJpZA==
SERVER -> CLIENT: 334 UGFzc3dvcmQ6
CLIENT -> SERVER: YTFfQ3MzZzg=
SERVER -> CLIENT: 235 2.7.0 Authentication successful
CLIENT -> SERVER: MAIL FROM:<noreply@bisi.bid>
SERVER -> CLIENT: 250 2.1.0 Ok
CLIENT -> SERVER: RCPT TO:<ricky.powell@hotmail.co.uk>
SERVER -> CLIENT: 250 2.1.5 Ok
CLIENT -> SERVER: DATA
SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
CLIENT -> SERVER: Date: Sun, 16 Nov 2014 14:54:53 +0200
CLIENT -> SERVER: To: Ricky Powell <ricky.powell@hotmail.co.uk>
CLIENT -> SERVER: From: "BiSi.bid" <noreply@bisi.bid>
CLIENT -> SERVER: Reply-To: First Last <noreply@bisi.bid>
CLIENT -> SERVER: Subject: BiSi - Welcome Ricky
CLIENT -> SERVER: Message-ID: <78fd33649e5c92f3ac6b165de1090274@bisi.bid>
CLIENT -> SERVER: X-Priority: 3
CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.9 (https://github.com/PHPMailer/PHPMailer/)
CLIENT -> SERVER: Organization: Sender Organization
CLIENT -> SERVER: MIME-Version: 1.0
CLIENT -> SERVER: Content-type: text/plain; charset=iso-8859-1
CLIENT -> SERVER: X-Priority: 3
CLIENT -> SERVER: X-Mailer: PHP5.5.12
CLIENT -> SERVER: MIME-Version: 1.0
CLIENT -> SERVER: Content-Type: multipart/alternative;
CLIENT -> SERVER: boundary="b1_78fd33649e5c92f3ac6b165de1090274"
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_78fd33649e5c92f3ac6b165de1090274
CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: This is the body in plain text for non-HTML mail clients
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_78fd33649e5c92f3ac6b165de1090274
CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: welcome to bisi. really glad you regustered
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_78fd33649e5c92f3ac6b165de1090274--
CLIENT -> SERVER:
CLIENT -> SERVER: .
SERVER -> CLIENT: 250 2.0.0 Ok: queued as 9759916E448A
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 2.0.0 Bye
Connection: closed
-
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!"; }
-
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
-
- Tell your users about password managers like KeePass. This is really the only realistic solution for managing dozens of different user accounts.
- Maybe add a password meter as an indicator for the user. This motivates them to choose a strong password instead of punishing them for what you think is a bad password. Since you cannot reliably estimate the strength of the password, it's also important that the check can be bypassed.
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:
- de$traM1c
- de$TR4M!C
- de$7rAm!c
- d3sTr4M!c
- DE$tr4m1c
- DE$7ram!c
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.
-
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
regex not working
in Regex Help
Posted
works great thank you requinix