Jump to content

Destramic

Members
  • Posts

    969
  • Joined

  • Last visited

Everything posted by Destramic

  1. well id like to check if users exists first before entering a log in attempt...after a bit more researching i think i need something like this but it doesn't work INSERT INTO login_attempts (identity) VALUES ('destramic@hotmail.com') WHERE NOT EXISTS (SELECT user_id FROM users WHERE email_address = 'destramic@hotmail.com') is this even possible? thank you
  2. hey guys im wondering if it's possible to insert a row if a value exists inside another table? for instance the code below i wish to make a log in attempt record if the user actually exists in the users table INSERT INTO login_attempts ('identity') VALUES ('name@example.com') SELECT user_id FROM users WHERE email_address = 'name@example.com' thanks you
  3. Hey guys I've discussed on here another about tokens but I'm wondering how you'd do a single request token. What I mean is when a user logs in and got to account setting and clicks on change password I'd like the user to be redirected to the login form to confirm authenticity then the user can view change password page if successful. If it's the best way? This means the users has confirmed security and they'd able to change important credentials for that particular page and no other without going through the same process. How can this be achieved please? Thank you
  4. i sorted the problem out now...these headers will send a multipart email plain and html depending on users mail settings. heres the headers //$this->_CRLF = \n which depends on OS $boundary = md5(time()); $headers = "From: name here <noreply@example.bid>" . $this->_CRLF; $headers .= "To: my name <example@example.com>" . $this->_CRLF; $headers .= "Subject: hello" . $this->_CRLF; $headers .= "MIME-Version: 1.0" . $this->_CRLF; $headers .= "Content-Type: multipart/alternative; boundary=" . $boundary . $this->_CRLF; $headers .= "This is a multi-part message in MIME format" . $this->_CRLF; $headers .= "--" . $boundary . $this->_CRLF; $headers .= "Content-type: text/plain; charset=iso-8859-1" . $this->_CRLF; $headers .= "hello, plain text" . $this->_CRLF. $this->_CRLF; $headers .= "--" . $boundary . $this->_CRLF; $headers .= "Content-type: text/html; charset=iso-8859-1" . $this->_CRLF; $headers .= "<b>hello</b>" . $this->_CRLF; $headers .= "--" . $boundary . "--" . $this->_CRLF; $this->send_command($headers . '.' . $this->_CRLF); thanks for your help guys
  5. brilliant...thank you very much for that useful information...I've certainly been doing things wrong thanks again mac_gyver
  6. well my issue is that i save the users language ie. en and timezone offset ie, +01:00...which is saved under a session cookie for 20 days...now say for instance if a user logs in a doesn't want to be remembered (save id in session cookie)...this has become a bit difficult as lifetime is set and effects all sessions set due to this code. ini_set('session.gc_maxlifetime', 60*30); session_set_cookie_params(60*60*24*20, '/'); is it good practice for me to create a session table?...that way i can save sessions there making each session flexible to a lifetime? or also i was thinking which may be way out there is...for each session i create a lifetime ie. session_start(); $_SESSION['name'] = "destramic"; $lifetime = 60*60*2 $_SESSION['name_lifetime'] = time() + $lifetime; hope you understand my difficulty thanks yiou
  7. sorry for the confusion....after trying the following code before and NOT after session_start() it worked as i wanted.. session_save_path('C:\Users\Ricky\Desktop\www\scripts\session'); ini_set('session.gc_probability', 1); ini_set('session.gc_maxlifetime', 360*72); session_set_cookie_params(360*72, '/'); is it possible to remember only certain session values and then to set other session values just to be kept until browser closes?...seems when i alter session cookie parameters it effects every session i create from there on... if not i had read about storing session_id and session values in a database which could work perfectly when it comes to giving certain values different lifespans thank you
  8. ok well i've been trying to figure a few things out with session files but have some questions if someone can please clear up. 1. i can read the session file (using the code below)...which is saved as the users session_id() but if the user closes the browser how do i know what file is theirs as a new session_id() would be regenerated automatically upon revisiting....so would i know what file to load in this instance? $contents=file_get_contents('http://localhost/scripts/session/sess_4653e1122ead235d30f928f71308c805'); session_start(); session_decode($contents); print_r($_SESSION); 2. i set session_set_cookie_params() to 20 seconds, and was expecting the session file to be removed after then or non accessible after that period, but i still am able to read the file... session_set_cookie_params('20', '/'); i could use the totch() function to set the modification file time and know if file has expired that way... but if i could have some advise on how i can do these things then that would be great. thanks guys
  9. worked like a dream thank you. now that i have the session data saved in a private directory...am i able to access it when user reopens browser and visits my site so that i can get any credentials I've stored...like timezone, language etc?
  10. hey guys im trying to save a session as a cookie using session_set_cookie_params(); the problem im getting is that the session file ins't being saved in the directory i specifiy when usings session_set_cookie_params(); session_start(); session_set_cookie_params('3600', PRIVATE_DIRECTORY . 'data' . DS . 'session', $config->base_url, false, true); ini_set('session.gc_probability', 1); $_SESSION['foo'] = "bar"; what i want to do is save the session cookie and when user closes browser and then re-enters the site the session is still there...(unless that's not how it works) any help would great thanks guys
  11. yeah im not trying to send a multipart email plain text and html =/...basically if i just sent a plain or email without it being multipart it sends perfectly i'm not a fan of using script other people have used...i like to break something down and write it myself...but i can't workout for the life of me why the message is blank
  12. $command = "From: BiSi.bid <noreply@bisi.bid>" . $this->_CRLF; $command .= "To: Ricky Powell <ricky.powell@hotmail.co.uk>" . $this->_CRLF; $command .= "Subject: hello" . $this->_CRLF; $command .= "MIME-Version: 1.0" . $this->_CRLF; $command .= "Content-Type: multipart/alternative; boundary=" . $boundary . $this->_CRLF; $command .= "Content-Transfer-Encoding: 7bit" .$this->_CRLF; $command .= "--" . $boundary . $this->_CRLF; $command .= "Content-type: text/plain; charset=iso-8859-1" . $this->_CRLF; $command .= "Content-Transfer-Encoding: 7bit" . $this->_CRLF; $command .= "Content-Transfer-Encoding: quoted-printable" . $this->_CRLF; $command .= "plain text" . $this->_CRLF; $command .= "-- " . $boundary . $this->_CRLF; $command .= "Content-type: text/html; charset=iso-8859-1" . $this->_CRLF; $command .= "Content-Transfer-Encoding: 7bit" . $this->_CRLF; $command .= "Content-Transfer-Encoding: quoted-printable" . $this->_CRLF; $command .= "<b>hello</b>" . $this->_CRLF; $command .= "--" . $boundary . "--" . $this->_CRLF; $this->send_command($command . '.' . $this->_CRLF); print_r($this->get_response()); after playing with the code i not get the email in my inbox but the message is empty...any ideas why?
  13. anyone able to help on this ball ache, multipart emial please?
  14. ok well i found out i needed to set the content type to multipart/alternative with boundaries some reason its not sending to my inbox...can anyone please tell me why? $boundary = uniqid('email'); $command = "MIME-Version: 1.0" . $this->_CRLF; $command .= "To: Ricky Powell <ricky.powell@hotmail.co.uk>" . $this->_CRLF; $command .= "From: BiSi.bid <noreply@bisi.bid>" . $this->_CRLF; $command .= "Subject: hello" . $this->_CRLF; $command .= "Content-Type: multipart/alternative; boundary=$boundary". $this->_CRLF; $command .= "Content-type: text/plain; charset=iso-8859-1" . $this->_CRLF; $command .= "Content-Transfer-Encoding: quoted-printable" . $this->_CRLF; $command .= "This is a MIME encoded message" . $this->_CRLF; $command .= "-- " . $boundary . $this->_CRLF; $command .= "plain text" . $this->_CRLF; $command .= "-- " . $boundary . $this->_CRLF; $command .= "Content-type: text/html; charset=iso-8859-1" . $this->_CRLF; $command .= "Content-Transfer-Encoding: quoted-printable" . $this->_CRLF; $command .= "<b>html text</b>" . $this->_CRLF; $command .= $this->_CRLF . "--" . $boundary . "--" . $this->_CRLF; $this->send_command($command); $this->send_command('.' . $this->_CRLF); print_r($this->get_response()); thank you
  15. i got working now...i didnt add the DOT at the end of the message now that being done can i just ask a few questions please... 1. how do i add a body and a altbody?...for instance if the recipient doesn't support HTML emails i just just send alt-body. 2. what the difference between connection normally to the server to connecting using telnet? ie. fsockopen($host . ":" . $port, $error_number, $error_string, $timeout); vs fsockopen('telnet ' . $host . ' ' . $port); thank you
  16. i have been using \r\n on the other commands but the tutorial just used \n on that part so i assumed it was right...but after changing it i got the ok message ...so thank you thanks for the tip...i would do this on every fputs execution right? thanks again
  17. hey guys i'm trying to test and send a email via SMTP...now i'm able to connect to server and auth login which is fine...but im having a problem sending the email using this line...everything else returns ok from the server. problem is on this line: fputs($this->_smtp_connection, "To: ricky.powell@hotmail.co.uk, destramic@gmail.com\nFrom: noreply@bisi.bis\nSubject: hello\n$headers\n\n$message\n\n"); when using this code the server times out displaying error 500...i've tried to look if the command im using is correct and from what i can see on a tutorial it checks out. the code im using after connect and auth fputs($this->_smtp_connection, "MAIL FROM: noreply@bisi.bid" . $this->_CRLF); print_r($this->get_response()); fputs($this->_smtp_connection, "RCPT TO: ricky.powell@hotmail.co.uk" . $this->_CRLF); fputs($this->_smtp_connection, "RCPT TO: destramic@gmail.com" . $this->_CRLF); print_r($this->get_response()); fputs($this->_smtp_connection, "DATA" . $this->_CRLF); print_r($this->get_response()); $headers = "MIME-Version: 1.0" . $this->_CRLF; $headers .= "Content-type: text/html; charset=iso-8859-1" . $this->_CRLF; $headers .= "To: Ricky Powell <ricky.powell@hotmail.co.uk>" . $this->_CRLF; $headers .= "To: Ricky Powell <destramic@>gmail.com" . $this->_CRLF; $headers .= "From: noreply@bisi.bid <bisi.bid>" . $this->_CRLF; $message = "hello ricky."; //fputs($this->_smtp_connection, "To: ricky.powell@hotmail.co.uk, destramic@gmail.com\nFrom: noreply@bisi.bis\nSubject: hello\n$headers\n\n$message\n\n"); // print_r($this->get_response()); any help would be greatful...thank guys
  18. hey guys i've been having a problem with my server which displays the following: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error. More information about this error may be available in the server error log. and the problem was when i was calling for a class property which didn't exists...i was calling: $this->_ports; //instead of $this->_port; now surly that should of just throw a error as i have error reporting on? error log says: [Tue Apr 21 19:32:56.998858 2015] [fcgid:warn] [pid 2871:tid 140557745637120] (104)Connection reset by peer: [client 185.4.135.150:44715] mod_fcgid: error reading data from FastCGI server [Tue Apr 21 19:32:56.998927 2015] [core:error] [pid 2871:tid 140557745637120] [client 185.4.135.150:44715] End of script output before headers: index.php so i googled the problem and read to put this in my .htaccess but that hasn't helped <IfModule mod_fcgid.c> IdleTimeout 300 ProcessLifeTime 3600 # MaxProcessCount 1000 DefaultMinClassProcessCount 0 DefaultMaxClassProcessCount 100 IPCConnectTimeout 360 IPCCommTimeout 360 BusyTimeout 300 </IfModule> how can i stop the server from not displaying the page in the near future if i have a simple script error such as this? thank you
  19. hey guys...im trying to make a custom php.ini but im having some problems getting it to work. i included the path to my custom php.ini in my .htaccess file <IfModule mod_php5.c> php_value include_path ".:/var/www/vhosts/bisi.bid/bisi.bid/private/config" </IfModule> then i put this in my http.conf <Directory "/var/www/vhosts/bisi.bid/bisi.bid"> AllowOverride All </Directory> now when testing and when i put in my customer php.ini date.timezone = "Europe/London" i get result of Europe/Athens echo ini_get('date.timezone'); can anyone please tell me what i've done wrong please...thank you
  20. max_allowed_packet=288000 in my.cnf did the job
  21. hey guys i'm trying to import a .sql file to the database in phpmyadmin on my centos 7 dedicated server but it calls error: how to i increase the timeout limit please? thank you
  22. instead of using protected $post = array(); protected $get = array(); just allow you methods to get results directly from the $_POST or $_GET variable...that way it will always have up to date values when using my example above, the "age" value will then be picked up. <?php function test($name, $type = "POST") { $array = $_{$type}; return $array[$name]; } echo test('age');
  23. <?php $_POST['name'] = "test"; $input = new Input; $_POST['age'] = "99"; if ($input->is_set('age', 'POST')) { echo "set"; } else { echo "not set"; } if you call class and a global is set after then your class isn't gonna pick up
  24. also i wouldn't set POST or GET array in a property but just get it directly from the global variable $_SERVER $_REQUEST $_POST $_GET $_FILES $_ENV $_COOKIE $_SESSION
  25. simplicity is the way forward...you can also use your class to capture sessions...but that looks good to me
×
×
  • 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.