-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
Retrieving single xml node value in PHP GCal Script
Ch0cu3r replied to m1kcal's topic in PHP Coding Help
###TITLE### is replaced by the value of $entry->title on line 144. $entry->title returns the title for the current entry in the google calendar. -
So you have changed the name of a folder and you want to redirect to the new folder name? You could handle this using mod_rewrite, a few examples You can also use mod_rewrite to redirect to your new domain too.
-
The russian user is performing a CRSF and/or XSS attack. You need to change the way you allow users of your site to change their status. For example you should only allow users to change their status from a POST request and you should issue a csrf token to prevent anyone from submitting a status value from outside of yoursite. You also need to change how you validate external images your users are linking to. You need to check they are linking to an actual image, not a file with just a image extension on the end of the filename. For example one way to check if it is an image is to use getimagesize(). This function will return the image dimensions if it is a valid image. If its not a valid image it'll return false. If this happen you an reject image.
-
Scraping data from a website HTML source (with VB example)
Ch0cu3r replied to Raex's topic in PHP Coding Help
By using simpleXML -
how to add selected dropdown option in database with php
Ch0cu3r replied to aavik's topic in PHP Coding Help
In add.php you are only running a query to insert a record into your ckeditor table. There is no other code in add.php to "output" anything. So that would be expected output if the script ran successfully. You need to be aware that using raw $_POST data (or any data from a user) in a query is extremely dangerous. You should sanitize any user input before using it in a query to protect yourself from SQL injection. I would strongly advise you to not use the mysql_* functions as these are now deprecated meaning they are no longer supported and could soon be removed from future versions of php. Instead use either MySQLi or PDO. Using prepared queries when using user input in a query. -
@xubuntu69 so this is all false information! Do you really think if this was not possible we'd post code which will never work. Also it would of been beneficial at the start you told use that these files you were trying to include where part of your CMS. Jazzman1 has concluded your CMS is at fault. It is restricting where certain files can and can nott be included from, maybe its for security. You can only blame the creators of the CMS for not being flexible enough.
-
I don't think they have officially announced when it is going to happen. For now it is available to use but will issue an E_DEPRECATED error when you use it. This is to discourage anyone from using it. If you are starting a new project today there should be no reason not to use MySQLi or PDO. If you have an existing project then you should start to consider upgrading your code to use either of those APIs now. There is not point in holding out waiting for the official announcement to come.
-
So $directvps->go() returns a json encoded array posted in your first post? If that the case your foreach should read foreach($data as $iso) { printf"<option value='%s'>%s</option>", $iso['isoid'] $iso['omschrijving']); }
-
Instead of using file_get_contents use cURL to send your POST request to Sendy. Your host could have restrictions on the use of file_get_contents even though allow_url_fopen is enabled. Alternatively use SendyPHP which is a PHP interface for the sendy api.
-
@darkside619 Hasn't Barand already suggested to you what you need to do in your other post here. Barands select query returns all the available hours a trainer is available for taking into account their scheduled appointments. Sounds to me you are not understanding Barands solution?
-
Sounds to me an issue with how your server is setup. I'd recommend you to start looking at your servers error logs to identify the cause of the 500 Internal Server Error.
-
Yes you can concatenate strings using comma or period but it depends on the context it is used. Such as you can only concatenate using commas in print and echo constructs. In any other case you must use periods. Personally I just stick to periods. the page would not return as html tag <pre> You mean to say the value returned from print_r is not contained within the <pre></pre> tags? By default print_r will just print the contents of value given. If you need capture the value then you need to tell it to return its value. As CroNix said above. function dd($var){ return '<pre>' . print_r($var, 1) . '</pre>'; }
-
Query and output data from same table in db
Ch0cu3r replied to phpbnoobb23's topic in PHP Coding Help
That is because you have named your File Name field file1 <input type="text" name='file1' id='sampleID' list="samp"> </input><br> You need to the name it File_name as this is the name of field you are trying to get the value of in PHP ( $_POST['File_name'] ) -
Query and output data from same table in db
Ch0cu3r replied to phpbnoobb23's topic in PHP Coding Help
Is that the actual code for listing files? You do realise you have repeated the first 24 lines of HTML twice! First sort your HTML out and make sure it is valid and then debug your PHP code to see why the files are not being listed. -
Whoa! Interesting it also applies to style tags too. I guess the dom doesn't know the context of the tags until the document tree is parsed.
-
You should take Jacques1 advice and normalize your data. Updating values within a value is bad practice But for now you can do the replacement using a query like UPDATE mytable SET space = REPLACE(space, ' 5 ', ' 0 ') WHERE id = 20 The query will update the row where id = 20 and replace (space)5(space) with (space)0(space) If we didn't pad 5 with spaces it will replace all instances of 5 to 0, eg 15 will become 10
-
Query and output data from same table in db
Ch0cu3r replied to phpbnoobb23's topic in PHP Coding Help
Didnt pick that up earlier You are getting that error because you have called the mysqli_query function using procedural code and have not passed it the $db instance as the first argument. When using mysqli procedurally you must pass in the database instance as the first argument for any function that requires it. Alternatively you can replace mysqli_query with $db->query -
Reset $current to 5 before setting your array
-
You mean to say you want to pass arguments to __get when you call a property? That is not possible and just weird. When you access a property PHP auto-magically calls __get passing the property name as an argument. I think you may be interested in __set if you are wanting to set a properties value? When you assign a value to a property PHP will auto-magically call __set passing in the property name and value as arguments
-
Encode your array with the JSON_UNESCAPED_SLASHES flag $json = json_encode($data, JSON_UNESCAPED_SLASHES);
-
Query and output data from same table in db
Ch0cu3r replied to phpbnoobb23's topic in PHP Coding Help
Well that is more like it. But you still have some issues $File_name->real_escape_string($File_name); You have got your variables mixed up there, real_escape_string() is a method belonging to the $db object. So $File_name-> should be $db-> Next you are escaping an undefined variable called $File_name. You need to be escaping the $_POST['File_name'] variable here and then save the escaped value to a variable called $File_name Line 9 should read as $File_name = $db->real_escape_string($_POST['File_name']); The next problem is line 12 if(($result->num_rows) = 1) { You need two equal signs to compare values. The = should be == -
What can we possibly tell you.... We are not mind readers here You need to give some information such as what it is you are trying to do. What is the drop down menu for. What should be in the drop down. What should the PHP code being doing etc. What is the PHP code not doing that it should be doing etc. With out info we are clueless. Also when posting code please wrap it within tags.
-
Query and output data from same table in db
Ch0cu3r replied to phpbnoobb23's topic in PHP Coding Help
No. You have clearly ignored what I and adam_bray have said. The links adam gave explains what There is a fundamental difference between the mysql_ and mysqli_ (note the i )functions. You cannot use them together like you have done. They are separate function libraries. You need to replace all your mysql_ functions to the mysqli_ counterparts. The article adam links to explains how do that. -
In the php.ini? If thats the case you should not be getting a blank white screen. Check your servers error logs for the errors too. Your could change your code to this to see where it is failing <?php echo "I am in: " . getcwd(); function require_file($file) { echo "<p>Checkfing if $file exists in ".realpath(dirname($file))." ..."; if(file_exists($file)) { echo "OK, attemping to require it... "; require_once($file); echo "OK"; } else { echo 'FAIL'; } echo '</p>'; } $magictitle = "Blinds Stealing - Poker Lesson School"; require_file('../mainfile.php'); $module_name = basename(dirname(__FILE__)); $index = 1; require_file('../header.php'); require_file('../footer.php'); ?>
-
What output are you getting? Do you get any errors? If you do post them here in full. What steps have you taken to debug your code? Also make sure you error reporting enabled in your php.ini configuration or add the following two lines at the top of your script ini_set('display_errors', 1); error_reporting(E_ALL);