-
Posts
6,906 -
Joined
-
Last visited
-
Days Won
99
Everything posted by ginerjm
-
how to fetch values from a loop in a function?
ginerjm replied to shan2batman's topic in PHP Coding Help
You didn't tell us what the problem is, but why don't you look at this line: $friend = $friends[$i] You will always get the last key value in your loop. Is that what you want? -
They are working on it. No idea from their end, but I think they change my ini file when I had them fix my timezone problem last week.
-
Trying to duplicate a Form field without success
ginerjm replied to Chrisj's topic in PHP Coding Help
You need to learn how RDBMS really work and what proper table design is. NO - you don't add another column; you produce a second record. I could write for 10 minutes telling you more but it would behoove you better to spend a few hours reading and learning what I would attempt to tell you. Better you teach yourself some things before going further in this endeavor. -
Trying to duplicate a Form field without success
ginerjm replied to Chrisj's topic in PHP Coding Help
If you want multiple tags you have to use a different name attribute. If you name them all 'tags' you will only get one. Either alter the name or use the html array format for naming. -
I use emails to send some data regularly to some of my apps. Yesterday my email failed me with some strange messages. Besides messages about unknown items failing to load for the script, it also said that PDO was an unknown class. That is very strange. The line that triggers that message is: $db_options = array( PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC); which is the puzzling thing. I use this same module to do my database connects everywhere and it continues to work for my 'regular' appls, just not for the scripts that are piped-to from an email. Any idea what may have happened here? This is running on my host's server so I have no control over it.
-
I agree with Jacques1. I also think I gave you the reason for my/our position in my previous post. It goes against all well-defined principles of data storage to do what you are doing. Do you really think you are qualified to re-invent the (database) wheel? Answer me/us this. Suppose you need to count one of the many unique data values that you have embedded in multiple records in your database, ie, for some reason you want to analyze the values you have. In a properly normalized database it is simply a quick and dirty sql query. For you? This idea of properly normalized databases is 1) not new. It's been around since my college days; and 2) nobody else is coming up with a "new and improved" method for data storage, at least not in the logical sense. What makes you think you have to do it?
-
Best Approach To Recover Password For A Company
ginerjm replied to phdphd's topic in PHP Coding Help
HTH -
Thirty years I've been in this - never heard of such a scheme. IMHO - you'll live to regret this.
-
Best Approach To Recover Password For A Company
ginerjm replied to phdphd's topic in PHP Coding Help
Perhaps you should limit the number of company staff (1-2) who can even request a password reset. Then you could provide them with a secret token to be used which could be easily changed when it needed to be. That would allow the 'company' to always know who is requesting password changes. -
The whole idea of an RDBMS is to make it easy to access data quickly and efficiently. To put like data elements into the same table column means that you will ALWAYS have to finagle it to access just one of those data items which conflicts with the reason you are using the RDBMS in the first place.
-
Don't understand what you are trying to tell us.
-
I dont' see how example 1 relates to example 2
-
so much for that...
-
Something like this: session_start(); error_reporting(E_ALL); ini_set('display_errors', 1); // $your_email ='email address';// <<=== update to your email address $errors = ''; $name = ''; $visitor_email = ''; $phone = ''; $foundus = ''; $message = ''; //***** echo "in mailer script<br>"; if(isset($_POST['submit'])) { echo "Got submit<br>"; if(empty($_SESSION['6_letters_code']) || strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0) { //Note: the captcha code is compared case insensitively. //if you want case sensitive match, update the check above to // strcmp() $errors .= "n <div class='contact-text-sitemap'>The captcha code does not match!</div>"; } echo "captcha check: $errors<br>"; $name = $_POST['name']; $visitor_email = $_POST['email']; $phone = $_POST['phone']; $foundus = $_POST['foundus']; $message = $_POST['message']; ///------------Do Validations------------- if(empty($name)||empty($visitor_email)||empty($phone)||empty($message)) { $errors .= "\n Name, Email, Phone and Message are required fields. "; } echo "inputs check: $errors<br>"; if(IsInjected($visitor_email)) { $errors .= "\n Bad email value!"; } echo "injection check: $errors<br>"; if(empty($errors)) { //send the email $to = $your_email; $subject="New Website Enquiry"; $from = $your_email; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : ''; $body = "A user $name submitted the contact form:\n". "Name: $name\n". "Email: $visitor_email \n". "Phone: $phone \n". "How Did You Find Us: $foundus \n". "Message: \n ". "$message\n". $headers = "From: $from \r\n"; $headers .= "Reply-To: $visitor_email \r\n"; echo "Mail parts:<br>to $to subj $subj<br>"; echo "body $body<br>"; echo "headers $headers<br>"; mail($to, $subject, $body,$headers); // header('Location: thank-you.php'); echo "Mail call was made"; } } echo "no submit found"; // Function to validate against any email injection attempts function IsInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } ?>
-
Try putting some echos in your mailer.php script to show what progress you are making. Comment out the header command and just echo a response to your page so you can see if this script works before moving on.
-
So hard to make any sense of this. I'm assuming that the line "echo $var1" is the line in question. And that it is not showing up in 'main' div area. Question - why are you doing all this output when you haven't received the rest of the POST data fields? Seems backwards to be worrying about your output when you haven't even analyzed the input yet. Good practice says to separate the bulk of your html from your php. Same for the JS code too. Grab all the inputs, work with them, build the dynamic output into php vars and THEN do the output of your static html (doctype, metas, head, scripts,styles and body tags) and then place those php vars where they need to be, ALL at the end of the script. First things first and last things last. Makes much more sense logically as you read thru the script and is much easier to maintain down the road. PS - you should really learn some css and get all that outdated styling out of your html tags.
-
show us the corrected code so we can see really see the problem.
-
Why do you look for just first or last instead of both at the same time?
-
After moving to a dedicated server with my hoster, I have suddenly run across a time zone issue. Seems that the .ini file shows me as UTC, instead of 'America/New York'. Since I dont' have access the the master php.ini file I do have a set of little override files in all of my folders that up until this move worked just fine for me. Now however it appears that these little override files aren't being read. Is there some setting that my host needs to alter? Second part of this question. Why doesn't this line work: ini_set('date.timezone','America/New York'); It doesn't like the line saying: Warning: ini_set(): Invalid date.timezone value 'America/New York', we selected the timezone 'UTC' for now. in /home/albany/public_html/homejg/jg/check_ini_file.php on line 6 Is there some other syntax to use in ini_set? PS - I'm running PHP 5.5.31
-
I posted this topic in the JS forum, which was probably wrong. I made the mistake of considering an elaborate menu system written in JS as the best place for what essentially an HTML problem. My website works just fine on IE10 on W7. A new laptop running W10 with Edge doesn't handle the same appl very well. Whereever I have an anchor tag (<a>) that uses an accesskey= attribute the Edge box doesn't react to it. It does however work on a button or submit element. If anyone else has encountered this I'd love to hear how you worked it out. Me - I just downloaded IE11 to the Edge box, made my appl load using IE instead of Edge and voila! the appl works perfectly for all accesskeys.
-
Well, I solved my accesskey problem. I simply installed IE10 on my W10 laptop and ran my website on it and no problem. So it's not W10 giving me the problem and it's not my appl since that works on the same laptop that has Edge on it. It's simply Edge not recognizing an accesskey attribute inside an anchor tag. I hope somebody else has already reported this failure to M$.
-
And how come the forum doesn't acknowledge my 'submit post' when I have finished my input? Yesterday I posted a question 4-5 times simply because I received no response when I clicked the submit(?) button.
-
Wrote an appl that works just fine under IE 8,9,10 with some patches for the older versions JS code. (I don't use JQ). Problem is that my setting of accesskey for some of my menu items don't work under the new Edge browser. Same webpage, same code, works just fine in IE10 but Edge doesn't recognize the hotkeys I have setup . Is this a known behavior of M$ newest boon to mankind?
-
I have a copy of lightbox running on my site that included a 'prototype.js' file that has been running for years. Lately, during debugging the IE developer tools is stopping on this line with the error shown: var el = document.createElement('<input name="x">'); InvalidCharacterError This line is part of this: var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){ try { var el = document.createElement('<input name="x">'); return el.tagName.toLowerCase() === 'input' && el.name === 'x'; } Can anyone provide a work-around for this or should I just not worry about it?