Jump to content

enveetee

Members
  • Posts

    32
  • Joined

  • Last visited

  • Days Won

    1

enveetee last won the day on January 26 2015

enveetee had the most liked content!

enveetee's Achievements

Member

Member (2/5)

1

Reputation

  1. I have several scripts which contain the exact same function name and accept the same number of arguments example script1.php <?php function DoThis($arg1){ . . } ?> script2.php <?php function DoThis($arg1){ . . } ?> script3.php <?php function DoThis($arg1){ . . } ?> What syntax should I use (if indeed i can) to call each one. Is it something to do with NAMESPACE? Thanks
  2. Now, you say that you know where the files went and that you store that location to retrieve it later. What's stopping you from retrieving it now? ...because the url is different for each server Sometimes the app is in the root, sometimes in a sub folder
  3. I know where I created / copied the files to, and I store that location so I can retrieve it later; for example /thismonth /lastmonth /soontobedeleted I need to get a url to a known file in either of those folders
  4. Hi My app sends out emails. Included in the email is a link to a PDF document which can be downloaded and views. The document(s) reside in different folders on the server, only known at creation time. My app can run from the root as well as a folder How can I get the url to the file for inclusion in the email. examples are http://www.myserver.com/docs/document1.pdf http://www.myserver.com/document2.pdf http://www.myserver.com/docs/anotherfolder/document1.pdf Thanks
  5. Mac_gyver - thanks, very enlightening. The solution seems to be to keep sensitive files (MySQL credentials and raw uploaded files) in a folder which the server cannot access so now the question becomes: How do I access files outside of the server web root? public_html/ /phpfiles /includes /docs /script /other /sensitivefiles <<<<< (my php scripts need access to the contents of this folder but a browser cannot gain access) Cheers
  6. OK, so my application is now in the Beta phase and I am rolling it out to some tame customers. I am using justhost.com for hosting using a standard Business Pro package Each one of my PHP scripts has an required_once to a PHP include which contains the MySQL login name and password details. Obviously if anyone gains access to this the game is over. Where is the best place to keep this file (I have it in ../includes) How do I stop anyone from seeing the contents Thanks
  7. Apologies everyone, brain fade here. I had echo statements inside include files which was wrecking the php output Sorry to waste everyone's time
  8. I have a client application which runs a script on my server using HTTP POST How can I get a clean result of that script Currently, the script returns all sorts of headers, fonts and so on All I need is the name of the currently executing script (__file__?) and a result 1 or 0 plus any error message Suggestions please..
  9. Looking for some guidance on this... I have two applications, A windows desktop application written in VB6/VB.NET and my new (and learning) PHP/MYSQL app. I am mirroring records between them. Records can be added to both systems and I synchronise them. I am currently dealing with downloading the PHP/MYSQL records to my desktop and was wondering if I was going about it in the right way. This is how I have designed it... I have a common form which deals with three actions (POLL, DOWNLOAD and CONFIRM) using POST. I can return the number of records to be downloaded (using the POLL) paramater, the actual record (using a DOWNLOAD parameter along with a record ID) and finally a CONFIRM parameter to mark the MYSQL record as having been downloaded and is in the desktop database. I am ECHO'ing out values from the PHP form which is being received by the desktop component. This does work, but was wondering if the way I was doing it is ok - it seems too simple which scares me! Comments/advice/bullet-between-the-eyes - please here's the code if you are interested... <?php require_once('../includes/cs_functions.php'); require_once('../includes/cs_password.php'); require_once('../includes/meekrodb.2.3.class.php'); require_once('../classes/cUser.php'); FN_MeekroDBSetup(); //Call as POLL first to return id's of records needed to be downloaded TAB separated //Whitelist the POST values into WhiteListParameter array $WLP = allowed_post_params(['cs_name', 'cs_password', 'cs_mode', 'cs_id', 'cs_serialno', 'cs_downloadtime']); //Declare the user class for user name and password validation later $cUser = new clsUser; //These are debug settings so form can be executed in Netbeans $WLP['cs_name'] = 'Admin'; $WLP['cs_password'] = 'a'; $WLP['cs_mode'] = 'POLL'; $WLP['cs_mode'] = 'DOWNLOAD'; $WLP['cs_mode'] = 'CONFIRM'; //Validate user, returns NULL if user not valid $cUser = FN_Validate_User($WLP['cs_name'], $WLP['cs_password'], TRUE); if ($cUser == NULL) { } else { //Detect mode POLL, CONFIRM, DOWNLOAD switch ($WLP['cs_mode']) { case "POLL": //Check if any records to be downloaded and return a TAB delimited list of record ID's $resultsArray = db::query("SELECT * FROM bk WHERE bkwebbooking=%s AND bkwebbooking_downloadedtime=%s", '1', NULL); $tmp = ''; foreach ($resultsArray as $row) { $tmp = $tmp . $row['id'] . chr(9); } //Loose trailing TAB $tmp = FN_Shorten($tmp, 1); break; case "DOWNLOAD": //Return the record for import into desktop system $resultsArray = db::query("SELECT * FROM bk WHERE id=%s", $WLP['cs_id'], NULL); $tmp = ''; foreach ($resultsArray as $row) { $tmp = $tmp . $row['id'] . chr(9) . $row['bkaccount'] . $row['bkservice']; } break; case "CONFIRM": //Update MYSQL record with time and serial number from desktop system $cs_serialno, $cs_downloadtime default: $tmp = 'Call with POLL or DOWNLOAD or CONFIRM'; break; } echo $tmp; }
  10. @CroNix not sure I understand your answer... I don't have a 'php user' Its just a website with php scripts. The scripts can be executed by any browser
  11. I am trying to upload a large dataset in CSV format for batch loading into a MYSQL table using LOAD DATA INFILE The CSV file (test.csv) is in /var/services/web/php My table is in /var/services/mysql/TABLENAME When I run the SQL command from a PHP script I get an error ERROR: Can't get stat of '/var/services/mysql/TABLENAME/test.csv' (Errcode: 2) Which I believe is because the file needs to be in /var/services/mysql/TABLENAME. Indeed, if I move it there, it works fine If I try and use the LOCAL switch LOAD DATA LOCAL INFILE I get an error stating that feature is not available. Research shows it can cause a security hole and needs to be enabled separately, something I am not prepared to do I cant copy the file in my PHP script to /var/services/mysql/TABLENAME as it is outside or /var/services/web So short of manually copying the FTP'd file to my table directory, how could I copy it from my PHP script? This also leads to my second question 'how do I access files outside my web root' Thanks
  12. I am trying to upload a large dataset in CSV format for batch loading into a MYSQL table using LOAD DATA INFILE The CSV file (test.csv) is in /var/services/web/php My table is in /var/services/mysql/TABLENAME When I run the SQL command from a PHP script I get an error ERROR: Can't get stat of '/var/services/mysql/TABLENAME/test.csv' (Errcode: 2) Which I believe is because the file needs to be in /var/services/mysql/TABLENAME. Indeed, if I move it there, it works fine If I try and use the LOCAL switch LOAD DATA LOCAL INFILE I get an error stating that feature is not available. Research shows it can cause a security hole and needs to be enabled separately, something I am not prepared to do I cant copy the file in my PHP script to /var/services/mysql/TABLENAME as it is outside or /var/services/web So short of manually copying the FTP'd file to my table directory, how could I copy it from my PHP script? This also leads to 'how do I access files outside my web root' Thanks My scripts is in /var/services/web/php , this directory is not accessable from my PHP script. I can FTP the CSV file to the server but I cannot copy the file to my table's directory and I cannot assess the FTP folder from within the LOAD DATA INFILE
  13. Hi Not sure if anyone can help me here - probably better off asking on a VB forum. I have a desktop database application written in Visual Basic 6. As records are added to the local VB6 database, copies are POSTed to my PHP application. Users can add records to the PHP application on-line, and these record(s) a transferred down to the desktop system for inclusion into the VB6 database - all works fine (100 way to skin a cat I suppose). I was wondering, what the best way of polling the server to see if there are any records waiting to be downloaded? I am currently using an HTTP POST and checking the response Thanks...
  14. Hi I have a desktop system which uses plain text files for its storage and I need to do a one off import of these files (tables) into a SQL table The largest table as just under 2 million records each of 850 bytes in length I have written a PHP script and used set_time_limit to zero. The server ran for about 8 hours but did not import the entire table Maybe I should be uploading a CSV? What is the best way to go about this - best practice/suggestions please
  15. Hi As my application grows, I am becoming more and more concerned about my configuration and .INC files which are contained within sub directories of my web root folder. I am lead to understand that it is good practice to move sensitive files (those containing passwords and mysql logon credentials) outside of the general www folder How do I access those files in PHP with, say an include or required statement I am currently using include'../configuration/config.php' how do I access files above ../ Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.