topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • November 15, 2019, 10:11 AM
  • Proudly celebrating 13 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - The Code Queryer [ switch to compact view ]

Pages: [1] 2next
1
Folks,



Apart from Bootstrap (Twitter stuff), do you know of any free Mobile Responsive Design templates ?

I got a pagination page. I need to convert that to Mobile responsive Design. Searching for a template so I can learn from it and convert my pagination page so it looks good on mobile phone browsers too as now it looks terrible as you need to scroll and the texts look too small, etc.

Hence, need a Mobile Responsive Pagination page template.

Also need Account Login, Account Registration Page (web forms), Account Home Page Mobile Responsive Design templates.

Must be in Html 5 and CSS.



I am googling but no real luck.


Any advice ?



Thanks

2
Is it perhaps not a better idea to look at open source projects (and their code), which already do this kind of functionality? Nextcloud would be a decent enough place to start looking for code that handles user login, uploading of files (securely) and how they share this content among users/user groups etc. I think you can run it on a (very) recent version of the XAMPP development environment on Windows. But you could also create a VM with Linux and the test envelopment requirements.

I know for sure that the Ubuntu Server LTS iso installer has an option that says if you want to create a LAMPP (Linux Apache MySQL, PHP Perl) setup. For the rest you can use the default settings provided by the installer, those are very usable from the get-go. Skip any of the GUIs and you have a 4 GByte VM that works excellent for web development. If you plan to test a lot at once, better reserve 8 GByte of space for this VM. Assigning 1GByte of RAM to this VM is more than enough for simple development. It is slightly more work than installing XAMPP, but works well. And you bare coding against Linux, which is the most likely OS your host is using, so you won't have to do as much troubleshooting your code base.

There are other open source file sharing projects you could take a look at, in case NextCloud isn't your thing. Google is your friend.

Thanks.
Yes. I use Windows and Xampp.
But I got Vps using CentOS 7.
Have you seen those File Upload Hosts ? There were some even few yrs back that paid you for every downloads. I am now thinking, maybe I use their File Upload feature so when my members login to their member accounts on my website, they do not see any File Upload Page on my own website but I forward them to the Page of the File Hosts. There they can upload their video files. I can then link to those uploaded videos from my website so members can see the links where their uploaded files are uploaded and hosted. This way, I do not have to write my own File Upload Script and do not have to worry about any member uploading malicious files. I'm sure the File Host will have appropriate measures in place to deter malicious file uploads. What do you say ?

Thanks for pointing out NextCloud! Checking them out now!

A very big CHEEEERS! :Thmbsup:

3
Php Folks,

I want to allow my website members to login to their accounts and upload files to my server so other members can view them. Files such as text files, image files, audio files and video files. But not program files or executable files.
Now, what features must my File Upload Form have ?
I need a complete list of Php features it must have. I need you to give me a complete list of Php Functions the File Upload Form must make use of.
Kindly list as many Php features and functions you can think of that my File Upload Form must have in order for it to be a Secure File Upload Form so no one can upload malicious files (virus, programs, etc.).
I am going to get the File Upload Form developed by a paid programmer. I need to give the programmer a list of features the File Upload Form must have. Here is my list of REQUIREMENTS so far:

REQUIREMENT 1:
Add filters and sanitizations so malicious files cannot be uploaded. Nor can sql injections can be made.

REQUIREMENT 2:
Only file types from White-List should be uploaded. Any File Types not listed on this White-List should be discarded and not uploaded. Error should be given that this type of file is not allowed to be uploaded.

REQUIREMENT 3:
Uploaded File should not be more than 100MB. Echo error if File Sizes exceed limit & halt script.
MUST check File Size with function: file_size():
https://www.php.net/...unction.filesize.php

REQUIREMENT 4:
Set a maximum name length and maximum file size – Make sure to set a maximum name length and file size in order to prevent a Denial of Service attack.
If you do not know what I am talking about then read number "6" on the following link:
https://www.opswat.c...ction-best-practices

REQUIREMENT 5:
MUST make use php of function getimagesize() for security purpose.
https://www.php.net/...ion.getimagesize.php

REQUIREMENT 6:
Write to the file when you store it to include a header that makes it non-executable.
If you do not understand what I am talking about then read the line on the following link that comes just after the CONCLUSION section.
https://www.wordfenc...oad-vulnerabilities/

REQUIREMENT 7:
MUST STORE all errors and DISPLAY all errors using traditional:
"Errors[] = "";.
On my script, fix my error coding mistakes related to the following format as I have no clue how to fix all that to store errors and display them.
"Errors[] = "";.

REQUIREMENT 8:
To detect File Details, should use php functions:
file_info() & mime_content_type():
https://www.php.net/...ction.finfo-file.php
https://www.php.net/...ime-content-type.php
Script Files (executable files) should not be uploadable. Only text files (.txt, .doc, .pdf, etc.), image files (.giff, .jpeg, etc.), audio files (.mp3, etc.) and video files (.mp4, .wav, etc.).

REQUIREMENT 9:
Script should check whether file upload was successful or not.
MUST check with upload with function: is_uploaded_file().
http://php.net/manua...is-uploaded-file.php
NOTE: After the check, user must get notified whether file has been uploaded successfully or not.

END OF REQUIREMENTS

Q2.
Should I get the programmer to add security features from other languages ? Currently, all my REQUIREMENTS revolve around Php as that is the only programming language I am learning. I do not have experience in any other languages. Server-side or Client-side.
Now, do you reckon I should get the programmer to add security features on Client-side ? If so, program in which language and make use of which functions from that language ? Can you give me a complete list ?

Q3. For security purpose, should I even bother getting the programmer to turn the current File Upload Form into an Ajax form ?

Q4. For security purpose, should I even bother getting the programmer to add Json or Jscript ? Are they really necessary ?
If so, which features and functions must be used to make the File Upload Form more secure ?
(I was just youtubing to learn more about Ajax and what is Json or Jquery and so I am very raw in these 3 fields. Hence, need your advice whether of these 3 should be added or not and what features and/or functions must be added from them 3).

Q5. Which language was used to build youtube you reckon and which of the functions were used from the language/s, you reckon ?

Q6. If you were in my position then which languages would you make use of and which functions and features of these languages would you make use of ? I need your complete list.

Thanks

4
DC Member Programs and Projects / Re: GDPR Blocking (PHP Edition)
« on: April 25, 2019, 10:28 AM »
At the end, few days ago, I bought a gig at fiver that redirects outside my site all EU visitors through the apache module geoip.

5
Well, sounds like you use a share plan with your hoster (multiple paying users on one actual server). This is a common setup and for most intents and purposes also ok. Only when having lots of traffic you should consider a dedicated plan. Costs of those are much higher.

Anyway, the webserver software on your server is also shared. That limits the configuration options available to you. Your tech correctly points this out.

The articles you were reading assume you have complete control over every aspect of your webserver. Which is not true in your case, so the plan of your tech sounds reasonable to me.

You shouldn't play with the .htaccess file, unless you know what you are doing. While working with the Apache web server isn't that difficult, I would not call it easy. You need a good understanding of all the terminology and the concepts to make it work properly. A mistake is easily made and results in a mess and/or insecure website.

Your tech is also right about not blocking on IP address level, but on country codes. IP v4 addresses are running out on most continents. In the beginning it was pretty easy to block content from certain regions as you could make educated guesses about which block of IP addresses were assigned to which continent. The companies that handle the distribution of IP addresses have been swapping IP blocks amongst themselves as the need arose. Nowadays it is not that easy anymore to use IP addresses to block users from specific countries anymore.

So, the suggestion about using the country code to check against a country database for granting access sounds reasonable again.

Thanks Shade!

Then I guess the technician was telling the truth when he said to trust him and he knows what he's talking about and had 2 hosting companies in the past.
Now the problem is, I just got an email from fiverr.com tht they have shut down my free account (buyer account)! Would have been better if they had shut it down after I buy the $10 gig! Fiverr say I opened 2 accounts. Well, I did open a business account about 2.5yrs back and saw I was not getting any sales and then forgot about the account. And opened a buyers account few days ago. That first account should have been shut down by now for not logging in all this time. I believe if I open another account using another email then I'd get caught again. I did open the 2 accs with 2 different emails but they still sniffed me out. Do you have an idea how they did that apart from saying cookie tracking because I do delete my cookies every now and then. Mac address, I believe.
Now got to hunt for fiverr.com alternatives and hope I'll find another technician for around $10 Or better $5. :)

6
Technical Gurus,

I need your brilliant experienced opinion.
You see, it's practically impossible to make my website abide by the new EU GDPR without annoying my websites visitors. Hence, have decided to block all EU visitors altogether. I asked my webhost regarding this issue and they pointed me to these links:

Mod Security:
https://forums.cpane...in-countries.574681/

GeoIP:
https://grepitout.co...cpanel-easyapache-4/ and https://www.tecmint....or-apache-in-centos/

They suggested I take the "GeoIP apache module way".
Now, I'm not too technical. New in all this. I tried installing both the Mod Security and the GeoIP Apache Module but failed (even after following the steps in the articles) as I don't have much experience with Unix/Linux. Therefore, searched for someone to take care of it. Told him to install both Mod Security and GeoIP Apache Module but to do it without touching the .htaccess because the following article says it will go to thousands of lines of code if I do it using .htaccess.
https://www.sitepoin...m-accessing-website/

The technician had a look at the links I gave and said he will install the GeoIP module but not by following the steps mentioned in the following article and he has to do it using .htaccess.
https://www.tecmint....or-apache-in-centos/
Says there would only be 28 lines of code to block 28 EU countries.
Also says, if he follows the steps mentioned on the above link (tecmint article) then things will get messed-up. His exact words are:

"You can't directly edit apache configuration as techmin article suggest, because you are running cPanel. settings must be "friendly" with cpanel, or they'll get lost and make mess.".

He says he will do it following the steps mentioned here:
https://www.paunovic...a-cpanel-whm-serveru
He says that is the proper way to do it on cPanel Server.
I asked my webhost about this and they have gone silent. Hence, approaching you folks for your expert opinions.
I have Vps with Root Access: SSH, Panel. I got CentOS OS, Whm and cPanel ($15 version).
I got my webhost to build 8 cPanel accounts for my 8 domains. 1 cPanel account per domain. I think they built them via Whm. (Still learning about Whm).
I told the technician, I want him to set things up on my Whm so any domains &  cPanel accounts I add in the future (1 new cPanel account for 1 new domain) to my Vps should also block EU visitors. He said aslong as I have Root Access he will set things up following the steps in that article:
https://www.paunovic...a-cpanel-whm-serveru

You have now heard about my hardwares & softwares and what I need done. Block all EU visitors from my current 8 websites and from all future websites/domains hosted on this Vps. My questions are:

Q1. Must the GeoIP and the Mod Security be installed on my Whm for them to work on all my current and future websites/domains/cPanels hosted on this vps under this Whm ?

Q2. Which option is best for me ? Mod Security or GeoIP ? If I install both then that would not be a problem. Am I right ?

Q3. Is the technician correct when he says "You can't directly edit apache configuration as techmin article suggest, because you are running cPanel. settings must be "friendly" with cpanel, or they'll get lost and make mess."
He says the steps in following article is bad:
https://www.tecmint....for-apache-in-centos
Is he correct ?
He further says: "I'll compile GeoIP module and GeoIP database on your server Apache and then you can easily block countries, and do not have to block IPs.". Is it better to do it this way over the techmint article way ?
Should I opt for his method instead (do things the .htaccess way) and
should I ignore the warning on the Site Point Forum article to not to things the .htaccess way ?

I am puzzled, confused and need your expert opinions and advice as I know you won't be giving biased advices.

Thank you for your interest in helping me out.

Whatever method you recommend, make sure it will be easy for me to easily add more countries in the banning list without needing to fiddle with messy code.

7
Developer's Corner / Re: File Upload With Php
« on: April 18, 2019, 10:16 AM »
As a general note: 'Doesn't work' is the most useless error description you can provide to anyone trying to solve your problem. Describe what you do, step by step, in clear and short terms, preferably with clear screenshots of the steps you take and the error message that is presented to you. That will make answering or troubleshooting much more easier for yourself and the troubleshooter.

If you fling your questions onto StackOverflow in the same way as you do here, it is very obvious why you have encountered the open question limit over there. Don't expect your questions to be answered soon there (or here). People don't have any idea of what you are doing, how your environment looks like or what tools you are using. Here's a secret, they don't give a flying f..k care, because they have much more useful things to do with their time.   

So, mention what version of PHP you use. Mention what type of server (Windows/Linux). Mention which web server (Apache, NGINX, other) etc.

Another general note: Web servers, by default, are configured only to serve files to anyone who asks, not receive files and storing these. How sure are you that the web server you use is configured to allow for file uploads?

Last general note of this post: You are setting some values in your final error message. Why? Error messages are there to inform the user and preferably never contain forms of code. That is true for any type of messaging to inform the user.

In your case, I would seriously suggest to start using an IDE for PHP development. It is clear that you don't. IDEs help you out with code completion, syntax and the better IDEs even have tools that analyze the code you create in them and show (some of) the errors in your concept code.

NetBeans and Eclipse have IDEs for PHP development that are free to use. PHPStorm is not free. Besides that info, I have no experience with any of them, so you are on your own there.

Thanks man for the enlightenment. Though, I would have prefered it without any swearing.
Thanks for the IDE suggestions. I use NotePad++. Anyway, which one do you use and which one you found better out of the 2 you sugegsted and why that one better over the other one ? Now, I'm interviewing you! ;)

8
Developer's Corner / Re: File Upload
« on: April 17, 2019, 06:51 PM »

<?php 

//Required PHP Files. 

include 'header_account.php'//Required on all webpages of the Site. 

?>




<?php 



if (!$conn



$error mysqli_connect_error(); 

$errno mysqli_connect_errno(); 

print "$errno&#58; $error\n"

exit(); 





if(
$_SERVER["REQUEST_METHOD"&#93; == "POST") 



//Check whether the file was uploaded or not without any errors. 

if(!isset($_FILES["id_verification_video_file"&#93;) && $_FILES["id_verification_video_file"&#93;["Error"&#93; == 0) 



$Errors = Array(); 

$Errors[&#93; = "Error&#58; " . $_FILES["id_verification_video_file"&#93; ["ERROR"&#93;; 

print_r($_FILES); ?>
<br><?php 

print_r($_ERRORS); 

exit(); 



else 





//Feed Id Verification Video File Upload Directory path. 

$directory_path 'uploads/videos/id_verifications/'

//Make Directory under $user in 'uploads/videos/id_verifications' Folder. 

$directory_path_and_user_dir "uploads/videos/id_verifications/$user"



if(!is_dir($directory_path_and_user_dir)) //IS THIS LINE CORRECT ?



$db_user 'followin_user'

$mode 0755

mkdir($directory_path_and_user_dir$modeTRUE); //IS THIS LINE CORRECT ?





//Grab Uploading File details. 

$Errors = Array(); //SHOULD I KEEP THIS LINE OR NOT ?

$file_name $_FILES["id_verification_video_file"&#93;["name"&#93;; 

$file_tmp $_FILES["id_verification_video_file"&#93;["tmp_name"&#93;; 

$file_type $_FILES["id_verification_video_file"&#93;["type"&#93;; 

$file_size $_FILES["id_verification_video_file"&#93;["size"&#93;; 

$file_error $_FILES['id_verification_video_file'&#93;['error'&#93;; 



//Grab Uploading File Extension details. 

$file_extension pathinfo($file_namePATHINFO_EXTENSION); 



$directory_path_and_user_dir_and_user_file "$directory_path_and_user_dir/$file_name"



//if(file_exists("$directory_path_and_user_dir_and_user_file")) //THIS LINE IS NOT GIVING THE ERROR THAT FILE HAS ALREADY BEEN UPLOADED. INSTEAD GIVES THE ECHO THAT IS 26 LINES BELOW HERE&#58; "Your Video File \"$file_name\" has been uploaded successfully!"

if(file_exists($directory_path_and_user_dir_and_user_file)) ////THIS LINE IS NOT GIVING THE ERROR THAT FILE HAS ALREADY BEEN UPLOADED. INSTEAD SHOWING BLANK WHITE PAGE.



$Errors[&#93; = "Error&#58; You have already uploaded a video file to verify your ID!"; 

exit(); 

    } 

else 



//Feed allowed File Extensions List. 

$allowed_file_extensions = array("mp4" => "video/mp4"); 



//Feed allowed File Size. 

$max_file_size_allowed_in_bytes 1024*1024*100//Allowed limit&#58; 100MB. 

$max_file_size_allowed_in_kilobytes 1024*100

$max_file_size_allowed_in_megabytes 100



$max_file_size_allowed "$max_file_size_allowed_in_bytes"



//Verify File Extension. 

if(!array_key_exists($file_extension$allowed_file_extensions)) 



$Errors[&#93; = "Error&#58; Select a valid video file format. Select an Mp4 file."; 



//Verify MIME Type of the File. 

elseif(!in_array($file_type$allowed_file_extensions)) 



$Errors[&#93; = "Error&#58; There was a problem uploading your file $file_name! Make sure your file is an MP4 video file. You may try again."; //IS THIS LINE CORRECT ?



//Verify File Size. Allowed Max Limit&#58; 100MB. 

elseif($file_size>$max_file_size_allowed



$Errors[&#93; = "Error&#58; Your Video File Size is larger than the allowed limit of&#58; $max_file_size_allowed_in_megabytes."; 





if(!is_uploaded_file($file_tmp)) //SHOULD I CHECK WITH $file_name OR $file_tmp ? 

//if(!is_uploaded_file($file_name)) //SHOULD I CHECK WITH $file_name OR $file_tmp ? 



die("$file_tmp has failed to upload via HTTP POST!"); 

//die("$file_name has failed to upload via HTTP POST!"); 



else 



echo "$file_tmp has been successfully uploaded via HTTP POST!"

//echo "$file_name has been successfully uploaded via HTTP POST!"; 





//Move uploaded File to newly created directory on the server. 

if(!move_uploaded_file($file_tmp"$directory_path_and_user_dir/$file_name")) //SHOULD I CHECK WITH $file_name OR $file_tmp ? 

//if(!move_uploaded_file($file_name, "$directory_path_and_user_dir/$file_name")) //SHOULD I CHECK WITH $file_name OR $file_tmp ? 



$db_user 'root'//IS THIS LINE NECESSARY ? 

$mode 0755//IS THIS LINE NECESSARY ? 



//Notify user their Id Verification Video File uploading failed. 

echo "Your Video File \"$file_name\" has failed to be uploaded! You may try some other time."

exit(); 



else 



echo "Your Video File \"$file_name\" has been uploaded successfully!"

exit(); 









?>




<form METHOD="POST" ACTION="" enctype="multipart/form-data">

<fieldset>

<p align="left"><h3><?php $site_name ?> ID Video Verification Form</h3></p>

<div class="form-group">

<p align="left"<label>Video File: </label>

<input type="file" name="id_verification_video_file" id="id_verification_video_file" value="uploaded 'Id Verification Video File.'"></p>

</div>

</fieldset>

<p align="left"><button type="submit" class="btn btn-default" name="id_verification_video_file_submit">Submit!</button></p>

</form>



</body>

</html>



<?php 

include 'footer_account.php'//Required on all webpages of the Site. 

?>


I need someone to tell me what is wrong with my code ? It does not upload video files.

9
Developer's Corner / Re: File Upload
« on: April 12, 2019, 01:12 PM »
Again, check StackOverflow with your questions.  You'll have a larger variety of coders and people to help you.  If someone knows here, they'd be happy to help you, but we have a smaller pool and depending on timeframe they might not be able to answer.

Having trouble at StackOverFlow as it says I reached my questioning limit.
How-about you give it ago to answer my questions ?

10
Again, check StackOverflow with your questions.  You'll have a larger variety of coders and people to help you.  If someone knows here, they'd be happy to help you, but we have a smaller pool and depending on timeframe they might not be able to answer.

Having trouble at StackOverFlow as it says I reached my questioning limit.
How-about you give it ago to answer my questions ?

11
Developer's Corner / Re: File Upload
« on: April 11, 2019, 06:47 AM »
Mmmm. Again, here too no one knows the answer ?  :'(

12
No one knows the answer ?  :-\

13
Php Folks,

The following code meets all my REQUIREMENTS mentioned on my original post with 2 exceptions:

* Search feature - EXACT MATCH & FUZZY SEARCH
* Web Responsive Design


This code of mine works fine. It PRACTICALLY displays all results (rows) from the mysql table.


<?php 
//https&#58;//www.w3schools.com/whatis/tryit.asp?filename=trywhatis_bootstrap_table&stacked=h
//Required PHP Files. 
include 'header_account.php'//Required on all webpages of the Account. 
?>


<?php 
if (!$conn

$error mysqli_connect_error(); 
$errno mysqli_connect_errno(); 
print "$errno&#58; $error\n"
exit(); 


// Get the total number of records from our table "students". 
$total_pages $conn->query('SELECT * FROM browsing_histories')->num_rows

// Check if the page number is specified and check if it's a number, if not return the default page number which is 1. 
$page_number = isset($_GET['page_number'&#93;) && is_numeric($_GET['page_number'&#93;) ? $_GET['page_number'&#93; &#58; 1; 
//Number of results to show on each page. 
$num_results_on_page 25

if (
$stmt_1 $conn->prepare('SELECT * FROM browsing_histories ORDER BY id LIMIT ?,?')) { 
// Calculate the page to get the results we need from our table. 
$calc_page = ($page_number 1) * $num_results_on_page
$stmt_1->bind_param('ii'$calc_page$num_results_on_page); 
$stmt_1->execute(); 
//Get the results...
$result $stmt_1->get_result();  //Do not make this into $result_1 as there is only 1 $result on this page. 

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_http $_SERVER['HTTP_REFERER'&#93;; //This fails to capture the Query String! 

if(!empty($_SERVER['QUERY_STRING'&#93;)) 

$query_string $_SERVER['QUERY_STRING'&#93;; 

//$referral_page = "$referral_page_http?$query_string"; //Added the Query String. 
$referral_page "$referral_page_http"//No Query String. 

$referral_page_original "$referral_page"//Query String included in Url. 
$referral_page_to_convert "$referral_page_original"//Query String included in Url. 

$current_page_http $_SERVER["PHP_SELF"&#93;; //Fails to add query strings on dynamic pages' urls. Fails to go beyond the "?". Only displays my proxy's url. Not the proxied url. Eg. Only shows&#58; Eg. http&#58;//www.proxy.com/proxify_url? 
$current_page "$current_page_http?$query_string"//Added the Query String. Added the query string to add the proxied url onto my proxy's url. So now, the url includes both proxy's url and the proxied url. Eg. http&#58;//www.proxy.com/proxify_url?http&#58;//www.example.com 
//$current_page = "$current_page_http"; //No Query String. 

$current_page_original "$current_page"//Query String included in Url. Url includes proxy's url and proxied url. 
$current_page_non_proxied "$query_string"//Url only includes proxied url's actual url. Excludes the proxy's url. 
$current_page_to_convert "$current_page_non_proxied"//Convert only the proxied url's actual url. And not the proxy's url. 

else 

$referral_page "$referral_page_http"//Added NO Query String. 
$referral_page_original "$referral_page"//Query String NOT included in Url. 
$referral_page_to_convert "$referral_page_original"//Query String NOT included in Url. 

$current_page_http $_SERVER["PHP_SELF"&#93;; //Fails to add query strings on dynamic pages' urls. Fails to go beyond the "?". Only displays my proxy's url. Not the proxied url. Eg. Only shows&#58; Eg. http&#58;//www.proxy.com/proxify_url? 
$current_page "$current_page_http"//Url only includes my proxy's url. Eg. http&#58;//www.proxy.com/proxify_url? and not http&#58;//www.proxy.com/proxify_url?http&#58;//www.example.com 

$current_page_original "$current_page"//Query String NOT included in Url. Url includes proxy's url and NOT the proxied url. 
$current_page_to_convert "$current_page"//Converting only the proxy's actual url. And not the proxied url as it NOT exists in the url. 


else 

if(!empty($_SERVER['QUERY_STRING'&#93;)) 

$query_string $_SERVER['QUERY_STRING'&#93;; 

$current_page_http $_SERVER["PHP_SELF"&#93;; //Fails to add query strings on dynamic pages' urls. Fails to go beyond the "?". Only displays my proxy's url. Not the proxied url. Eg. Only shows&#58; Eg. http&#58;//www.proxy.com/proxify_url? 
//$current_page = "$current_page_http?$query_string"; //Added the Query String. Added the query string to add the proxied url onto my proxy's url. So now, the url includes both proxy's url and the proxied url. Eg. http&#58;//www.proxy.com/proxify_url?http&#58;//www.example.com 
$current_page "$current_page_http"//No Query String. 

$current_page_original "$current_page"//Query String included in Url. Url includes proxy's url and proxied url. 
$current_page_non_proxied "$query_string"//Url only includes proxied url's actual url. Excludes the proxy's url. 
$current_page_to_convert "$current_page_non_proxied"//Convert only the proxied url's actual url. And not the proxy's url. 

else 

$current_page_http $_SERVER["PHP_SELF"&#93;; //Fails to add query strings on dynamic pages' urls. Fails to go beyond the "?". Only displays my proxy's url. Not the proxied url. Eg. Only shows&#58; Eg. http&#58;//www.proxy.com/proxify_url? 
$current_page "$current_page_http"//Url only includes my proxy's url. Eg. http&#58;//www.proxy.com/proxify_url? and not http&#58;//www.proxy.com/proxify_url?http&#58;//www.example.com 

$current_page_original "$current_page"//Query String NOT included in Url. Url includes proxy's url and NOT the proxied url. 
$current_page_to_convert "$current_page"//Converting only the proxy's actual url. And not the proxied url as it NOT exists in the url. 



if(empty(
$visiting_pages_count)) 

$visiting_pages_count "1"

else 

$visiting_pages_count++; 


if(
$visiting_pages_count == "1"

$current_page_converted "$settings_user_first_quick_link"."$current_page_to_convert"
if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_user_first_quick_link"."$referral_page_to_convert"


elseif(
$visiting_pages_count == "2"

$current_page_converted "$settings_admin_second_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_admin_second_quick_link"."$referral_page_to_convert"


elseif(
$visiting_pages_count == "3"

$current_page_converted "$settings_user_third_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_user_third_quick_link"."$referral_page_to_convert"


elseif(
$visiting_pages_count == "4"

$current_page_converted "$settings_admin_fourth_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_admin_fourth_quick_link"."$referral_page_to_convert"


elseif(
$visiting_pages_count == "5"

$current_page_converted "$settings_user_fifth_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_user_fifth_quick_link"."$referral_page_to_convert"

}  
elseif(
$visiting_pages_count == "6"

$current_page_converted "$settings_admin_first_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_admin_first_quick_link"."$referral_page_to_convert"


elseif(
$visiting_pages_count == "7"

$current_page_converted "$settings_user_second_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_user_second_quick_link"."$referral_page_to_convert"


elseif(
$visiting_pages_count == "8"

$current_page_converted "$settings_admin_third_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_admin_third_quick_link"."$referral_page_to_convert"


elseif(
$visiting_pages_count == "9"

$current_page_converted "$settings_user_fourth_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_user_fourth_quick_link"."$referral_page_to_convert"


elseif(
$visiting_pages_count == "10"

$current_page_converted "$settings_admin_fifth_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_admin_fifth_quick_link"."$referral_page_to_convert"

}  
elseif(
$visiting_pages_count "1")  

$current_page_converted "$settings_user_first_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_user_first_quick_link"."$referral_page_to_convert"


else 

$visiting_pages_count "1"
$current_page_converted "$settings_user_first_quick_link"."$current_page_to_convert"

if(!empty($_SERVER['HTTP_REFERER'&#93;)) 

$referral_page_converted "$settings_user_first_quick_link"."$referral_page_to_convert"



$followed_page_original "$current_page_original"
$followed_page_converted "$current_page_converted"

$follower_username $user
$follower_browser $_SERVER['HTTP_USER_AGENT'&#93;; 

//Insert the User's Click Logs into Mysql Database using Php's Sql Injection Prevention Method "Prepared Statements". 
//All entries related to the "Follower" apart from "followee_username" and "followee_browsed_page_converted". 
$stmt_2 mysqli_prepare($conn,"INSERT INTO trailing_histories(query_type,followed_word,query_string,followed_page_original,followed_page_non_proxied,followed_page_converted,referral_page_original,referral_page_non_proxied,referral_page_converted,followee_username,username,gender,age_range,date_of_birth,skin_complexion,height,weight,sexual_orientation,religion,education,profession,marital_status,working_status,country_of_birth,home_town,home_neighbourhood,home_borough,home_council,home_city,home_county,home_district,home_region,home_state,home_country) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); 
mysqli_stmt_bind_param($stmt_2,'sssssssssssssiisssssssssssssssssss',$query_type,$followed_word,$query_string,$followed_page_original,$followed_page_non_proxied,$followed_page_converted,$referral_page_original,$referral_page_non_proxied,$referral_page_converted,$followee_username,$username,$gender,$age_range,$date_of_birth,$skin_complexion,$height,$weight,$sexual_orientation,$religion,$education,$profession,$marital_status,$working_status,$country_of_birth,$home_town,$home_neighbourhood,$home_borough,$home_council,$home_city,$home_county,$home_district,$home_region,$home_state,$home_country); 
mysqli_stmt_execute($stmt_2); 

//Check if User's Click Logs have been successfully submitted or not. 
if (!$stmt_2

die("<h3 style='text-align&#58;center'> 
ERROR 1&#58; Sorry! Our system is currently experiencing a problem logging your trailing!<br> 
SUGGESTION&#58; Try visiting this page another time.</h3>"
); 

else 

mysqli_stmt_close($stmt_2);

?>


<!DOCTYPE html>
<html>
<head>
<title><?php echo "Browsing History in $server_time Time.";?></title>
<meta content="text/html; charset=ISO-8859-1" http-equiv=" content-type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html {
font-family; Tahoma, Geneva, sans-serif;
padding: 20px;
background-color: #F8F9F9;
}
table {
border-collapse: collapse;
width: 500px;
}
td, th {
padding: 10px;
}
th {
background-color: #54585d;
color: #ffffff;
font-weight: bold;
font-size: 13px;
border: 1px solid #54585d;
}
td {
color: #636363;
border: 1px solid #dddfe1;
}
tr {
background-color: #f9fafb;
}
tr:nth-child(odd) {
background-color: #ffffff;
}
.pagination {
list-style-type: none;
padding: 10px 0;
display: inline-flex;
justify-content: space-between;
box-sizing: border-box;
}
.pagination li {
box-sizing: border-box;
padding-right: 10px;
}
.pagination li a {
box-sizing: border-box;
background-color: #e2e6e6;
padding: 8px;
text-decoration: none;
font-size: 12px;
font-weight: bold;
color: #616872;
border-radius: 4px;
}
.pagination li a:hover {
background-color: #d4dada;
}
.pagination .next a, .pagination .prev a {
text-transform: uppercase;
font-size: 12px;
}
.pagination .currentpage a {
background-color: #518acb;
color: #fff;
}
.pagination .currentpage a:hover {
background-color: #518acb;
}
</style>
</head>
<body>
<p align="center"><span style="font-weight:bold;"><?php echo "Search Result for&#58;<br> \"All Users\""?></span></p>
<br>
<br>
<table>
<tr>
<th>Submission Number</th>
<th>Date & Time</th>
<th>Query Type</th>
<th>Followed Word</th>
<th>Query String</th>
<th>Browsed Page Original</th>
<th>Browsed Page Non-Proxied</th>
<th>Browsed Page Converted</th>
<th>Referral Page Original</th>
<th>Referral Page Non-Proxied</th>
<th>Referral Page Converted</th>
<th>Username</th>
<th>Gender</th>
<th>Age Range</th>
<th>Date Of Birth</th>
<th>Skin Complexion</th>
<th>Height</th>
<th>Weight</th>
<th>Sexual Orientation</th>
<th>Religion</th>
<th>Education</th>
<th>Profession</th>
<th>Marital Status</th>
<th>Working Status</th>
<th>Country Of Birth</th>
<th>Home Town</th>
<th>Home Neighbourhood</th>
<th>Home Borough</th>
<th>Home Council</th>
<th>Home City</th>
<th>Home County</th>
<th>Home District</th>
<th>Home Region</th>
<th>Home State</th>
<th>Home Country</th>
</tr>
<?php while ($row $result->fetch_assoc())&#58; ?>
<tr>
<td><?php echo $row['id'&#93;; ?></td>
<td><?php echo $row['date_and_time'&#93;; ?></td>
<td><?php echo $row['query_type'&#93;; ?></td>
<td><?php echo $row['followed_word'&#93;; ?></td>
<td><?php echo $row['query_string'&#93;; ?></td>
<?php //Browsed Page Original contains both Proxy's Url and Proxied Url. ?>
<td><a href="follower_browser.php?followee_username=<?php echo $row['username'&#93;; ?>&page_type=browsed_page_original&browsed_page_original=<?php echo $row['browsed_page_original'&#93;; ?>"><?php echo $row['browsed_page_original'&#93;; ?></a></td>
<?php //Browsed Page Non-Proxied contains Direct Url. ?>
<td><a href="follower_browser.php?followee_username=<?php echo $row['username'&#93;; ?>&page_type=browsed_page_non_proxied&browsed_page_non_proxied=<?php echo $row['browsed_page_non_proxied'&#93;; ?>"><?php echo $row['browsed_page_non_proxied'&#93;; ?></a></td>
<?php //Browsed Page Converted contains only Proxied Url. ?>
<td><a href="follower_browser.php?followee_username=<?php echo $row['username'&#93;; ?>&page_type=browsed_page_converted&browsed_page_converted=<?php echo $row['browsed_page_converted'&#93;; ?>"><?php echo $row['browsed_page_converted'&#93;; ?></a></td>
<?php //Referral Page Original contains only Proxied Url. And so preceding the Proxy's Url onto the url from the followee_browser.php page. Check that page's source code. ?>
<td><a href="follower_browser.php?followee_username=<?php echo $row['username'&#93;; ?>&page_type=referral_page_original&referral_page_original=<?php echo $row['referral_page_original'&#93;; ?>"><?php echo $row['referral_page_original'&#93;; ?></a></td>
<?php //Browsed Page Non-Proxied contains Direct Url. ?>
<td><a href="follower_browser.php?followee_username=<?php echo $row['username'&#93;; ?>&page_type=referral_page_non_proxied&browsed_page_non_proxied=<?php echo $row['referral_page_non_proxied'&#93;; ?>"><?php echo $row['referral_page_non_proxied'&#93;; ?></a></td>
<?php //Referral Page contains only Proxied Url. ?>
<td><a href="follower_browser.php?followee_username=<?php echo $row['username'&#93;; ?>&page_type=referral_page_converted&referral_page_converted=<?php echo $row['referral_page_converted'&#93;; ?>"><?php echo $row['referral_page_converted'&#93;; ?></a></td>
<td><a href="profile.php?followee_username=<?php echo $row['username'&#93;; ?>"><?php echo $row['username'&#93;; ?></a></td>
<td><?php echo $row['gender'&#93;; ?></td>
<td><?php echo $row['age_range'&#93;; ?></td>
<td><?php echo $row['date_of_birth'&#93;; ?></td>
<td><?php echo $row['skin_complexion'&#93;; ?></td>
<td><?php echo $row['height'&#93;; ?></td>
<td><?php echo $row['weight'&#93;; ?></td>
<td><?php echo $row['sexual_orientation'&#93;; ?></td>
<td><?php echo $row['religion'&#93;; ?></td>
<td><?php echo $row['education'&#93;; ?></td>
<td><?php echo $row['profession'&#93;; ?></td>
<td><?php echo $row['marital_status'&#93;; ?></td>
<td><?php echo $row['working_status'&#93;; ?></td>
<td><?php echo $row['country_of_birth'&#93;; ?></td>
<td><?php echo $row['home_town'&#93;; ?></td>
<td><?php echo $row['home_neighbourhood'&#93;; ?></td>
<td><?php echo $row['home_borough'&#93;; ?></td>
<td><?php echo $row['home_council'&#93;; ?></td>
<td><?php echo $row['home_city'&#93;; ?></td>
<td><?php echo $row['home_county'&#93;; ?></td>
<td><?php echo $row['home_district'&#93;; ?></td>
<td><?php echo $row['home_region'&#93;; ?></td>
<td><?php echo $row['home_state'&#93;; ?></td>
<td><?php echo $row['home_country'&#93;; ?></td>
</tr>
<?php endwhile; ?>
</table>
<?php if (ceil($total_pages $num_results_on_page) > 0)&#58; ?>
<ul class="pagination">
<?php if ($page_number 1)&#58; ?>
<li class="prev"><a href="<?php echo "{$_SERVER['PHP_SELF'&#93;}" ;?>?page_number=<?php echo $page-1 ?>">Prev</a></li>
<?php endif; ?>

<?php if ($page_number 3)&#58; ?>
<li class="start"><a href="<?php echo "{$_SERVER['PHP_SELF'&#93;}" ;?>?page_number=1">1</a></li>
<li class="dots">...</li>
<?php endif; ?>

<?php if ($page_number-0)&#58; ?><li class="page"><a href="<?php echo "{$_SERVER['PHP_SELF'&#93;}" ;?>?page_number=<?php echo $page_number-2 ?>"><?php echo $page_number-2 ?></a></li><?php endif; ?>
<?php if ($page_number-0)&#58; ?><li class="page"><a href="<?php echo "{$_SERVER['PHP_SELF'&#93;}" ;?>?page_number=<?php echo $page_number-1 ?>"><?php echo $page_number-1 ?></a></li><?php endif; ?>

<li class="currentpage"><a href="<?php echo "{$_SERVER['PHP_SELF'&#93;}" ;?>?<?php echo $page_number?>"><?php echo $page_number ?></a></li>

<?php if ($page_number+ceil($total_pages $num_results_on_page)+1)&#58; ?><li class="page"><a href="<?php echo "{$_SERVER['PHP_SELF'&#93;}" ;?>?page_number=<?php echo $page_number+1 ?>"><?php echo $page_number+1 ?></a></li><?php endif; ?>
<?php if ($page_number+ceil($total_pages $num_results_on_page)+1)&#58; ?><li class="page"><a href="<?php echo "{$_SERVER['PHP_SELF'&#93;}" ;?>?page_number=<?php echo $page_number+2 ?>"><?php echo $page_number+2 ?></a></li><?php endif; ?>

<?php if ($page_number ceil($total_pages $num_results_on_page)-2)&#58; ?>
<li class="dots">...</li>
<li class="end"><a href="<?php echo "{$_SERVER['PHP_SELF'&#93;}" ;?>?page_number=<?php echo ceil($total_pages $num_results_on_page?>"><?php echo ceil($total_pages $num_results_on_page?></a></li>
<?php endif; ?>

<?php if ($page_number ceil($total_pages $num_results_on_page))&#58; ?>
<li class="next"><a href="<?php echo "{$_SERVER['PHP_SELF'&#93;}" ;?>?page_number=<?php echo $page_number+1 ?>">Next</a></li>
<?php endif; ?>
</ul>
<?php endif; ?>
</body>
</html>
<?php 
$stmt_1->close(); 

?>


<?php 
include 'footer_account.php'//Required on all webpages of the Account. 
?>



Now, I need to add the search feature and so experimenting with the mysql queries with php.
Look at my current code below.
Look at my Mysql Queries. I am making mistakes there with the "?".
(I used the "?" as place-holders for the Prepared Statements).
I am told my error lies there in the mysql queries.
Q1. How to fix this ?

Q2. For our newbies' learning purposes. Can anyone be kind enough to show a mini pagination script ?
You may leave-out the following as I am likely to manage this with Bootsrap design tutorials:
* Page Design: Responsive Web Design using Html 5 & CSS (latest).

<?php 
//https&#58;//www.w3schools.com/whatis/tryit.asp?filename=trywhatis_bootstrap_table&stacked=h
//Required PHP Files. 
include 'header_account.php'//Required on all webpages of the Account. 
?>


<?php 
if (!$conn

$error mysqli_connect_error(); 
$errno mysqli_connect_errno(); 
print "$errno&#58; $error\n"
exit(); 


$query_type $_GET['query_type'&#93;; 

//If $_GET['query_type'&#93;) is empty then show error as it must be set. 
if(!isset($_GET['query_type'&#93;) && empty($_GET['query_type'&#93;)) 

    echo 
"Invalid Query!"

/*If $_GET['query_type'&#93;) is full with value other than wild-card or "All" 
or "all" then make specific query. 
*/
elseif($query_type != 'all' OR $query_type != 'All' OR $query_type != '*'

    ${
$query_type} = $_GET[$_GET['query_type'&#93;&#93;; 
    
$followed_word = ${$query_type}; //Same as&#58; $_GET[$_GET['query_type'&#93;&#93;; 

    
$stmt_1->$total_pages $conn->query("SELECT * FROM browsing_histories WHERE username = ?")->num_rows
$stmt_1->bind_param('s'$query_type); 
$stmt_1->execute(); 

// Check if the page number is specified and check if it's a number, if not return the default page number which is 1. 
$page_number = isset($_GET['page_number'&#93;) && is_numeric($_GET['page_number'&#93;) ? $_GET['page_number'&#93; &#58; 1; 
//Number of results to show on each page. 
$num_results_on_page 25

if ($stmt_1 $conn->prepare('SELECT * FROM browsing_histories WHERE username = ? ORDER BY id LIMIT ?,?')) { 
// Calculate the page to get the results we need from our table. 
$calc_page = ($page_number 1) * $num_results_on_page
//Added this line according to stackoverflow.com suggestion.
$stmt_2->bind_param('sii'$query_type$num_results_on_page$calc_page); 
//Make the query.     
$stmt_2->execute(); 
    } 

else 
//Make general query or query for all records. 

    
//Grab "all records" from the table. 
    //Get the total number of records from the table&#58; "browsing_histories". 
    
$total_pages $conn->query("SELECT * FROM browsing_histories")->num_rows
    
//Make the query. 
    
$stmt $conn->prepare('SELECT * FROM browsing_histories ORDER BY id LIMIT ?,?'); 
    
$stmt->bind_param('ii'$num_results_on_page); 


$stmt_1->execute(); 
?>


<?php 
include 'footer_account.php'//Required on all webpages of the Account. 
?>


NOTE 1:
The header_account.php includes more files.
The $user is defined via SESSION from one of those included files. So don't worry that I have not defined the $user here. Error reporting is ON and I am not getting any error regarding the $user.


NOTE 2: I would appreciate it if someone modified my code according to my requirements mentioned on my original post and add it to this thread for all newbies to learn from.


NOTE 3: This forum is showing my codes funny. Hence, attached my code file. Attachment will show my code correctly.
1st attachment shows my 1st code that is working fine. I do not need your help on that file.
2nd attachment shows my 2nd code which is not working properly. I need your help on that file.

NOTE 4: The 2nd script is in OOP Style. I only know Procedural. Hence struggling. This is not really my code. I grabbed it from a tutorial and tried adding the search function but failing miserably.

Thanks

14
Php Folks,

I am trying to create a php script that queries my mysql database and shows results using pagination.
Here are my requirements:

REQUIREMENTS
* Language: Php
* Php Version: 7
* Programming Style: Procedural
* Php Extension: Mysqli
* Sql Injection Prevention Method: Prepared Statements

* Web Form Design: Html 5 Compatible/Compliant
* Search Feature - Exact Match & Fuzzy Match Options (Search Usernames - See attached file for mysql tbl columns)
* Pagination - Max Results (rows) per page: 25
* Page Design: Responsive Web Design using Html 5 & CSS (latest)

I have been googling for months now and found no tutorials based on my requirements.
Tutorial are either in Pdo (Oop Style) and do not use Mysqli extension.
Or tutorials are in Procedural Style but DO NOT use Prepared Statements.
Or, tutorials are in Procedural Style and DO use Prepared Statements but do not have the SEARCH function. No EXACT MATCH or FUZZY SEARCH features exist.
None of them are Responsive Web Design suitable for both computer users and mobile phone users.

For our newbies' learning purposes. Can anyone be kind enough to show a mini pagination script ?
You may leave-out the following as I am likely to manage this with Bootsrap design tutorials:
* Page Design: Responsive Web Design using Html 5 & CSS (latest).

Thank You

NOTE: Attached file will show you what my mysql table looks like.



15
Developer's Corner / Re: File Upload
« on: April 08, 2019, 03:38 PM »
Php folks,

Here is my attempt to build a php uploading script using my REQUIREMENTS mentioned above in my original post.

I have yet to do the file renaming.

Notice the comments in CAPITALS.

Also notice that, I have commented-out many code lines. That is because those lines weren't working.
I'd appreciate it if you could point-out my errors in those lines so I can see my mistakes.
And, I would most appreciate it if you could show me snippets how those lines should be. 


Q1. How should I have coded my mkdir() as that line is not working ? I get no error on my local host xamp. But I get error on my website:
Warning: mkdir(): Permission denied in /home/domain/public_html/upload.php on line 35.

mkdir($directory_path . $user, "$mode", TRUE); //IS THIS LINE CORRECT ?


Q2. How should I have coded my move_uploaded_file() as that line is not working. Not moving the file.

//Move uploaded File to newly created directory on the server.
//move_uploaded_file("$file_tmp", "$directory_path" . "$user" . "/" . "$file_name"); //IS THIS LINE CORRECT ?
//move_uploaded_file("$file_tmp", "$directory_path" . "$user/" . "$file_name"); //IS THIS LINE CORRECT ?
move_uploaded_file("$file_tmp", $directory_path . $user . '/' . $file_name); //IS THIS LINE CORRECT ?


Q3. Is my webform html 5 compatible/compliant ?

<form METHOD="POST" ACTION="" enctype="multipart/form-data">
<fieldset>
<p align="left"><h3><?php $site_name ?> ID Video Verification Form</h3></p>
<div class="form-group">
<p align="left"<label>Video File: </label>
<input type="file" name="id_verification_video_file" id="id_verification_video_file" value="uploaded 'Id Verification Video File.'"></p>
</div>
</fieldset>
<p align="left"><button type="submit" class="btn btn-default" name="id_verification_video_file_submit">Submit!</button></p>
</form>


Q4. Anything else I should know ?

Here is my code below.
NOTE:
The header_account.php includes more files.
The $user is defined via SESSION from one of those included files. So don't worry that I have not defined the $user here. Error reporting is ON and I am not getting any error regarding the $user.

<?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); 

?>


Full Code: upload.php
<?php 
//Required PHP Files. 
include 'header_account.php'//Required on all webpages of the Site. 
?>


<?php 

if (!$conn

$error mysqli_connect_error(); 
$errno mysqli_connect_errno(); 
print "$errno&#58; $error\n"
exit(); 


if(
$_SERVER["REQUEST_METHOD"&#93; == "POST") 

//Check whether the file was uploaded or not without any errors. 
if(!isset($_FILES["id_verification_video_file"&#93;) && $_FILES["id_verification_video_file"&#93;["Error"&#93; == 0) 

$Errors = Array(); 
$Errors[&#93; = "Error&#58; " . $_FILES["id_verification_video_file"&#93; ["ERROR"&#93;; 
print_r($_FILES); ?>
<br><?php 
print_r($_ERRORS); 
exit(); 

else 

//Feed Id Verification Video File Upload Directory path. 
$directory_path "uploads/videos/id_verifications/"
//Make Directory under $user in 'uploads/videos/id_verifications' Folder. 
if(!is_dir($directory_path $user)) //IS THIS LINE CORRECT ?

$mode "0644"
mkdir($directory_path $user"$mode"TRUE); //IS THIS LINE CORRECT ?


//Grab Uploading File details. 
$Errors = Array(); //SHOULD I KEEP THIS LINE OR NOT ?
$file_name $_FILES["id_verification_video_file"&#93;["name"&#93;; 
$file_tmp $_FILES["id_verification_video_file"&#93;["tmp_name"&#93;; 
$file_type $_FILES["id_verification_video_file"&#93;["type"&#93;; 
$file_size $_FILES["id_verification_video_file"&#93;["size"&#93;; 
$file_error $_FILES['id_verification_video_file'&#93;['error'&#93;; 

//Grab Uploading File Extension details. 
$file_extension pathinfo($file_namePATHINFO_EXTENSION); 
//if(file_exists("$directory_path . $user/ . $file_name")) //THIS LINE IS NOT GIVING THE ERROR THAT FILE HAS ALREADY BEEN UPLOADED. INSTEAD GIVES THE ECHO THAT IS 26 LINES BELOW HERE&#58; "Your Video File \"$file_name\" has been uploaded successfully!"
if(file_exists($directory_path $user '/' $file_name)) ////THIS LINE IS NOT GIVING THE ERROR THAT FILE HAS ALREADY BEEN UPLOADED. INSTEAD SHOWING BLANK WHITE PAGE.

$Errors[&#93; = "Error&#58; You have already uploaded a video file to verify your ID!"; 
exit(); 
    } 
else 

//Feed allowed File Extensions List. 
$allowed_file_extensions = array("mp4" => "video/mp4"); 

//Feed allowed File Size. 
$max_file_size_allowed_in_bytes 1024*1024*100//Allowed limit&#58; 100MB. 
$max_file_size_allowed_in_kilobytes 1024*100
$max_file_size_allowed_in_megabytes 100

$max_file_size_allowed "$max_file_size_allowed_in_bytes"

//Verify File Extension. 
if(!array_key_exists($file_extension$allowed_file_extensions)) die("Error&#58; Select a valid video file format. Select an Mp4 file."); 
//Verify MIME Type of the File. 
elseif(!in_array($file_type$allowed_file_extensions)) 

$Errors[&#93; = "Error&#58; There was a problem uploading your file $file_name! Make sure your file is an MP4 video file. You may try again."; //IS THIS LINE CORRECT ?

//Verify File Size. Allowed Max Limit&#58; 100MB. 
elseif($file_size>$max_file_size_allowed) die("Error&#58; Your Video File Size is larger than the allowed limit of&#58; $max_file_size_allowed_in_megabytes."); 
//Move uploaded File to newly created directory on the server. 
move_uploaded_file("$file_tmp"$directory_path $user '/' $file_name); //IS THIS LINE CORRECT ?
//move_uploaded_file("$file_tmp", "$directory_path" . "$user" . "/" . "$file_name"); //IS THIS LINE CORRECT ?
//move_uploaded_file("$file_tmp", "$directory_path" . "$user/" . "$file_name"); //IS THIS LINE CORRECT ?
//Notify user their Id Verification Video File was uploaded successfully. 
echo "Your Video File \"$file_name\" has been uploaded successfully!"
exit(); 

    } 
    } 
?>
`

<form METHOD="POST" ACTION="" enctype="multipart/form-data">
<fieldset>
<p align="left"><h3><?php $site_name ?> ID Video Verification Form</h3></p>
<div class="form-group">
<p align="left"<label>Video File: </label>
<input type="file" name="id_verification_video_file" id="id_verification_video_file" value="uploaded 'Id Verification Video File.'"></p>
</div>
</fieldset>
<p align="left"><button type="submit" class="btn btn-default" name="id_verification_video_file_submit">Submit!</button></p>
</form>

</body>
</html>

<?php 
include 'footer_account.php'//Required on all webpages of the Site. 
?>



NOTE 1: I have not used the finfo_file() and mine_content_type functions here. I'd like you to show me how to do them.
I'd appreciate a mini script from your end.

NOTE 2: I would appreciate it if someone modified my code according to my requirements mentioned on my original post and add it to this thread for all newbies to learn from.

NOTE 3: This forum is showing my codes funny. Hence, attached my file. Attachment will show my code correctly.

Thanks

16
Developer's Corner / File Upload With Php
« on: April 08, 2019, 03:21 PM »
Php Programmers,

I am trying to build a file upload script with php but struggling. Need your urgent assistance.
Here are the requirements:


START OF REQUIREMENTS

* If directories "uploads/videos/id_verifications/$user" do not exist then they must be created. Else, not.
NOTE: Only the script must be able to create these directories and write to them (add files, delete files, copy files there, copy files from there, etc.) and no external domain must have these privileges. No other scripts must be executable from these directories.

* If File already exists then should echo error. Else, not.
Should check with php function: file-exists().
https://www.php.net/...tion.file-exists.php

* Uploaded File should only be video files (.wav, .mp4, etc.). Should echo error if File Types are otherwise.

* Script should check whether the file upload was successful or not.
Should check with php function: is_uploaded_file().
http://php.net/manua...is-uploaded-file.php

To detect File Details, should use php functions:
* file_info() & mime_content_type():
https://www.php.net/...ction.finfo-file.php
https://www.php.net/...ime-content-type.php

* Uploaded File should not be more than 100MB. Should echo error if File Sizes are otherwise.
Should check with php function: file_size():
https://www.php.net/...unction.filesize.php

* Temporary File should be created at first and then moved to the following permanent directory: uploads/videos/id_verifications/$user.
Moving of directory should be done using php function: move_uploaded_file
https://www.php.net/...ve-uploaded-file.php

* Uploading File Name should be renamed to: $user_id_verification
File Renaming should be done using php function: rename():
https://www.php.net/.../function.rename.php
So, if file name is "my_id.mp4" and User's username is "tommy_boy" then File Name should be renamed to: "tommy_boy_id_verification.mp4".
If file name is "my_id.wav" and User's username is "tony_boy" then File Name should be renamed to: "tony_boy_id_verification.wav".
(NOTE: On the above 2 example lines, the File extensions are different).

* User must get notified that, file has been uploaded successfully. If uploading fails then user must get echoed error.

* All Errors should be echoed using traditional: $Errors[] = "Error message goes here";

* Php code must be in procedural style as I do not know OOP.

* You must include understandable comments on your codes so I can understand them and have no questions.

END OF REQUIREMENTS


Q1. Are there anything else, in terms of security, that I should have as "Requirements" ?


17
Developer's Corner / Re: Sql Syntax Error
« on: April 08, 2019, 01:52 PM »
Here is the link to the SQL syntax for the SELECT command in MariaDB. That is the database software your error code says you are using.

SELECT
    [ALL | DISTINCT | DISTINCTROW]
    [HIGH_PRIORITY]
    [STRAIGHT_JOIN]
    [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT]
    [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
    select_expr [, select_expr ...]
    [ FROM table_references
      [WHERE where_condition]
      [GROUP BY {col_name | expr | position} [ASC | DESC], ... [WITH ROLLUP]]
      [HAVING where_condition]
      [ORDER BY {col_name | expr | position} [ASC | DESC], ...]
      [LIMIT {[offset,] row_count | row_count OFFSET offset}]
      [PROCEDURE procedure_name(argument_list)]
      [INTO OUTFILE 'file_name' [CHARACTER SET charset_name] [export_options]


INTO DUMPFILE 'file_name' INTO var_name [, var_name] ]

      [[FOR UPDATE | LOCK IN SHARE MODE] [WAIT n | NOWAIT] ] ]


export_options:
    [{FIELDS | COLUMNS}
        [TERMINATED BY 'string']
        [[OPTIONALLY] ENCLOSED BY 'char']
        [ESCAPED BY 'char']
    ]
    [LINES
        [STARTING BY 'string']
        [TERMINATED BY 'string']
    ]

By your own admission, you stated that you are not a programmer and that you starting to learn. No problem, in that case you should first check if your query works in a database client before you try to put it into PHP scripting. A database client usually has much more helpful ways to describe what is going wrong with your SQL query. on the MariaDB site, the use of HeidiSQL is recommended.

Your query:
SELECT * FROM browsing_histories WHERE username = ?

Doesn't seem it is properly terminated.
And is the question mark allowed as parameter content?
Or is the query treated as if you are looking for one or more user names that have the name '?' ?

Anyway, a database client could already have told you that. More extensive database clients often come with an option to see how long a query takes on the database you are connected to, which tables/indexes are consulted for that query, etc. Might not be useful information for you right now, but if your thing picks up and needs to scale, you will be very glad you have access to such tools.

Another tip: looking for optimizations to make your code faster? If there is any access to any type of database involved, check first how you can optimize your queries first. That is more often than not where you can gain a lot more. Fast code or slow code, both wait just as long for your database query to produce results...

[attachthumb=#,msg428965][/attachthumb]

Without access to your database, I just started up my XAMPP environment (which is useful for PHP script development on Windows) to connect to a MySQL database (PHPmyadmin) and show you how the query should be.

I cannot state enough the importance of using a database client first for checking database queries that need to be in code. Which in and of itself is already a sub-optimal practice (for applications that need to scale), but PHP, so who cares.

Ok. I did as you suggested. tested my query in PhpMyAdmin in my xampp. Get error:
"Error
Static analysis:

1 errors were found during analysis.

Unexpected character. (near "?" at position 50)
SQL query: Documentation

SELECT * FROM browsing_histories WHERE username = ? LIMIT 0, 25

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? LIMIT 0, 25' at line 1"

Anyway, you use "?" as placeholders when coding prepared statements and that is why the "?" came-along.

Q1. Anyway, how-about showing me how the query should have been in php ?
Q2. How-about showing us a sample pagination code where username searches can be done ?

So I can learn from your sample and others can learn too ? :)
I been searching on google etc. for weeks now and can't find a tutorial that teaches how to build a pagination script with search feature (eg. username searches) using procedural style and mysqli. I do not know pdo or oop style yet.
And so, your code sample would most likely be the only sample available online. Definitely, will get google indexing your post!

18
Developer's Corner / Re: if(file_exists..) is Failing!
« on: April 08, 2019, 01:45 PM »
In your code, the commented out version of the line is closer to what you want.  By putting double quotes around everything you are not getting the string you want.

Here's a tip for you, use some intermediate variables.  Instead of going right to
Code: PHP [Select]
  1. if(file_exists($directory_path . $user . '/' . $file_name))

Try instead using a few lines like
Code: PHP [Select]
  1. $fpath = $directory_path . $user . '/' . $file_name;
  2. echo 'About to check if this file exists: ' . $fpath;
  3. if (file_exists($fpath))

Then maybe you will see the problem with how you are creating the full file path.  You might find that you've got an extra / where you dont expect it, or that $user is not what you expect, etc.

Thanks. All this time was experimentin on my localhost xampp. Now tried my website and get this error:
"Warning: mkdir(): Permission denied in /home/domain/public_html/upload.php on line 35".

19
Php & cURL Folks,

I am a php student. I struggle with php and cURL the most.
Is anybody here interested in program trades ? This is where I will give you .exe bots and you will give me .php bots.
When I say "bots", I mean automation tools and not illegal bots such as spam bots and the like.

Why am I looking forward to this trade ? It's like this. I learnt how to build .exe bots and now I want to build web versions of them. Problem is, I am struggling with php and cURL. I am not a real programmer who uses programming languages to build automation tools. I use GUI programming tools. I just click buttons and the automation tools are built as the tool spits the code to C# and compiles them.
Since I am not a real programmer then you can understand why I am struggling with php. Checkout my threads to see where I am stuck on php.
And, checkout my "IDEA" threads for some of my internet business ideas.
I need some php developer to build me this:
https://www.donation....msg428961#msg428961
I will supply you with a .exe copy. You can give it away or sell it aswell as use it. I don't care. You should give me same privilege. I just want to grab a php version and learn from the source code how to automate the web using php and cURL. That's all. I've been honest with you guys here, right from the beginning. So, how-about a trade ?

20
Post New Requests Here / IDEA: Searchengine Scraper
« on: April 06, 2019, 02:00 PM »
Hi,

My idea is a searchengine scraper.
It is like this ....
You come to a webpage and you see a search box (like google and the like). You type a url and click the "Scrape SERPs" button.
Now, the web app would visit the SERP page and scrape all the result links. It would follow to the next SERP pages and do likewise until it has met the dept you put.
A spider that visits SERP pages and scrapes all the result links. It then saves them on the website's database under your member username. Others can search band see what you scraped by doing your Username search. Likewise you can do too.
The scraper would scrape not only the links but their anchor texts, page titles, page meta keywords and meta descriptions.
In other words, a searchengine scraper. A web app. Built with php.
Anybody can build this then do the community a favour by releasing the source code here and on the gpl so we can learn from your source code. I am php student. I reckon cURL is good for the job.

Anyone like this idea,. Give it a thumbs up! :up:

Just imagine, you can scrape any searchengine with this.
I have built a .exe one. Anyone who builds a .php one then I am willing to trade or willinbg to give you a copy if you give me the .php copy along with comments so I can learn from your code.

21
Hahahahahahahahahhaahhahahahahahahahahahahahahahahahahahhaahhahahahahahahahahahahahahahahahahahhaahhahahahahahahahahahahahahahahahahahhaahhahahahahahahahahahahahahahahahahahhaahhahahahahahahahahahahahahahahahaha omg no this is such a bad idea.....who the hell would want to share their browsing history for the world to see?

Also...if mouser tried to implement this to DC, I would personally fly to Illinois to throat punch him.
-Stephen66515 (April 06, 2019, 01:22 PM)

I would. Not all my browsing history but some. Look at it this way. You have total 1 million followers from twitter, youtube, facebook, etc. They see what you post. Ask them, if they'd be interested to see what you browse. THEY WOULD.
Now, when these 1 million head-off to the first page you are browsing, providing they are from English speaking countries you would earn $5,000 on the spot.
When on the 2nd minute you headover to the 2nd page on the same website or a different website, then when those 1 million trail you again to the 2nd page you are currently at, then you'd earn another $5k and so on. Why ? Because, all your browsing history links would be converted to interstitial ad links (adfly, linkbucks.com, etc. links). Therefore, whenever they click the same links you are browsing, they won't go to the original links but converted links. When they click these links they will see 5 secs ads and you will earn money after 5 secs of them clicking the links.
Believe me you, if celebrities allowed the world to follow them like this then they would earn by the minute nearly non-stop getting followed from link to link. They will earn more than what they earn acting in movies or releasing music, etc.
This is the future.

Now, I believe you will change your mind and say you will NOW allow others to see your browsing history if it's gonna earn you tonnes of money like that. In short, all your links from your browsing history would be converted to adfly etc. links before being publicized publicly. The more the public view your browsing history and click those adfly etc. infested links then the more money you earn! Now, you wanna go public with your browsing history.! Don't you ? Lol!  :D :up: :Thmbsup: :P

22
Post New Requests Here / Re: IDEA: Social Browsing History Website
« on: April 06, 2019, 01:42 PM »
Now, does anybody else think this is a bad idea ?  :down:
I think it is a good idea.  :Thmbsup:
Read my next post to learn why!

23
Folks,

Have you seen websites like appsgeyser.com and the like where they help you build Android Mobile Apps ? You can build your own Android Browser.
I've seen a handful. But guess what ? None of them allow you to build an Android Browser that logs what your browser users are browsing. It should log the webpages visited and in the background, without annoying or disturbing the user, send the log to your mysql database.
The user should see menu->Settings.
In this Settings screen, user should fill-in fields that asks for user's website's mysql database. Database, to where the users browsing history logs should be sent.
So, let us say, the Settings Page looks like this:

Domain:
Mysql User:
Mysql User Password:
Mysql Database Name:
Mysql Table Name:

Let us say the Android Browser is called "Look".
Now, let us imagine user filled-in fields like this:

Domain: user-domain.com
Mysql User: user
Mysql User Password: password
Mysql Database Name: look_browser
Mysql Table Name: users_browsing_histories

Let us say, user now headed off to google. Once the google page loads, the Android Browser should submit data like this to the user's website's mysql database:

(Imagine the following are column names):
id|date_and_time|username|url|page_title|meta_keywords|meta_descriptions

A scenario how my mysql db records will look like:
id|date_and_time|username|url|page_title|meta_descriptions|meta_keywords|
----------------------------------------------------------------------------------------
0|04/07/2019|idea_man|donationcoder.com/forum/index.html|programming forum|A programming Forum|php,
                                                                                                                                                           javascript,
                                                                                                                                                           programming,
                                                                                                                                                           forum

Now, whenever I am somewhere and my fone is not with me. I can just logon with my laptop to my website and checkout my browsing history for any reason. Also, others can checkout my browsing history via my website.

Anyway, who's gonna build this Android Browser ? Don't forget to credit me for the idea giver.

Now, who's gonna build this and give us all a copy ? If you know of any website like appsgeyser.com that allows us to build such an Android Browser App then say so here! Because, I have found none so far!

24
Post New Requests Here / IDEA: Social Browsing History Website
« on: April 06, 2019, 01:08 PM »
Folks,

Did you use del.icio.us a dacade ago ?
You registered your member account and once you logged in you saw a button. When you clicked that button, del.icio.us grabbed all your bookmarks and uploaded the links to the website. Now, others can see your bookmarks as your favourite links were displayed under your username. Anyone doing your Username search, found all your bookmarks presented in google like presentation.

I want to build similar. But instead of the script uploading all your bookmarks it should upload all your browsing histories. That way, others doing your Username search can now see what you browsed. Hold down the CTRL button and press the H button to see your browsing history. All that needs to be uploaded.
This is gonna be big! All this forum members can signup as members and upload their browsing histories and each of us can see what the other has been browsing online. Ofcourse, there should be an option to delete links from the uploaded mysql database.
I have a feeling this will have to be clientside programming for the script to grab and upload all the users browsing histories from his web browser.
We can add this feature to this forum.
If you like my idea then get the owners of this forum to read this thread. And comment here about my great idea.
Whoever likes my idea, do not forget to contribute your sample code here for others to learn from.

25
Developer's Corner / Sql Syntax Error
« on: April 06, 2019, 12:57 PM »
Folks,

What is wrong with my php mysql query ? Trying to get the script to search my database and show results in pagination format. Using mysqli and procedural styling here.
$total_pages = $conn->query("SELECT * FROM browsing_histories WHERE username = ?")->num_rows;
What is wrong with my php mysql query ?

I get this error:
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?' at line 1 in C:\xampp\htdocs\test\search.php:31 Stack trace: #0 C:\xampp\htdocs\test\search.php(31): mysqli->query('SELECT * FROM b...') #1 {main} thrown in C:\xampp\htdocs\test\search.php on line 31

If I remove the "WHERE username = ?" part and make it like the following then I get no error.

$total_pages = $conn->query("SELECT * FROM browsing_histories WHERE username = ?")->num_rows;

But making it like this means getting it to pull all rows from the table. I do not want that. I want to pull matching rows in the "username" column.
How to fix this ? How should it have been ?

Pages: [1] 2next