chrishea 182 Nearly a Posting Virtuoso

You should be able to do this using an include. You can put an If ahead of the include and decide which module to include based upon your specific criteria.

chrishea 182 Nearly a Posting Virtuoso

If I can go back to the version 2 back before you changed it, you seemed to be on the right track. Assuming that dbform.php is the module that you have provided above, then it it going to call itself and redisplay the form so you might want to change that to only display the form the first time (you can check if re_pre or re_live has a value). You also have "selected" on every option statement. Normally, you would only put it on one or not use it all. On your option statement you also have value='$i'. Normally php doesn't substitute variables within single quotes but given that the whole statement is within double quotes, I'm not sure if it will or not. You can also use value=\"$i\".

Not sure if any of this will fix your problem but it will be a cleaner starting point. I would also put:
print_r ($_POST);
right after the <?PHP statement to show you what has been Posted and passed to the module.

You can try that and then see what you get.

chrishea 182 Nearly a Posting Virtuoso

Which is better for your needs, a van or a 4 door sedan? Without more info, the only real answer is "it all depends".

You don't need to choose because you can use both. Some things can only be done in Javascript but having that within a PHP context gives you the server side with a database and so forth. I have used JQuery within PHP programs and that works quite well and allows you to have the best of both worlds.

chrishea 182 Nearly a Posting Virtuoso

Where is $_POST["DB_Backup"] coming from (and what do you expect it to contain)? Your first module has a select statement but it doesn't have a form definition. To further complicate it, you are including that first module into the second one. If your first module had a form with the action being the second module, then you could reasonably expect that $_POST["DB_Backup"] would contain the value selected from the drop-down list and you could access that in the second module (which would no longer have the include). As it is, you have structured it incorrectly or you have a much better knowledge of shortcuts than I do but now you're caught in your own web.

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

There are two ways to do the .htaccess depending how php is set up:

For web servers using PHP as apache module:
AddType application/x-httpd-php .html .htm

For web servers running PHP as CGI:
AddHandler application/x-httpd-php .html .htm

The syntax is a bit different than what you had but the main thing is that only one of them will work depending on the setup. You can try both and see what works.

chrishea 182 Nearly a Posting Virtuoso

There are two ways to do the .htaccess depending how php is set up:

For web servers using PHP as apache module:
AddType application/x-httpd-php .html .htm

For web servers running PHP as CGI:
AddHandler application/x-httpd-php .html .htm

The syntax is a bit different than what you had but the main thing is that only one of them will work depending on the setup. You can try both and see what works.

chrishea 182 Nearly a Posting Virtuoso

This may be as good as it gets even though it is fairly basic:

http://www.phpclasses.org/package/388-PHP-Convert-any-document-that-can-be-read-by-MS-Word.html

It probably won't handle docx files.

chrishea 182 Nearly a Posting Virtuoso

I think you need an else on line 17 before you show him as logged in.

chrishea 182 Nearly a Posting Virtuoso

Matty,
The search that you saved has the parameters (e.g. search=Kim) as part of the string. If you want to start from scratch with a new search then the string should be:

http://bluelinedown.netau.net/new_test.php

Instead of:

http://bluelinedown.netau.net/new_test.php?search=Kim&body=on&title=on&desc=on&matchall=on&submit=Search

chrishea 182 Nearly a Posting Virtuoso

I haven't found a way to open a Word doc from your program and consistently retain all of the formatting:

You can open PDF, Powerpoint and TIFF files using an embedded Google Docs Viewer

There are a number of ways to open spreadsheet files.

There are a couple of utilities that will extract text from your Word document but this isn't that same as a reader to display the original document.

chrishea 182 Nearly a Posting Virtuoso

I haven't used it myself, but Uniform Server is promoted as a LAMP stack that you can use for a production server.

chrishea 182 Nearly a Posting Virtuoso

I looked at this site and I don't see any working drop-down menus.

I'm not prepared to spend the time doing the debugging that you need to do. Maybe someone else is but that may be why you don't have any responses yet. If you at least showed what was working and then specifically what you changed, there might be a chance that someone would spot something wrong in the changes.

chrishea 182 Nearly a Posting Virtuoso

You can't echo an array, it isn't that smart. If you want to dump it, you can use print_r. If you want to do your own formatted display then you need to spin through the array pulling out the values and displaying them or referencing them individually (e.g. $_SESSION[0] )

chrishea 182 Nearly a Posting Virtuoso

They are big enough that they probably have their own gateway. The gateways are probably done by an internet link to one of the cell providers and they probably do the rest. On a small scale, you might be able to do it through a phone but on a large scale that wouldn't be practical.

chrishea 182 Nearly a Posting Virtuoso

It sounds as if you are using a system that has it's own login and timeout processing. This is specific to the system that you are using (e.g. a Forum or a CMS) and even though it may be using PHP session management as part of the timeout processing, that probably isn't what you need to change. You have provided a very vague explanation of your problem. No one will be able to help you unless you provide more details. If you are using a package of some sort, then you may get a quicker answer from a forum that is specific to that system.

chrishea 182 Nearly a Posting Virtuoso

I don't believe that you will be able to do this without signing up with an SMS Gateway service who will do it for you (at a cost). You might be able to hook up your PC to a cell phone and have the cell phone act as your gateway but I don't know for sure that you can do this (or how).

I'd like to believe that there is an intended level of secrecy around this to avoid spam sms messages being sent too easily. There are probably financial reasons as well.

chrishea 182 Nearly a Posting Virtuoso

I think that you will need to read the file and see if you get anything.

chrishea 182 Nearly a Posting Virtuoso

If you want a variable to be available in multiple modules, then save it as a SESSION variable and then it will be available everywhere as long as the session is active.

chrishea 182 Nearly a Posting Virtuoso

On line 4 the = should be ==

chrishea 182 Nearly a Posting Virtuoso

strtotime is pretty good at turning english into a date. Here's an example:

<?PHP
     $ts = strtotime (" next month Dec 2010 ");
     $text = date ("F",$ts);
     echo $text;
?>
chrishea 182 Nearly a Posting Virtuoso

Assuming that "automatically" means doing a query to write it to another table, then the answer is yes. Do a MySQL Insert or Update into the appropriate table.

ceeandcee commented: Thank you! +1
chrishea 182 Nearly a Posting Virtuoso

I suspect that it isn't taking anything like 10 seconds to execute the functions that you didn't show. That's a long time on a fast machine. Put a sleep command in just after all the code that you didn't show and I'll bet that you'll see a difference in the two values. The time until it displays might be quite long because of network transmission time or the time it takes the browser to deal with it but it may not be anywhere near that amount of time on the server. If you want to see how much time it is actually taking use / display the microtime before and after.

chrishea 182 Nearly a Posting Virtuoso

If it is simpler (less code) then it is probably better. If you need to do the same thing multiple time using different parameters then a function would seem to be the way to go. Unless there is a lot of complex / extra code in the function to make sense of the input parameters and what you need to do with them (versus customized modules for each type of parm), then it won't have any performance impact.

chrishea 182 Nearly a Posting Virtuoso

You will need to convert to a time stamp and then convert back to what you need. First, create an arbitrary date using the month that was passed (e.g "2010-".$m."-01"). Use strtotime to convert it to a time stamp and then use Date to get the full text month.

chrishea 182 Nearly a Posting Virtuoso

strtotime("$date $time");

should work fine. Make sure that you use double quotes, not single.

chrishea 182 Nearly a Posting Virtuoso

$time_calc = date("H:i",$your_timestamp);

chrishea 182 Nearly a Posting Virtuoso

You may want to consider putting the directory for the downloads outside the web root on your server. That way, it can only be accessed through a program and that program can check the login info to see if the user has the authority to do it. You can do a search and get more info (I provided one link below). There are some considerations so do a bit of research.

http://www.bigresource.com/Tracker/Track-php-mKbF05IC/

chrishea 182 Nearly a Posting Virtuoso

These are all free.

chrishea 182 Nearly a Posting Virtuoso

PHP is an interpreter not a compiler and I presume that what you want is an environment where you can develop PHP code and run it. There are some programs that can use PHP code and actually compile it into a Windows or Linux executeable file but I don't think that is what you want.

In order to use PHP (and MySQL) you need a LAMP "stack" (Linux, Apache, MySQL and PHP). There are packages that put all of this together for you and make it easy:

* EasyPHP (the one that I have been using for years)

* Wamp Server

* XAMPP

Any one of those can do the job.

chrishea 182 Nearly a Posting Virtuoso

You are better off not using short tags (<?) but if you need to have them working then you will need to edit your php.ini file (in your Wampserver environment). Find the line that says:
short_open_tag=off and change it to
short_open_tag=on

then save php.ini

chrishea 182 Nearly a Posting Virtuoso

First thing: your statement Please solve it ASAP is not an appropriate way to state a request for help. No one here is under any obligation to help you, immediately or otherwise. If your first language isn't english, then it may just be an inappropriate use of the language so in that case take it as a free tip.

I don't think that there is anything wrong with your code. You could get this result however; if your module isn't defined as a php module (ie it must be called xxxx.php not xxxx.txt or xxxx.htm). When you execute it in your browser, you must have the module in your server's "document" library (e.g. the www directory or htdocs or whatever wamp server uses) and you must execute it from the "localhost" domain (e.g. http://localhost/yourdir/yourmodule.php).

If you are doing all those things then it should interpret the php module and act on the echo statement.

chrishea 182 Nearly a Posting Virtuoso

It may be because it has the previous code cached (the generated html). If you reload / refresh the page, that usually clears it. If that doesn't do it, you may need to close and re-open your browser. Sometimes it is something stupid like saving the modified code somewhere other than where you are actually executing it from. Having been through this before, these probably explain 99% of these situations. If that doesn't do it, then you have to look at the code itself and see if that is the cause (I didn't go through the code above).

chrishea 182 Nearly a Posting Virtuoso

Try enclosing line 6 in single quotes rather than double. Your line would then look something like:

$hc1 = ' <?php $site_status = \'';

Single quotes tell PHP not to interpret what is between the quotes whereas it does try to interpret what is between double quotes (finding $site_status to be an empty value in your case).

natchattack commented: Very helpful +3
chrishea 182 Nearly a Posting Virtuoso

This would be a better way to do it. It would need to become part of the setup for the CMS (a local ini file) or you may be able to use ini_set. ini_set can only disable certain functions (not fopen for example) so you may need to go the other way.

http://www.cyberciti.biz/faq/linux-unix-apache-lighttpd-phpini-disable-functions/

http://www.php.net/manual/en/ini.list.php

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

I don't know how Facebook is doing it but a couple of options come to mind:

1. Instead of having a unique page address, have the number as a parameter in the url and use that in a database select to identify the user and get the db info.

2. Have a custom 404 (page not found) page. The page won't really exist so you will get a 404 error when the click the link. If you intercept the error you can then store the last part of the link (that is actually the parm) and then re-direct to wherever module that you have to process it.

chrishea 182 Nearly a Posting Virtuoso

You need to work in seconds and you need the timestamp for the starting time.

1. Use strtotime to convert a string to a timestamp (format the input string in a obvious format like yyyy-mm-dd hh:mm if you can).

2. Once you have this converted, then convert your duration hours and minutes to seconds.

3. Add the duration seconds to the timstamp.

4. Convert the resulting end timestamp back to a display format using the date command ( e.g. date ("Y-m-d h:i",$end_timestamp).

chrishea 182 Nearly a Posting Virtuoso

You don't have a true gateway you have an SMS application. As you know, you can send an outbound SMS message as long as you know the number and the provider. Inbound SMS isn't provided by the Cell phone providers to the public. A gateway will handle both inbound and outbound traffic for you but it isn't free. An example is Clickatell.. You can do a search and find others. If you were looking for something for free, it's probably possible to use Twitter as a gateway but it would take a bit of research and your users would probably have to be signed up with Twitter for it to work.

chrishea 182 Nearly a Posting Virtuoso
echo "<a href=".$row['reviewlink'].">Click Here</a>";
chrishea 182 Nearly a Posting Virtuoso

$_SERVER will give you the root address.

chrishea 182 Nearly a Posting Virtuoso

Not unless you provide more info. Clarify the problem and show us the code.

chrishea 182 Nearly a Posting Virtuoso

I suggest that you use an IDE (such as Netbeans) that will identify errors for you before you even try to execute the program.

PHP doesn't like this sort of array reference embedded the way you have done it. You have the same thing on line 23 as on line 7. There are a couple of ways that you can resolve it:

1. Set a variable equal to $_post and use that variable in the Select statement.
2. Force PHP to evaluate the array variable by enclosing it in braces:

$query = "SELECT * from transaction_table WHERE tran_ID={$_POST['tran_ID']}";
chrishea 182 Nearly a Posting Virtuoso

It seems that you need to check if you have any data before you add another line break. If you currently output the line break before you output the fields, you need to create the output line as a variable and then check the length to determine if it has any data.

chrishea 182 Nearly a Posting Virtuoso

Your initial statement / request is almost as unrealistic as:
"I am a PHP programmer. I need to build a bridge. I don't have the time to learn all about civil engineering. Just tell me the most common design approaches for building a bridge so I can get on with it."

There is no list because it depends on what you are doing. If you have programming experience in another language, then you may know conceptually how to accomplish what you need to do but you still need to turn that into working PHP. If you don't have much programming experience, then you can't take a PHP cookbook, put together a program and expect that it will work (or that you will know enough to be able to debug it).

If you need to put together a site, I strongly suggest that you use a Content Management System rather than build it from scratch. Even if you are experienced in PHP, HTML, CSS and Javascript, it makes no sense to do it from scratch unless you have a requirement that can't be satisfied with a CMS.

chrishea 182 Nearly a Posting Virtuoso

If they are significantly cheaper, they may be pirated. They could also be OEM versions that are supposed to be sold with a PC (but you should be able to register it).

There are a lot of free equivalents out there (e.g. Open Office, Lotus Symphony, Google Docs, Zoho Office etc.) but if you really need MS Office, then check with the seller that it is a legal version that can be registered and check that they have a strong rating (i.e. you can hopefully believe them). I saw a sealed copy of MS Office 2007 on EBAY for $199US and that is pretty good compared to the price at the Microsoft store for Office 2010 (about $650).

chrishea 182 Nearly a Posting Virtuoso

If you want to use PDF then HTML2PDf is a good option. In fact any time that you want formatted paginated output, it is worth considering. Here is small example of defining pages (with the optional headers and footers) as input to HTML2PDF:

<page style="font-size: 14px">
     test0
     <br>
     Here is some test text
     <br>
    <!-- This kind of page break doesn't work
     <p style="page-break-before: always">
     Here is page 2 maybe
     </p>
     -->

     The end of page 1
</page>

<page backtop="7mm" backbottom="7mm" backleft="10mm" backright="10mm" style="font-size:12px">
    <page_header>
          <b><div style="font-size:10px; color:silver;">Here is the page header</div></b>
    </page_header>

     Here is page 2
     can I do another page this way?
     <br>Yes I can
    <page_footer>
          <b><i><div style="font-size:10px; color:silver;">This is the page footer</div></i></b>
    </page_footer>
</page>

<page pageset="old">
     Now here is page 3
</page>

Each <page> command initiates a new page. There are a number of optional parameters that you can use. The pageset="old" picks up the parms from the previous page. One thing to note is that it is very particular about getting correct html. If you miss closing tags and that sort of thing it won't work. Thus, you can't just throw any html at it and expect it to work. You may need to do a little tweaking. I have been using the older version quite successfully for some time now and this one is even better.

I have some stuff on my website for the older version. I have to do an update for this newer version because it is a significant …

chrishea 182 Nearly a Posting Virtuoso

I ran a little test program from my (virtual) linux server. I ran it from IE, Firefox, Opera and Chrome. It checks the filesize for another program in the same directory. It gave exactly the same (correct) result in every case. You must have a problem or limitation in your server environment or something wrong in the program or a problem in one or more browsers (try another version?). The program that I used was:

<?PHP
/*
     Test filesize (change the module name to check to something in the same directory)
*/

     $size = filesize ("div_by_zero.php");     
     echo "<br>div_by_zero.php reported as size=$size ";    
?>

If you run this and you don't get a value at all then something strange is happening on the server. If you don't get a value (or it is inconsistent) in different browsers then there could be a problem with the version of one or more browsers that you are using.

chrishea 182 Nearly a Posting Virtuoso

If you create the output as a Word file, you can tell it where you want the page breaks. I don't have the details handy but if you want to go that way I can dig up some details (I have done it but I would need to dig through a program to remember how).