Jump to content


Member Since 01 Dec 2005
Offline Last Active Jan 07 2018 08:28 AM

Topics I've Started

Too Many Inputs In Html Form

06 January 2018 - 12:13 PM



I have an HTML form with a large number of inputs on it. Most of them are <select> elements each with 6 options. There are currently 1295 of these selects, plus a few other inputs, but the number is not constant, since the form is generated dynamically, and it depends on the number of rows and the number of columns for the currently selected period. In the $_POST array it seems that I am only receiving 1000 values, which means that some of the ones I need I am not receiving. I have tried changing the value of max_input_vars in /home/myaccount/public_html/php.ini from 1000 to 10000, but this does not seem to have improved anything. Do I have to do anything (e.g. restart the server) for it to read this file? Or is this the wrong way of changing this limit? Or do I need to reduce the number of inputs in some way (it's not easy to see a way to do this without a lot of Javascript, which I have been trying to avoid).


Thanks - Rowan

Mysql Syntax Being Rejected

21 May 2017 - 01:50 PM

I have the following SQL being executed by a mysqli_query() statement in my PHP code:


DROP TEMPORARY TABLE IF EXISTS tmptable; CREATE TEMPORARY TABLE tmptable SELECT * FROM Members WHERE MemberId = '105' AND Status > '0'; UPDATE tmptable SET RecordId = '', Status = '0', ChangedBy = '4', ChangedOn = '2017-05-21 19:03:39'; UPDATE Members SET Status = '0' WHERE MemberId = '105' AND Status > '0'; INSERT INTO Members SELECT * FROM tmptable;


It is being rejected with the following error:


Errno: 1064 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TEMPORARY TABLE tmptable SELECT * FROM Members WHERE MemberId = '105' AND' at line 1 at line 952 in file: /home/sylvest/public_html/swchoir/edit_member.php


If I put the same SQL into the SQL tab in phpMyAdmin, it works fine.


What do I have to do to make this work in my PHP code?


Thanks - Rowan

Trouble With Header() Redirect On My Php Page

04 May 2017 - 06:53 AM

I have a web page which under certain conditions forwards to another one using the statement:




where $next_page == "Location: http://www.sylvester...p?v=1493894983"


This causes a 500 error.


I am reasonably sure that I have sent no output at all (other than to a log file) before the header statement. In any case, on other occasions where I have done this I seem to get a warning, which in this case is not happening.


I see nothing in any error_log files that I am aware of (that is /home/sylvest/error_log and /home/sylvest/pubic_html/swchoir/error_log) nor do I see anything relevant in the cPanel Errors list.


What am I doing wrong? How can I debug what is happening? I have a log statement early in the redirected-to file (index.php) and this does not seem to be being triggered, so I don't think it is ever executing this file.


Thanks - Rowan

Why Am I Getting "class 'passwordhash' Not Found" In P

27 April 2017 - 12:53 PM

I am trying to use the PHP password hashing module in my code, but the following line:

$hasher = new PasswordHash(8, false);

is giving me the error:

Fatal error: Class 'PasswordHash' not found in /home/myaccount/public_html/directory/edit_member.php on line 124


I am running PHP version 5.6.30. I thought that all versions from 5.5.0 onwards had this module? What do I have to do to enable me to use this?


Thanks - Rowan

Getting Mod_Rewrite To Work

20 April 2017 - 01:21 PM

I am trying to come up with a way of redirecting all requests for files in the directory http://mydomain/swchoir/<filename> to the file with the same name (and the same GET parameters if present) in the directory /home/myaccount/build00001/public_html/swchoir/<filename>.

My end objective is to allow the server to contain several different builds and for people who have the necesary permissions to be able to choose which one they want to look at, so for example I could have one build that is on public release, another that is in QA, and a third which is in development. Ordinary users would only be able to see the public release one. QA people would be  able to see either the public release or the QA build. And developers would be able to see all of them.

As a step towards this, I am trying to develop some rewrite rules that will send _all_ users to build00001. The lines I have added to the .htaccess file in /home/sylvest/public_html are:

SetEnvIfExpr True build_num=00001
Rewrite Rule ^swchoir/([0-9a-z/\.?&_=-]+)$ /home/myaccount/buildbuild_num/public_html/swchoir/$1 [NC, L]
php_value include_path ".:/home/myaccount/buildbuild_num/include"

Now when I try to access a page I get an internal server error.

Please can you suggest what is wrong with my rule, or how to best get this to do what I want? In particular I'm not sure how to use the Environmental Variable build_num that I have tried to define. I'm not sure whether "SetEnvIfExpr True" is valid, and I'm not sure whether "sylvest/buildbuild_num/public_html" is a valid way of using the variable. Seems unlikely, but I'm not sure whether it needs some kind of quotes to indicate that it is a variable name, and if so, what kind.

If you know a better way of doing the whole job, please tell me that too. It seems odd to me that something like this doesn't already exist somewhere, since it surely must be a commmon need.

Thanks - Rowan