-
Posts
53 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by Pavlin24
-
Yes. Thank you. I found the user defined in the documentation. And now it works.
-
I am not using phpMyAdmin. Now I use this user for first time. Must I define it somewhere first?
-
Hi again. I could not manage with this problem. So I decided to try this on my PC using XAMPP. But here appeared problem again. This is the error message: "Warning: mysqli_connect(): (HY000/1045): Access denied for user 'pavlin24'@'localhost' (using password: YES) in C:xampphtdocscreate_db.php on line 2Failed to connect to MySQL: Access denied for user 'pavlin24'@'localhost' (using password: YES)Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in C:xampphtdocscreate_db.php on line 11Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in C:xampphtdocscreate_db.php on line 17Error creating database:" And here is the code: <?php$con=mysqli_connect("localhost","pavlin24","123");// Check connectionif (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); }// Create database$sql="CREATE DATABASE my_db";if (mysqli_query($con,$sql)) { echo "Database my_db created successfully"; }else { echo "Error creating database: " . mysqli_error($con); }?> What might be the problem?
-
Yes.Thank you. It turned out that the type is "application/download". This is for Firefox. But for IE it is "application/octet-stream".
-
I tried with "text/plain" - do not work. I tried also with: "text/php" "application/php" "application/x-httpd-php" - (that is shown on the server as type) Not work Other suggestions?
-
Hi again. I have a question related to this topic. In the code above are allowed image files for uploading. Now I want to allow .php files for uploading. What script exactly I must put. I mean, for images script is ($_FILES["file"]["type"] == "image/jpeg") What will be for php "? /php"
-
Hallo, I need some help again. Today I tried to create a data base with MySQL. Here is the code: <?php$con=mysqli_connect("pavlin-angelov.com","pavlin24","abc123");// Check connectionif (mysqli_connect_errno()) //ако има грешка при свързването { echo "Failed to connect to MySQL: " . mysqli_connect_error(); //показва грешката }// Create database$sql="CREATE DATABASE my_db";if (mysqli_query($con,$sql)) { echo "Database my_db created successfully"; }else { echo "Error creating database: " . mysqli_error($con); }?> And here is the error message: Fatal error: Call to undefined function mysqli_connect() in /home/pavlinan/public_html/create_db.php on line 2 What might be the reason for this?
-
OK. Thank you. It seems this filter will not be very usefull. :]
-
OK. But when I try with example from the tutoral ( with URL //www.W3ååSchøøools.com/ ) it did not sanitize either.
-
OK. I understand first part. About removing characters- For example when I input "www.dir...bg" I expect to stay "www.dir.bg".
-
I expect when I leave ihe input field empty to show me message "Input type does not exist". And when I input wrong URL to remove wrong characters.
-
Hi I try to put code for sanitize input data in my site. Here are the codes: -------------------------------------------------------------------- <!DOCTYPE html><html><body><form action="url_sanitize.php" method="post" >Въведи URL адрес:<input type="text" name="url"><input type="submit" value="Submit"></form></body></html> ----------------------------------------------------------------- <?phpif(!filter_has_var(INPUT_POST, "url")) { echo("Input type does not exist"); }else { $url = filter_input(INPUT_POST, "url", FILTER_SANITIZE_URL); }echo "Sanitized URL:".$url;echo "<br>".$_POST["url"];?> --------------------------------------------------------------------- It do not work. When I put wrong URL address in the form, it shows the same after sanitizing. Here is the link to form file: http://www.pavlin-angelov.com/form_url.html Where might be the problem?
-
Finaly I succeed to upload a file. The problem was resolved by itself. I have not done anything. But my hosting deliverer have had problems. After my site ren again I succeed to upload. Thank you for the help.
-
Must I create some tables or data base with sql before run all these scripts?
-
I saw the "post_max_size" settings . It is 60M. And upload_max_filesize is 50mB. I saw this with phpinfo() function.( see attachment). The file I try to upload is 14kB. So the the size of the file is not the reason. Doc4.doc
-
Which browser do you use?
-
So think I. Is it possible there is a mistake in tutoral code?
-
No. I checked again.And copied the code from the tutoral lesson again. The name of field in form is 'file'. And the index of $_FILES is 'file'. I am attaching again the content of two files. Regarding size limit, I do not know how mach is the limit, but I tried with very small file (20kB) downloadl.doc
-
Hi dsonesuk I've made this test. It works with both .php extension and .php5 extension.
-
I am not running the php first ! First I run the 'form_upload_file.html' file, where is the form data. I tried again with Chrome, this time button worked, but return the same messge for error as IE.
-
Hi. Don E, I tried this, but no result. I have replaced "file" with "pic". It gives the same mistake (see the attachment). Meanwhile, I tried to upload the file with Chrome browser. But there, in the form, the browse button (for choosing the file) is not active. This is file form.doc
-
Hi again and thank you for attention This morning I tried to upload the file with Internet explorer. Untill now I tried with Firefox. It appered this message: Notice: Undefined index: file in /home/pavlinan/public_html/upload_file.php on line 7Notice: Undefined index: file in /home/pavlinan/public_html/upload_file.php on line 9Notice: Undefined index: file in /home/pavlinan/public_html/upload_file.php on line 10Notice: Undefined index: file in /home/pavlinan/public_html/upload_file.php on line 11Notice: Undefined index: file in /home/pavlinan/public_html/upload_file.php on line 12Notice: Undefined index: file in /home/pavlinan/public_html/upload_file.php on line 13Notice: Undefined index: file in /home/pavlinan/public_html/upload_file.php on line 14Invalid file What does it mean?
-
Yes. But , why I still can not upload a file ?!
-
Hallo, and thank you for yor replies. OK. I added the code that justsomeguy suggested, but there is no result. But I noticed then in 'upload' directory there is a file called "opacity.png". May be it is your file Justoneguy ?! Here is the code: <?phpini_set('display_errors', 1);error_reporting(E_ALL);$allowedExts = array("gif", "jpeg", "jpg", "png");$temp = explode(".", $_FILES["file"]["name"]);$extension = end($temp);if ((($_FILES["file"]["type"] == "image/gif")|| ($_FILES["file"]["type"] == "image/jpeg")|| ($_FILES["file"]["type"] == "image/jpg")|| ($_FILES["file"]["type"] == "image/pjpeg")|| ($_FILES["file"]["type"] == "image/x-png")|| ($_FILES["file"]["type"] == "image/png"))&& ($_FILES["file"]["size"] < 60000)&& in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } }else { echo "Invalid file"; }?>