
heeha
Members-
Posts
43 -
Joined
-
Last visited
Everything posted by heeha
-
few queries: when user pass a url http:// you tube.com it will still process it. but you (space) tube.com is not a correct url, there is a un-necessary space. 2. http://youtube.com/a comes output if user put "a" in form, I tried to put the above case to trim the specialcharacters or addtional words so that only http://youtube.com is taken in form but not http://youtube.com/a but doesnt work.
-
if (isset $dns_records) // why we we have to check isset or not here as well, don't we just call the output? We already know the url exists by checking isset($_POST['url'])) and have already know the dns is working we just didnt output it above. { //output dns records here foreach($dns_records as $record) { // output dns $record here } } 2. When I enter google.com, ( as its a hostname) not a url and form only takes url as we have told php to take url only not the hostname to process via form. how do i make sure that when a user enter google.com, or www.google.com in the form it will still process the information and brings the dns record. Above all, i m successfully able to output every records. Well some are missing such as reverse ip. Well, i also now would learn to add those information to database just to make sure my coding experience keeps on growing and would learn further more. Thanks to you for helping all that out. <?php $siteErr=""; $site=""; if ($_SERVER["REQUEST_METHOD"] == "GET") { $site = trim_useless($_GET['url']); } if (empty($_GET['url'])) { $site = ""; } else { $site = trim_useless($_GET['url']); if (!preg_match("/\b(??:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$site)) { $siteErr = "Invalid URL"; } } function trim_useless($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> why this above code wasnt working, I know i wasn't able to tell the php to not to process the form.
-
Completely Agreed, I had faced the same issue. Fortunately when i was about to leave to the sign-up page, i accidentally got accepted. I would definitely say, that they need to look for the security code bug issue if there is any. I typed security code for over 15 types to join. It was totally a bad experience.
-
In which part am i going wrong? Am I going ok? <?php $url= $_POST['url']; if(isset($url)) //did to check if url is there or not. { if(filter_input($url, PHP_URL_HOST)) //did to check if your is valid or not { $host= parse_url($url, PHP_URL_HOST); print "the host is $host"; //did to output the hostname foreach($host as $hostname); // assigned $host as $hostname $dnsinfo= dns_get_record($hostname, DNS_A); print_r($dnsinfo); // to check if records are getting printed or not. } } ?> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="Post"> Enter URL : <input type="text" name="url"> Submit: <input type="submit" name="submit"> </form>
-
Got the above correct working on rest of the code. Above lines are very helpful.
-
sorry, I messed the code : <?php $url = $_GET['myname']; $host = parse($url, PHP_URL_HOST); print "The host is" .$host['host']. "."; ?> let say, if i put google.com in the form and then process it. shouldn't it output the hostname?
-
Well, I m still having troubles, as I read those pages, and those to me appears to technical terms I wasn't able to understand much. I would have them if they were much simplfied way. Surely I am not looking that you full fill those missing pieces, and I m interested in filling them myself so I guess I can keep the rest those code for sometime and in the time being i would love to clarify other things. LEt say a part of that code: <form action="<?php echo $_SERVER["PHP_SELF"];?>"> name : <input name=myname" type="text"> <input type="submit"> </form> <?php $host= $_GET['myname']; $host = parse($url, PHP_URL_HOST); print "The host is" .$host['host']. "."; ?> or <?php $host= $_GET['myname']; $host= parse_url($host); print "the host is " .$host['host']. "."; ?> Why doesnt this code output the host such as google.com or anyother.
-
Thanks, I will do my best.
-
Well, I dont copy paste, what I do i surely change them to my needs and see if that works on my server or not. But those coding given at w3schools are easy to get answers with but doing coding myself is very tough as of now.
-
I tried my best being a complete new to programming but i m unable to get the working properly. <!DOCTYPE html> <html> <head> <style> table , tr, td, th { border: 3px solid pink; background-color: yellow; border-collapse: collapse; } </style> </head> <body> <?php $site= $_GET['url']; if(!filter_var($site, FILTER_VALIDATE_URL) === false) { }else { $site=""; } if ($_GET['url'] exists) { if($_GET['url']) { $site= parse_url($_GET['url'], PHP_URL_HOST); foreach($site as $host){ $result= dns_get_record([$host], DNS_A); } } else { $siteErr= "url is not valid"; } } ?> <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" method="GET"> Enter URL : <input type="text" name="url"> <span class="error"> * <?php echo $siteErr;?></span> Submit: <input type="submit" name="submit"> </form> <div> <?php if ($result) { print_r($result); } ?> </body> </html>
-
I take lessons and tutorial from w3schools for learning purpose and when I read it there and tries to add those on my server, it seems so easy but when I try to code things myself, its so much hard to code.
-
Thanks for the help but I m completely new to the programming, I filled the above based upon tutorials taken from w3schools. So the Pseudo code layout you just placed, i m unable to enter information correctly. I would be happy if you could put the code in there so i can understand based upon my above novice coding. I tried filling those places but I m unable to get anything and I m sure I am adding all of them wrong.
-
I am trying to code to but having some troubles. <?php $siteErr=""; $site=""; if ($_SERVER["REQUEST_METHOD"] == "GET") { $site = trim_useless($_GET['url']); } if (empty($_GET['url'])) { $site = ""; } else { $site = trim_useless($_GET['url']); if (!preg_match("/\b(??:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$site)) { $siteErr = "Invalid URL"; } } function trim_useless($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']);?>" method="GET"> Enter URL : <input type="text" name="url"> <span class="error"> * <?php echo $siteErr;?></span> Submit: <input type="submit" name="submit"> </form> <div> <?php $site= dns_get_record($_GET['url'], DNS_MX); foreach ($site as $in){ echo "<table>"; echo "<tr>"; echo "<th>Host</th>"; echo "<th>Class</th>"; echo "</tr>"; echo "<tr>"; echo "<td>" .$in['host']. "</td>"; echo "<td>" .$in['class']. "</td>"; echo "</table>"; } ?> 1. Warning: dns_get_record(): An unexpected server failure occurred. in /home/u992092914/public_html/b/test.php on line 48 Warning: Invalid argument supplied for foreach() in /home/u992092914/public_html/b/test.php on line 49 2. Form validation doesnt work. I mean even if i enter abc rather than some .com , it will still process the form. 3. No invalid Url gets displayed if display, doesnt stop form to get processed.