chrishea 182 Nearly a Posting Virtuoso

I made a few changes as shown below and the download worked in IE (and Chrome):

1. In returnMIMEType on line 21 you used $fileSuffix[1]. That is not defined. I changed that to $ext.

2. In getDownLoadData, on line 15 I changed header("Pragma: public"); to header("Pragma: no-cache");

3. In getDownLoadData, I deleted line 23 because it isn't needed and it isn't being given the right data and makes the downloaded file unusable.

When I checked, I found that the file I was able to download previously was not actually usable.

It is important and a lot less frustrating if you know how to debug these things for yourself. A few well placed echo's (or some actual debug function calls if you want to get a bit fancier) will tell you if you are getting the data that you expected. For the mime-type, it would have worked for most types but I happened to use a .png file and the code for that wasn't quite right. I did a separate call to the returnMIMEType function (before all the headers) and echo'd what came back. When I saw that I was getting 'image/' with no type I went and looked closer at the code and found the problem. In this case, I could have just looked at the code but if it was more complicated, using a bit of debug code will probably save time. For the header statements, I used a program of my own as …

chrishea 182 Nearly a Posting Virtuoso

You have quotes within quotes on line 234. You need to escape the nested quotes or use double quotes inside single quotes (or the reverse). I changed it below to use the outer quotes as single quotes instead of double quotes

$stylesheets .= '<link type="text/css" rel="stylesheet" href="{$mybb->settings[\'bburl\']}/{$page_stylesheet}" n/>';
$already_loaded[$page_stylesheet] .= 1;
chrishea 182 Nearly a Posting Virtuoso

If you don't have a copy of the PHP documentation you need to get one. If you aren't sure how explode works, that will tell you.

You can only go through one row from the db at a time. After you process a criteria for a specific row, you should have the total for that criteria and the number of items. You could then add that to a global total for that criteria and a global count for the number of items for that Criteria. You do that for every criteria in every row. At the end, you will have two global counters for each criteria: the total amount and the total number of items. You divide one into the other and you have an average.

chrishea 182 Nearly a Posting Virtuoso

On line 21 you use a command returnMIMEType. I can't find any documentation on that so unless you have your own function with that name, I don't believe that it is valid. I get an error on that line when I tried your code. According to the documentation you can use a PECL extension (finfo_file) to get the MIME type but it didn't work for me (missing PECL?). When I changed line 21 to use image/png (because I tried it with a PNG file), it worked fine under IE8 and Chrome.

chrishea 182 Nearly a Posting Virtuoso

You might want to try a different version of IE (e.g. from a different machine) to see if the problem is consistent. There are bugs and limitations that occur only in specific versions of IE. It won't really be a solution if it works in a different version but it might help to find out what's wrong.

chrishea 182 Nearly a Posting Virtuoso

Your thinking is correct! If you have a field that is a comma-delimited string then explode it and that will create an array of the strings. Then just use a While loop to go through and add the fields together. As you go through them you'll also be counting how many so at the end you'll have the divisor as well.

chrishea 182 Nearly a Posting Virtuoso

Yes, I think it is too much to ask.

chrishea 182 Nearly a Posting Virtuoso

You need to debug the code to see why it is doing what it is doing. When I started in computers they filled a good size room and computer time was so valuable that you had to desk check your code for problems because there was no other option. I think that we are well past that. That is not to say that you shouldn't have a look for an obvious problem but if it isn't obvious then you can let the machine help you. If you are going to be a (PHP) programmer then you need to develop a debugging approach and you will probably want to get a debugging tool to help you. I built my own but there are open source debugging tools that you can get.

So back to your problem! For starters, you have a version of your form in both modules. The first thing that I would want to know (if I were you) is which module am I in when the screen "refreshes". It is re-displaying your form but which version is getting displayed. If you are in the Login module and it just keeps re-displaying the form when you click on the Submit button then your IF statement isn't working the way you expected. In that case, i'd want to see what the actual data value is. That can be as simple as echo'ing the value to see if it what you expected. You just keep narrowing it down until the …

chrishea 182 Nearly a Posting Virtuoso

Read the info from the db into a form where each item each has a checkbox. You will give each item a standard name plus an index number (i.e. name=aaaa$i). In the module that processes the form data, you process the items one at a time in a loop treating them as variable variables and then copying them to a standard variable name that the rest of the processing uses. You could add each of the chosen items to a string and when you're done, insert that string into an email that you send to him and to yourself. All of this is pretty straightforward PHP. If you haven't used variable variables you might find it a bit confusing but the actual code to do it is quite simple.

With respect to "pure PHP and MYSQL" the only considerations come in if the list of items is to be paginated because it is too long for one page; or, if you want to be able to limit him to 5 items as they are being chosen. In both cases, you might want some javascript but it could be handled in a less elegant way with PHP.

chrishea 182 Nearly a Posting Virtuoso

This is a class that makes it pretty easy to use PayPal with IPN:
PayPal Interface

If you try it an have any problem figuring out how to use it, let me know and I can give you a sample.

chrishea 182 Nearly a Posting Virtuoso

You can also add:

error_reporting (E_ALL);

Which is similar but a little different.

chrishea 182 Nearly a Posting Virtuoso

The session variables could only become the same if you are setting them from some common place / value (e.g. a single field set in a database).

chrishea 182 Nearly a Posting Virtuoso

if you have two <?PHP commands at the start as shown, get rid of one of them and see what you get.

chrishea 182 Nearly a Posting Virtuoso

Try one of these:
Wamp

EasyPHP

chrishea 182 Nearly a Posting Virtuoso

If I understand your question correctly, you might need something like:

if (condition A  AND condition B) {
  some action
}
elseif (condition A) {
  some other action
}
chrishea 182 Nearly a Posting Virtuoso

This should help:
http://www.astahost.com/info.php/create-online-timed-test-php_t11978.html

With a timeout as long as 20 minutes, you will need to set the maximum time that your program is allowed to run as you will exceed the normal system default for the system to time you out.

chrishea 182 Nearly a Posting Virtuoso

For starters, you have an error on line 25. You used $POST instead of $_POST. That probably explains the insert not working correctly but maybe not everything. Suggest that you fix that, run it again and see what errors are left.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

Suggest that you contact the author or try another facility to create the Excel file. It isn't very difficult to create an xls file. You can try my little utility Desktop Write if you want to experiment.

chrishea 182 Nearly a Posting Virtuoso

There have been problems with losing sessions after a redirect but some of them are specific to the browser and other variables in the environment. In most cases, the session is lost as a result of the redirect but you seem to be saying that it is working initially because the secure page is correctly printing their account name. You may need to put in some debug code and print the session id just to know where it is being lost.

A couple of the problems that others have had resulted from not closing the session before redirecting (session_write_close() ) or in going from a non-secure page to a secure page (making them both secure solved it). Again, since you say that the login page works the first time, neither of those possible problems would seem to affect you. If you land on the login page and immediately refresh and the session is then lost, that would be pretty strange. You didn't post any code but I would check that carefully before assuming that it is something else. If you aren't doing a session_start in every situation (for example) then that might explain your inconsistent results.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

You don't need an SMS gateway. Messages are sent as email messages.

chrishea 182 Nearly a Posting Virtuoso

I think that you need to populate the first list drop-down list (not check boxes) and then populate the second one based on what was chosen from the first one. Have a look at Google Translate for an example.

For an example (a similar but different application using JQuery), see Dynamic Dependent Dropdown

chrishea 182 Nearly a Posting Virtuoso

You need to create the program to send the mail (it needs all the details from your database or a file to know what to send to who and when) and you will need to trigger it (maybe on a daily basis if you are doing this regularly). Most servers have Cron installed to trigger timed events.

chrishea 182 Nearly a Posting Virtuoso

A simple Google search led to this item:
http://www.boutell.com/newfaq/creating/backbutton.html

Backspace and Back are different keys. You seem to be referring to the back button.

chrishea 182 Nearly a Posting Virtuoso

Here is a link to something a little bit fancier if that's what you want:
virtual pagination

chrishea 182 Nearly a Posting Virtuoso

First:
You need to put some debug code in (e.g. an echo) to see what is coming back from your confirm window. If it is what you expected, then obviously your code isn't handling the cancel response correctly.

Second:
If you are showing all the details for a range of users on a single page, then you will need to create the form using a loop and the names of the fields will have the format:
field1$i
where $i is your loop counter.
When the code that receives these fields processes them, it will have to treat them as variable variables (to avoid having to hard code every possibility). Thus, you will need to loop through the possible range of fields processing one row (one $i value) at a time. In each case, you will need to get the value of the fields into a standard set of field names and then do your processing:

$var = "field1".$i;                 
$field1 = $$var;

Third:
You can easily create a drop-down menu in PHP by using <Select> <option...> HTML statements as part of your form (drop-down menus). Unless you have an initial panel on entry to the Admin facility, this will require a refresh of the page in order to take effect. Obviously, in your code to display the user details in the output, you will need to have a loop that is controlled by whatever value is chosen (with a default). It would …

chrishea 182 Nearly a Posting Virtuoso

The synatax is incorrect. Try:
$subject = "CR - Orçamento ".$total[0];

chrishea 182 Nearly a Posting Virtuoso

Your email subject can contain a PHP variable so there is no problem inserting the contact # into the subject in your PHP program. After you read the current value of the counter from your database or file, you can increment it and write it back. If you save the value in a file, have a look at the flock command. You can use this to force the updating of the file to be serialized. You could have multiple users all trying to fill out the contact page at the same time so you need a way to deal with them one at a time when you are accessing and updating the counter. Mysql also allows you to implement locks and you can get some additional info here.

chrishea 182 Nearly a Posting Virtuoso

The message shows two different modules: view.php and constants.php. You have only shown code for one of them (presumably constants.php). You are probably doing an include for view.php and it appears that you are generating some kind of output from that module. Any kind of output prior to using a header statement will create an error. This can be as simple as a blank line. Anything at all will do it.

chrishea 182 Nearly a Posting Virtuoso

For mailing, there are open source classes that can do all the work for you.
Most people seem to like phpMailer
I generally use another one called Libmail

Normally, for this type of confirmation you generate a unique parm for the message. You need to save the post in your database pending the confirmation. You could save it in a pending table but it would probably be simpler to save it in the same table that you use for the ones that are posted, with a status showing that it is pending. The unique code would also be stored in the table and used as a key when the user does the confirmation. If your other site is picking up the postings from the database, then as soon as you change the status on a pending (confirmed) item, it should be added to the ones that are displayed.

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

If you want to run on a windows server and use Microsoft tools like SQL Server or Visual Studio ($799 and up) then this might be an OK solution. If you are aiming to write PHP applications that use MySQL and may run in Linux or Windows, then there are better solutions.

chrishea 182 Nearly a Posting Virtuoso

This utility will work without CRON and can be triggered by activity on your site instead. You can't depend on it to run at a specific time however unless your site gets regular traffic.

http://www.phpjobscheduler.co.uk/

I have another possible option for you and I will send you a PM for that.

chrishea 182 Nearly a Posting Virtuoso
diafol commented: Nice - I like it - most useful thing I've seen for a while +6
chrishea 182 Nearly a Posting Virtuoso

I think that you should try to create some code and if you have a problem making it work then post the code along with some info on what isn't working and what you have done to try to get it to work.

chrishea 182 Nearly a Posting Virtuoso

Almost any CMS will probably do since the content (especially tax calculations) will probably have to be custom built.

chrishea 182 Nearly a Posting Virtuoso

If your objective is to compare with every element in the array, I think you will need to loop through the array and create a series of OR conditions for the WHERE.

chrishea 182 Nearly a Posting Virtuoso

Get the current time as a timestamp [ $wk = strtotime("$my_date $my_time"); ]

Subtract your 5 minutes / 300 seconds from it [ $wk2 = $wk - 300; ].

Then you can do whatever you need to do with it:
e.g. display it: [ echo date("Y-m-d H:i:s",$wk2); ]

chrishea 182 Nearly a Posting Virtuoso

I take it that you want to dynamically create the personal pages. Even if you want the page to have a personalized name, the content can be standard. Then all you have to do is have the standard version and copy it to the new personalized name (php copy command). It can be passed a parameter for the name or extract it from the url.

chrishea 182 Nearly a Posting Virtuoso

If you are looking for something simple, this might do it:

function is_mobile(){
	$regex_match="/(nokia|iphone|android|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|";
	$regex_match.="htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|";
	$regex_match.="blackberry|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|";	
	$regex_match.="symbian|smartphone|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|";
	$regex_match.="jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220";
	$regex_match.=")/i";		
	return isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']) or preg_match($regex_match, strtolower($_SERVER['HTTP_USER_AGENT']));
}

This comes from:
http://mobiforge.com/developing/story/lightweight-device-detection-php

chrishea 182 Nearly a Posting Virtuoso

If the text is created in advance, why not convert it to PDF and let the adobe plug-in do the work? If the text is created dynamically you still have the option of creating a PDF from it (in PHP) and then display that.

If that doesn't do it for you, try a search on php pagination. You'll find some options available including this one:

http://www.catchmyfame.com/2007/07/28/finally-the-simple-pagination-class/

chrishea 182 Nearly a Posting Virtuoso

I had a further look at server2go and it is really just a version of Wamp that can be put anywhere. I doesn't look as if it does anything to obscure your PHP code and it does work through a browser just like Wamp.

mini PHP studio produces a standalone exe (for Windows). It doesn't use the browser. I tried to get some of the others like Roadsend to work but I wasn't successful.

chrishea 182 Nearly a Posting Virtuoso

In case server2go doesn't work out, here are a couple of others:

I managed to use mini-PHP Studio successfully in the past but it took some experimenting. This is probably PHP 4 only.
http://www.exvision.net/miniphp/

Never used this one. It doesn't support PHP 5.
http://www.bambalam.se/bamcompile/

chrishea 182 Nearly a Posting Virtuoso

This works in IE and maybe Opera but it probably won't work in other browsers:

<iframe src ='test_mht_arch_page.mht' width='100%' height='800'>
          <p>Your browser does not support iframes.</p>
     </iframe>

There are programs to extract html from an MHT so that's another option.

chrishea 182 Nearly a Posting Virtuoso

You will need to use javascript. have a look at the following item as a start:
http://www.webreference.com/programming/javascript/mk/column2/

There are some JQuery drag and drop plugins here:
http://plugins.jquery.com/project/Plugins/category/45

chrishea 182 Nearly a Posting Virtuoso
chrishea 182 Nearly a Posting Virtuoso

Have a look at the PHP mail command. If you do a search you can find libraries that support this and examples.

chrishea 182 Nearly a Posting Virtuoso

If I was going to take a screenshot,I would use the Print Screen or Snipping Tool facilities in Windows. I don't understand why you would want to do this in PHP. If you are running under Linux then I'm sure there are similar facilities available. It's a manual process of course, so it would be very time consuming to do thousands. Since you must run the html scripts to get to the appropriate pages, I don't see how this could be automated.

chrishea 182 Nearly a Posting Virtuoso

I'm not sure exactly what you are trying to accomplish but if you need to run a program on a timed basis, then you need to have a look at Cron. It's usually available on most servers.