HTML Form Posts - Using Checkboxes with a Long Name attribute - html

I'm having a bit of an issue with some coding. I have made a file restore PHP script that will allow a person to place a checkbox next to the name of a file - and then when they click the "Restore" button at the bottom, it will restore the file in question from a backup.
Unfortunately, there seems to be a problem. The full path and name of the file are in the checkbox's "name" attribute - so that way it is passed along to the next script as the location and file that needs restored.
As an example:
<input type="checkbox" name="/backups/Sunday/111111111111-com/www/components/com_virtuemart/" />
See how long the "name" attribute is? In many cases, the restore works - but once the name attribute gets longer, it doesn't work anymore. In the above attribute, the "name" field is 63 characters long.
Now, if another one is tried:
<input type="checkbox" name="/backups/Sunday/111111111111-com/www/components/com_virtuemart/js/" />
The above "name" attribute is 67 characters long. It DOES NOT work.
On the script that the POST data is being posted to, I did a var_dump($_POST); to see what the output was. In the first case where the "name" attribute was 63 characters long, the var_dump displays it. But in the second case where the attribute was 67 characters long, it does not display it - and therefore the file is not restored.
Is there any way around this supposed attribute size limit? I looked online and saw several posts where individuals said there was no limit to the length of the "name" attribute - but apparently there is one.
Thank you!

Its the suhosin php hardener thats doing it no doubt. You can either edit the suhosin config directory or you need to take a different approach.
Maybe the easiest way without recoding a chunk of your script to use aliasing or storing a key=>value array persistently would be to simply make the name of your inputs "files[]" and put the path tot he file as the checkbox value. then you can just do
foreach($_POST['files'] as $f) {
//$f is the file path
}
However myself i dont like to do things like this. Id try and store a key=>value array somewhere. If you dont want to use a database, just serialize a php array into a file, then just have the checkboxes with the integer array key for each file. Then on the processing script you can simply get the files from the stored array at the posted integer indexes

Related

How can I read in a TXT file in Access that is over 255 char/line and contains control char?

I am running Access 2010. I need to read in a TXT file into a string. Each line can be anywhere from 40 to 320 char long, ending in a CR. The biggest problem is the TXT file of various lines contains comma's (,) and quotations (") as part of the data.
Is there a trick to doing this? Even if it is getting each char, and testing to see if it is a CR....
To accomplish this task, you will need to write your own import code that will read directly from the file. The Microsoft Access import features will not handle a file like this very well, and since you want to analyze each line in code, it is better to handle reading it yourself.
There are many approaches you can take, and all will involve File handles and Opening the file. But, the best approach is to use a class that does all of the dirty work for you.
One such class is the LargeTextFile class that can be found in any of the Microsoft Access Developer's Handbooks (Volume 1) for Access 97, 2000, 2002 or 2003, written by Getz, Litwin, and Gilbert (Sybex), if you have access to one of them.
Another option would be the clsReadTextFile class, available for free on the Access MVP Site (The Access Web) site:
http://www.theaccessweb.com/downloads/clsReadTextFile.txt
Using clsReadTextFile you can process your file, line by line using code similar to this:
Dim file As New clsReadTextFile
Dim line As String
file.FileName = "C:\MyFile.txt"
file.cfOpenFile
Do While Not file.EndOfFile
file.csGetALine
line = file.Text
If InStr(line, "MySearchText") Then
'Do something
End If
Loop
file.cfCloseFile
The line string variable will contain the text of the line just read, and you can write code to parse it how you need and process it appropriately. Then the loop will go on to read the next line. This will allow you to process each line of the file manually in your code.
It is not clear from your post as to whether or not you can - or have tried - to use the tools available in the product for this task. Access 2010 offers linking to a .txt file as well as appending a .txt file to a table. These are standard features in the External tab of the ribbon.
The Large Text (formerly Memo) field type allows ~4K characters. Not sure if you wish to attempt to bring in all the txt data into a single field - if so then this limit is important.
If the CRs of the text document imply a new record/row of data - rather than a continuous string for the entire document - - AND - - - if there is any consistent structure within all rows of data - then the import wizard can use either character count or symbols (i.e. comma if they exist) - as the means to separate/segregate each individual row of data into separate fields in a single row of a table.

opengrock file path search now needs a quoted value

We just upgraded from opengrok-0.11.1 to opengrok-1.0 to allow access to the history and annotations etc.
However many search strings now need quoted. We used to be able to search for a file path containing unquoted hosts.txt which now finds hundreds of matches vs a quoted search for "hosts.txt" which finds the expected two files. Is there some default we can tweek to change the analyzers being used for different fields. Is this a bug?
According to the OpenGrok help (OpenGrok > Help):
if you want just exact path, enclose it in "", e.g. "src/mypath",
otherwise dividers will be removed and you get more hits
This change happened on 24-Oct-13 due to Lucene changes according to the issue 672 (where you can find more info about).

PsychoPy: Error reading variable specified in the conditions file

I've been working on designing an experiment in Psychopy, and I am running into some problems with the interaction between my conditions file and a text element. I am trying to get my conditions file (CSV format) to specify the position of two text elements (the variables are "NowPos" and "LaterPos"). In the CSV file, underneath the headers, I have two different coordinate pairings listed. In the "position [x,y]" field of the text element conditions, I have written "$NowPos" (or "$LaterPos", depending on the element). With this, I intend to direct PsychoPy to read the specified variable from my conditions file, which is placed in a loop outside of the routine that calls for the variables it contains. However, it appears that the code automatically compiled by PsychoPy is trying to define "NowPos" and "LaterPos" at the beginning of the program. Because of this, they are undefined at the time that PsychoPy asks for them, causing my code to fail.
Do you have any ideas for getting PsychoPy to look for the right conditions file immediately? Could I have formatted something incorrectly?
Next to the position field, you need to select an option like "Set every repeat", so that a new position value is accessed on every trial.
The problem you describe sounds like you have left it at the default setting of "Constant", in which case the value only needs to be set once, at the beginning of the experiment. At that stage, as you note, the loop hasn't been created, thus its variables haven't been defined, and aren't available to refer to.

Three rows of almost the same code behave differently

I have three dropdown boxes on a Main_Form. I will add the chosen content into three fields on the form, Form_Applications.
These three lines are added :
Form_Applications.Classification = Form_Main_Form.Combo43.Value
Form_Applications.Countryname_Cluster = Form_Main_Form.Combo56.Value
Form_Applications.Application = Form_Main_Form.Combo64.Value
The first two work perfectly but the last one gives error code 438!
I can enter in the immediate window :
Form_Applications.Classification = "what ever"
Form_Applications.Countryname_Cluster = "what ever"
but not for the third line. Then, after enter, the Object doesn't support this property or method error appears.
I didn't expect this error as I do exactly the same as in the first two lines.
Can you please help or do you need more info ?
In VBA Application is a special word and should not be used to address fields.
FormName.Application will return an object that points to the application instance that is running that form as opposed to an object within that form.
From the Application object you can do all sorts of other things such as executing external programs and other application level stuff like saving files/
Rename your Application field to something else, perhaps ApplicationCombo and change your line of code to match the new name. After doing this the code should execute as you expect.
Form_Applications.Application is referring to the application itself. It is not a field, so therefore it is not assignable (at least with a string).
You really haven't provided enough code to draw any real conclusions though. But looking at what you have posted, you definitely need to rethink your approach.
It's to say definitely but you are not doing the same. It looks like you are reading a ComboBox value the same (I will assume Combo64 is the same as 43 and 56) but my guess is that what you are assigning that value to is the problem:
Form_Applications.Application =
Application is not assignable. Is there another field you meant to use there?

PDF Open Parameters: comment=commentID doesn't work

According to Adobe's Manual on PDF Open Parameters PDF files can be opened with certain parameters from command line or from a link in HTML.
These open Parameters include page=pagenum, zoom=scale, comment=commentID and others (the first parameter should be preceded with a # and the next should be preceded with a &
The official PDF Open Parameters from adobe gives this example:
#page=1&comment=452fde0e-fd22-457c-84aa-2cf5bed5a349
but the comment part doesn't work for me!
page=pagenum and zoom=scale work for me well. But comment=commentID does not work. I tried on Adobe reader 6.0.0 and Adobe Pro Extended 9.0.0: I can't get to the specified comment.
Also, I get the comment ID by exporting the comments in XFDF format and in the resulting file, there is a name attribute for every comment that I hope corresponds to the ID (well, the appearance looks like the example in the manual).
I thought maybe there is a setting that I should first enable (or maybe disable in adobe) or maybe I am getting the comment IDs wrong, or maybe something else?!
Any help would be extremely appreciated
According to the docs, you must include a page=X along with your comment=foo. Your copied sample has it, but it's copied from the docs, not something you did yourself.
Are you missing a page= when setting comment?
BASTARDS!
From the last page of the manual you linked:
URL Limitations
●Only one digit following a decimal point is retained for float values.
●Individual parameters, together with their values (separated by & or #), can be no greater then 32 characters in length.
Emphasis added.
The comment ID is a 16-byte value expressed as hex, with four hyphens thrown in to break up the monotony. That's 36 characters right there... starting with "comment=" adds another 8 characters. 44 characters total.
According to that, a comment ID can NEVER WORK, including the samples they show in their docs.
Are you just trying it on the command line, or have you tried via a web browser too? I wonder if that makes a difference. If not, we're looking at a feature that CANNOT WORK. EVER... and probably never has.