-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
Note that the mail() function returns true/false to indicate whether the message was accepted for delivery. If you haven't already, you'll want to check what the function is returning. It should be noted, however, that a true value doesn't mean the message was actually delivered. More information about mail() can be found here: https://www.php.net/manual/en/function.mail.php Also, it may help if enable all PHP errors/warnings to be shown. This can be accomplished by adding the code below to your PHP. Be sure to remove the code when you are done with the debugging process. <?php //REPORT ALL PHP ERRORS error_reporting(E_ALL); ini_set('display_errors', 1); ?>
-
You should be able to temporarily add it anywhere in your PHP code. Note that you're only adding it for "debugging" purposes. It would be removed once you know what the value contains. More information about the function can be found here: https://www.php.net/manual/en/function.ini-get.php
-
As ginerjm mentioned, you'll want to avoid letting the user supply the From address. Partly because your mail server isn't going to be authorized to send mail on behalf of email services like Gmail, Yahoo, etc. If you're interested in learning more, you could look up Email Spoofing. Side note: PHP has a built-in validator for email addresses. See the first example here: https://www.php.net/manual/en/filter.examples.validation.php
-
Linking 2 arrays after successful ping in PHP
cyberRobot replied to Jimmy85's topic in PHP Coding Help
I would switch to a multidimensional associative array for your data. For example, you could have something like this <?php $systems = array( array('ip'=>'192.168.9.254', 'name'=>'Item1'), array('ip'=>'192.168.9.205', 'name'=>'Item2'), //...remaining systems ); ?> That way all your data is in the same place. Then your loop could use the values like this: <?php foreach ($systems as $currSystem) { echo $currSystem['ip']; echo $currSystem['name']; } ?> -
Parse error: syntax error, unexpected '$age' (T_VARIABLE)
cyberRobot replied to conqueror's topic in PHP Coding Help
The error is caused by the missing semi-colons after the lines defining $username and $age. -
Here's some more information about why it's not really used anymore: https://developers.google.com/search/blog/2009/09/google-does-not-use-keywords-meta-tag As for the limit, I'm not seeing anything here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name Perhaps search engines imposed their own limits to avoid keyword stuffing.
-
My php code which has worked for years now doesnt
cyberRobot replied to BobBlightman's topic in PHP Coding Help
Did you try using the complete address, including the protocol? header("Location: http://www.rowledgecricketclub.com/"); Have you tried enabling all PHP errors/warnings? This would go at near the top of your PHP script, within the PHP tags. //REPORT ALL PHP ERRORS error_reporting(E_ALL); ini_set('display_errors', 1); Be sure to remove the above debugging code when you're done testing. -
How to show 1 of three pictures as image
cyberRobot replied to hendrikbez's topic in PHP Coding Help
Looking at the screenshot and your code, it seems like the following variable is the one you will use to determine which of the 3 images to display. $checkSqlRow["LEGIT"] Your screenshot suggests this variable will contain one of the following values: weet nie nee ja One option would be to test for those values in an if / elseif statements to determine which image to display. For example, if the green image is to be displayed for "ja" and red for "nee", you could do something like this: <?php $checkSqlRow["LEGIT"] = strtolower($checkSqlRow["LEGIT"]); //make sure the value is lower case before testing if($checkSqlRow["LEGIT"] == 'ja') { echo '<img src="green.gif">'; } elseif($checkSqlRow["LEGIT"] == 'nee') { echo '<img src="red.gif">'; } elseif($checkSqlRow["LEGIT"] == 'weet nie') { echo '<img src="yellow.gif">'; } ?> Note that the image names (and the path) will need to be adjusted to whatever you are using. -
share website URL to facebook not show information
cyberRobot replied to nitiphone2021's topic in HTML Help
Note that the original post was made a little over a year ago. Hopefully things have improved in Facebook to where adding the URL is all that needs to be done. However, it wasn't always that simple. Many times adding the URL was enough. Other times, we needed to resort to adding special meta tags to a page (or use the Facebook debugger) to hopefully get Facebook to show the desired content. -
Where are you stuck? Do you have something created to respond to the button click? If so, what does that code look like? It might also help to see the button related code to get a better idea of what you are trying to accomplish.
-
How to find post if thumbnail is empty (wordpress)
cyberRobot replied to shaadamin44's topic in PHP Coding Help
If you haven't already, you might find what you need through a search engine like Google. I wouldn't be surprised if there's already a WordPress plug-in to help. https://www.google.com/search?q=wordpress+find+posts+without+thumbnails -
Have you considered using a CSS grid layout? A quick example can be found here: https://css-tricks.com/how-do-you-make-a-layout-with-pictures-down-one-side-of-a-page-matched-up-with-paragraphs-on-the-other-side/ A more in-depth description of grid layouts can be found here: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Basic_Concepts_of_Grid_Layout Side note: the <center> tag mentioned in an earlier post should be avoided since it has been deprecated (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center). CSS is usually the way to go when changing how something visually appears on the page.
-
I switched from Perl to PHP in 2001. Of course, I keep forgetting it's been that long.
-
The PHP manual is great place to learn how things work in PHP. Especially, if you have specific questions about how a built-in PHP function works. The manual can be found here: https://www.php.net/manual/ When it comes to learning WordPress, and it's built-in features, their developer documentation can be useful. https://codex.wordpress.org/Developer_Documentation At times, the above resources can be overwhelming (and potentially underwhelming). That's where I usually turn to Google and this forum.
-
For future reference, if you're not interested in switching editors, you could also run your HTML code through W3C's Markup Validation form here: https://validator.w3.org/ Also note that you may want to review the documentation for the <label> tag. You'll either want to have the <label> tag surround both the label and the input field. If it's not around both, you'll need to use the "for" attribute to connect the <label> tag to the corresponding input's "id" attribute. More information can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label There's an easy way to test most <label> tags to make sure they're working. If you have a label and a text input, for example, clicking the label will put the text prompt (aka flashing cursor) in the corresponding input field.
-
So...where are you stuck? Do you have a process for converting the XML data into something that PHP can loop through? If not, you may want to try PHP's SimpleXML extension. More information can be found here: https://www.php.net/manual/en/book.simplexml.php As for the human-readable headings, you could try looping through the "Entity" elements, looking for the one where the "id" is equal to "1". Then go on to process and output the remaining "Entity" elements. If you have control over the XML code, it might be better to modify things so the headers are stored using unique tags. That way you can just grab them without needing to loop through all the "Entity" elements.
-
If I'm reading everything correct, the "create" script is under todolist_demo > public_html > todo. The "create" script isn't able to find your db.php because the following line only goes up one level. include('../db.php'); Basically, you're telling "create" that db.php is in your public_html folder. You either need to use "../../db.php". Or I would actually recommend switching that line so it starts at the document root. I'm guessing "public_html" is your root folder. If that's the case, you could try the following: include $_SERVER['DOCUMENT_ROOT'] . '/../db.php';
-
Good luck and welcome!
-
In case you have control over how $matches is formatted, you could make this easier on yourself by changing the array to something like this: Array ( [0] => Array ( [sku] => 234567 [price] => $33.00 ) [1] => Array ( [sku] => 999888 [price] => $82.44 ) )
-
You'll want to switch to PDO or MySQLi for working with the database. The mysql_ functions were removed from PHP in version 7.0. More information can be found in the warning box in the PHP manual here: https://www.php.net/manual/en/function.mysql-connect.php
-
You could use a loop. For example, $mcptitles = array("Volvo", "BMW", "Toyota"); foreach($mcptitles as $mcptitle) { //your existing code here... } Note that I changed the name of variable that holds the array. That way it should hopefully work with your existing code. Also note that I didn't review your code since it sounds like it's working.
-
I'm not sure why the first URL isn't working. I built a quick test script and that address worked fine for me. I even tried adding the call real_escape_string(), which I thought might be modifying the URL, but everything worked fine. The second "www.google.com" address didn't work for me. However, it worked fine once I added the protocol: https://www.google.com Side note: real_escape_string() is only designed to escape input for use in database queries. If you're looking to escape text for outputting to the screen, you'll want to look into htmlspecialchars() and htmlentities().
-
When clicking one of the links, does the URL show the correct ID? If so, then the provided code is working fine. As Barand mentioned, we would need to see the code that processes the clicked ID to display the page. Hiding the ID from the URL will prevent people from doing things like bookmarking (or linking) to the pages being generated by the script. So I wouldn't recommend going this route.
-
Either way works. Once the exit language construct executes, the script stops. It won't do anything with that next if construct when the "user" SESSION variable isn't set. So using else, in this case, is unnecessary. More information about how exit works can be found here: https://www.php.net/manual/en/function.exit.php With that said, if using "else" makes more sense to you...you might consider "elseif" if(!isset($_SESSION['user'])) { exit; } elseif($_SESSION['user'] !== 'SiteOwner') { exit; } And when you get to the stage of blocking multiple user types, you could potentially do something like this: if(!isset($_SESSION['user'])) { exit; } elseif(in_array($_SESSION['user'], array('SiteOwner', 'SiteAdmin'))) { exit; } Note that the above code is untested.
-
share website URL to facebook not show information
cyberRobot replied to nitiphone2021's topic in HTML Help
Have you reviewed the information provided by Facebook here: https://developers.facebook.com/docs/sharing/webmasters/ Note that it looks like they have a debugging tool that you can use, under the Testing Your Markup section.