Jump to content
Stef's Coding Community


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About saversites

  • Rank

Recent Profile Visitors

5,282 profile views
  1. Hi, I have a form field where I prompt user for tgheir domain names. Now, I need to filter it so user inputs valid domain. How to do it ? This ain't working: $primary_website_domain = filter_var(trim($_POST["primary_website_domain"],FILTER_SANITIZE_DOMAIN)); $primary_website_domain_confirmation = filter_var(trim($_POST["primary_website_domain_confirmation"],FILTER_SANITIZE_DOMAIN));
  2. Thank you Stef. I have not tried on a live server. I guess I should do that first! Cheers!
  3. Php Experts, I need to fetch not the last row in the table but the last entry based on a condition. I only know how to fetch the last row in the table. I tried coding the way I think it is done but no luck. Googled but no luck. $query_for_today_date_and_time = "SELECT date_and_time FROM logins WHERE username = ? ORDER BY id DESC LIMIT 1"; if($stmt_for_today_date_and_time = mysqli_prepare($conn,$query_for_today_date_and_time)) { mysqli_stmt_bind_param($stmt_for_today_date_and_time,'s',$db_username); mysqli_stmt_execute($stmt_for_to
  4. The following fails to grab the user's real ip. I testing on my Xamp (localhost). The code is supposed to grab real ip even if user hiding behind proxy. Why not showing my dynamic ip ? I can see my ip on whatismyip.com but that code fails to show it. I been testing on localhost using Mini Proxy. function getUserIpAddr() { if(!empty($_SERVER['http_client_ip'])){ //IP from Shared Internet $ip = $_SERVER['HTTP_CLIENT_IP']; }elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ //IP from Proxy $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; }els
  5. Hi tef,


    Can you kindly respond to my thread. It is an interesting topic.



  6. Folks, I need to auto submit urls one by one to my mysql db via my "Link Submission" form. The Link Submission form will belong to my future searchengine which I am currently coding with php for my php learning assignment. For simplicity's sake, let's forget my searchengine project and let's assume I have a web form on an external website and I need it filled with peoples' personal details. Say, the external website form looks like this: <form name = "login_form" method = "post" action="yourdomain.com/form.php" enctype = "multipart/form-data"> <fieldset&
  7. Php Experts, For some reason I can't get the "if(file_exists" to work. I don't want the user uploading the same file again. If he tries then should get error alert: "Error: You have already uploaded a video file to verify your ID!" On the comments, I have written in CAPITALS such as: IS THIS LINE CORRECT ? IS THIS LINE OK ? IS LINE OK ? CORRECT ? I need your attention most on those particular lines to tell me if I wrote those lines correct or not. Those are the places where I need your attention the most to tell me if I made any mistakes on those lines or not and if so then
  8. I modified the script but no luck! One year has passed! Hi, Below is a membership or account registration page script. I need to get the User to type the password twice. Final one as the confirmation. I tried both the following for the "Not Equal To" operator after inputting mismatching inputs into the password input field and the password confirmation (re-type password field) field and none of them work as I do not get the alert that the passwords don't match. != !== My troubled lines: 1st Attempt no luck: if ($password != $password_confirmation) { ec
  9. I have error reporting on on one of the included files. Not getting any error. <?php //ERROR REPORTING CODES. declare(strict_types=1); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); ?> Ok, I will shorten the code in this example below. The mysql queries are not working. if ($_GET["Result_SearchType"] == "Domain") { //Grabbing these: $_GET["Result_Domain"], $_GET["Result_PageType"]. $first_param = $_GET["Result_PageType"]; $second_
  10. Folks, Why are my $query_1 failing to pull data from mysql db ? I created a condition to get alert if no result is found but I do not get the alert. That means result is found. But if found, then why the following code fails to display or echo the result through html ? Trying to pull the data with these urls: http://localhost/test/links_stats.php?Result_SearchType=Domain&Result_PageType=Information20%Page&Result_Domain=gmail.com&Result_LinksPerPage=25&Result_PageNumber= http://localhost/test/links_stats.php?Result_SearchType=Page&Result_PageType=Information
  11. Php Buddies, Look at these 2 updates. They both succeed in fetching the php manual page but fail to fetch the yahoo homepage. Why is that ? The 2nd script is like the 1st one except a small change. Look at the commented-out parts in script 2 to see the difference. The added code comes after the commented-out code part. SCRIPT 1 <?php //HALF WORKING include('simple_html_dom.php'); $url = 'http://php.net/manual-lookup.php?pattern=str_get_html&scope=quickref'; // WORKS ON URL //$url = 'https://yahoo.com'; // FAILS ON URL $curl = curl_init($url); curl_setopt($curl, CUR
  12. I did a search on the php manual for str_get_html to be sure what the function does. But, I am shown no results. And so, I ask: Just what does it do ?
  13. I am told: "file_get_html is a special function from simple_html_dom library. If you open source code for simple_html_dom you will see that file_get_html() does a lot of things that your curl replacement does not. That's why you get your error." Anyway, folks, I really don't wanna be using this limited capacity file_get_html() and so let's replace it with cURL. I tried my best in giving a shot at cURL here. What-about you ? Care to show how to fix this thingY ?
  14. UPDATE: I have been given this sample code just now ... Possible solution with str_get_html: $url = 'https://www.yahoo.com'; $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); $response_string = curl_exec($curl); $html = str_get_html($response_string); //to fetch all hyperlinks from a webpage $links = array(); foreach($html->find('a') as $a) { $links[] = $a->href; } print_r($links); echo "<br />"
  15. I just replaced: //$html = file_get_html('http://nimishprabhu.com'); with: $url = 'https://www.yahoo.com'; $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); $html = curl_exec($curl); That is all! That should not result in that error! :eek:
  • Create New...