chrishea 182 Nearly a Posting Virtuoso

It wasn't clear from your initial post that you want to do this like FEDEX. If all of the transactions will be face-to-face and if you plan to use a phone with a touchscreen, then I guess that your original solution might work. You would need to find a web-based paint program interface that will work with a touchscreen. You also need to consider what to do if the internet connection is down. For parcel services, I would bet that their handheld device has a local program and that it doesn't depend on a wireless connection. I would be inclined to go low-tech and print the receipt in advance.

chrishea 182 Nearly a Posting Virtuoso

For online signatures, you normally click a button that is associated with some text that explains your legal obligation once you click the button. Since PC's don't have signature pads, how do you expect a signature of this sort to be entered. If you have ever tried freehand with a mouse you know that the result isn't something that you'd want to put any legal weight on. Just do what everyone else does. Don't know why you classify it as a "problem".

chrishea 182 Nearly a Posting Virtuoso

Please restate the key issue. This statement says the same thing twice:
" If the IP isn't existing, the system will add the IP but if the IP doesn't exist he also adds the IP."

chrishea 182 Nearly a Posting Virtuoso

Your variables will all be part of the $_POST array in the receiving program. Thus, your job is to loop through the array determining if each successive variable exists and then doing whatever processing you need to do.

In general, PHP accepts $_POST[name1] or $_POST as the same thing. I believe that the official version has the quotes but they both work most of the time.

In this case, we need to create the name of the array element. You could do that by:

$element = "name".$i;
while (isset($_POST['$element'])) {
  ...
 
   // - or - 
while (isset($_POST["name".$i])) {

   // - or - 
while (isset($_POST[name$i])) {

They should all give the same result.

Once you know that the element exists (and you know what the name is) then you can do whatever you want with that variable. If you are storing the info in a database, then that code will be within your While loop.

chrishea 182 Nearly a Posting Virtuoso

On line 7 you are using = instead of == but the problem is more than that. You can't compare a field to an array. You need to check against a specific element of the array, something like the following:

if ($username == $array['username']) {
     ...
chrishea 182 Nearly a Posting Virtuoso

You can create predictable field names using a subscript in PHP quite easily (e.g. name=aaa$i) if you know how many you need. If you are creating them on the fly, then javascript is obviously the way to go.

You can use a while loop with an index value to see if a variable exists:

$i = 1;

while (isset($_POST[aaa$i])) {
   ... process the variable ...
   $i++;
}
chrishea 182 Nearly a Posting Virtuoso

If the value contains blanks then you lose whatever is after the blank. Try this:

echo "<option id=".$rowComp['id']." value=\"".($rowComp['name'])."\">".($rowComp['name'])."</option>";
chrishea 182 Nearly a Posting Virtuoso

Make sure the value is in quotes if it contains a blank.

chrishea 182 Nearly a Posting Virtuoso

I'm not giving you a legal opinion so if you feel that you need one, then go for it. I looked into this a while back because I am using some GPL code in a number of systems that I built. These systems are not open-source and they are not sold or distributed. I use them as an online service. I did not get a legal opinion, I just did some research on the Internet. What I found was that using GPL code in a system that isn't distributed / sold is ok and does not require you to release all of the source and does not limit you from using the GPL code. Apparently, some people consider this to be a loophole in GPL. There are versions of the GPL that do address this "loophole" so you need to look at the specific license for the software that you plan to use to see if it has the additional provision for ASP (Application Service Provider) systems or not. You can use the link below to get a bit of background on that:

http://en.wikipedia.org/wiki/Affero_General_Public_License

JQuery is dual licensed under the GPL and MIT licenses. From what I can see, it uses the original GPL license and that addresses "distribution" not online use as an ASP. I strongly suggest that you read the licenses referenced by JQuery for yourself. Remember that each plugin is also licensed so you will need to look at those as well. You …

chrishea 182 Nearly a Posting Virtuoso

As a general rule, you can use open-source code under one of these licenses within a website without any issue. This applies even if you are charging to implement it or charging to use the site. The license only becomes an issue if you develop a program that you wish to sell that includes / uses code that is available under one of these licenses. Then you have to check the wording more carefully.

chrishea 182 Nearly a Posting Virtuoso

Your statement of the problem isn't clear in terms of why it is a problem. If you have all of the countries in an array and you get a country as input (from a form?) then there should be no problem comparing the two and determining if it is in the list or not. You could use a while loop to go through the array and compare your country from the input to every country in the array. Your statement "...there literally seems to be no way of doing this in PHP." makes no sense unless there is something important missing from the definition of the problem.

chrishea 182 Nearly a Posting Virtuoso

It's moving in the right direction however; I think that it is still too subtle. The tiny font makes it too easy to ignore. I'd also include a search box for at least Daniweb right in the instructions. It seems that a lot of people don't know how to create good search terms either. I"d be inclined to at least provide some help on how to search effectively. Helping them to create a search term with 3 - 5 search boxes, one for each term in declining order of importance might help too.

chrishea 182 Nearly a Posting Virtuoso

If I were in your position, I'd probably start with a very short piece of code that demonstrates the problem and prove that it works on a local test system. Move it to your server and try it again. If it doesn't work there, I would immediately go to your web host and get their help. Maybe they installed a new version of PHP or did something in the config that is creating a problem. Obviously, if your demo code works on your server, then you have some sort of problem that is specific to the web site.

Until it is resolved, I'd probably take the web site offline rather than take the risk.

chrishea 182 Nearly a Posting Virtuoso

I support the previous posts about trying to get people to use [code] tags. I have three more that I'd like to see:

1. When someone tries to add on to an old post (e.g. more than a year old), force them to open a new topic. If it was really slick, it could automatically add a reference link to the old post.

2. Add an FAQ section / pinned topic for (at least) the most used sections of the site. There are many questions that keep coming back over and over again (especially from newbies) and its a waste of time and space to keep answering them as one-of topics. With a well-written FAQ section, the experienced posters who are answering questions could be encouraged to provide a reference / link to the FAQ rather than start over again. My New Years resolution was to produce my own FAQ for PHP / MySQL and I now reference it in my signature (as you will see below) and I now try to use it in my response to these recurring questions. Having a standard FAQ would be a major step beyond that.

3. A lot of people don't know how to ask questions properly and they don't provide enough supporting information. They also don't check existing sources on Daniweb or the web before asking their question. I'd like to see a questionnaire that would lead people through asking their question. It wouldn't have to be long or …

chrishea 182 Nearly a Posting Virtuoso

You need to use code tags so your code is properly formatted.

For this error see [URL="http://innovationsdesign.net/wb_2.7/pages/tech-resources/php-help.php#question_18"]this. [/URL]

chrishea 182 Nearly a Posting Virtuoso

I would have replaced line 273-279 with:

if (isset($_GET['redirect'])) {
     $wk = "?redirect=" . $_GET['redirect'];
}
else {
     $wk = ""
}
?>
 
<h1>Sign In to your account </h1>
 
<form action="login.php<php echo $wk; ?>" method="post"
id="frmcontact">

I am sure that there are those who will say that this isn't as efficient as your version and doesn't take full advantage of what PHP can do but I value my time more than machine cycles so I'd rather keep it simple and obvious. To each his own however; it's partly a matter of style and partly what you're used to and what makes you happy.

chrishea 182 Nearly a Posting Virtuoso

I didn't do anything that you couldn't have done which is to go through methodically, organize the indents and check that all of the curly braces are matched (Netbeans should help you to do that part). I had to add three more closing curly braces after line 272 to get them to match up. There was another problem with the form at line 277 but it's gone away and I don't know what I did that fixed it. My version of your code now shows no errors.

Maybe you are used to this style of coding but if you are having trouble debugging it yourself then maybe you are making it more complex than it needs to be. PHP let's you do things like you have done with the form action at line 277 (as an example) but personally, I'd make it simpler and not try to embed logic like this in order to derive a variable. It's up to you but personally, I'd rather keep it simple and straightforward because it will probably save time when there is a need to debug it. Just my opinion.

http://innovationsdesign.net/wb_2.7/pages/tech-resources/php-help.php#question_17

phplover commented: Solved my problem. Some nice advice :) +1
chrishea 182 Nearly a Posting Virtuoso

See MySQL_Insert_ID

chrishea 182 Nearly a Posting Virtuoso

You could use something like this:

<a href="delete.php" onclick="return confirm('Are you sure you want to delete?')">Delete</a>
chrishea 182 Nearly a Posting Virtuoso

Are you saying that you want to abandon the results of the Selects that were done on the first pass and now start over with another database (in the same format as the first) and keep executing your while loops using data from the second database? That would be a pretty unusual approach. If that isn't what you mean, then you need to explain what you're aiming to do with the second database.

chrishea 182 Nearly a Posting Virtuoso

As per the PHP documentation (you do have a copy don't you!):

Return Values
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.

You need to use this resource id in a mysql_fetch_array or mysql_fetch_assoc to return an array of rows and fields (in your case just one row and one field). You can also use mysql_result to return just one field from a specified row in the result.

chrishea 182 Nearly a Posting Virtuoso

This is all in the PHP manual. If you don't have a copy, you need to get one:

If you just wanted the time in 24 hour format, it could be as simple as:

$time1 = date("Hi");

If you need to use strftime for local time, then it would be:

$time1 = strftime("%H%M");
chrishea 182 Nearly a Posting Virtuoso

You don't need to be constantly looking at the DB and updating the status of the users. You wait until he tries to login again. If the suspended period is over, then you change the DB and take out the date & time when the suspension ends (indicating no suspension). If the suspension isn't over yet, you just refuse his login with an appropriate message.

chrishea 182 Nearly a Posting Virtuoso

I looked at RainTPL and pretty quickly I got it. I played with it and tried a few things and they worked. It will take some more time to get any good with it but it doesn't seem difficult or intimidating. I have one application where I think it might be beneficial but I'm not sure if the retrofit effort would be worth it.

Previously, I tried to understand Smarty and I never got there. With more time I probably would but I didn't have a compelling need so I didn't pursue it. Just had a quick look at XSL/XSLT and it seems a bit like the Smarty situation. With some time I can probably figure it out but I'm not really sure that it's worth it (and still no compelling reason).

Thus, for potential occasional use, I think that RainTPL is the winner based strictly on simplicity. If I was to use a template system for every new project then there might be more capabilities in XSL or Smarty that would make one of them a better choice. I understand that there is some theoretical benefit in separating the view part from the logic and variables but I'm not sure if there is a real payback to make it worthwhile. Any thoughts on (real) benefits?

chrishea 182 Nearly a Posting Virtuoso

On the third try (that fails), save the date / time / timestamp when he gets re-activated into the DB. Always check this field when someone tries to login. If the time is still in the future, then reject the login. If there is one and the time has passed, then make sure that you clear that database field.

As a comment, this is a pretty severe lock out. In most cases, this type of temporary suspension is for 15 - 30 minutes. It is sometimes done using a session value so if you close your browser and start it up again (or use another one) you can get back in. It isn't all that difficult to screw it up 3 times in a row (confusion on the PW not just mis-keying).

chrishea 182 Nearly a Posting Virtuoso

You need a form field to create a POST variable. <input type=... >

http://innovationsdesign.net/wb_2.7/pages/tech-resources/php-help.php#question_8

chrishea 182 Nearly a Posting Virtuoso

I spent a bit of time with RainTPL the last time that Ardav mentioned it in a post and I agree that it is pretty simple and straightforward. I would certainly consider it for something new. Retrofitting it would need some meaningful payback to make it worthwhile.

chrishea 182 Nearly a Posting Virtuoso

Presumably, the previous insert failed. Your problem is likely with the insert itself not with this piece of code.

chrishea 182 Nearly a Posting Virtuoso

Mysql returns an array with the individual database fields/columns as elements of the array. If you don't have a copy of the PHP user manual, then you need it. You can get one here.

Once you have the birth date from the database, then you can turn it into a time stamp using strtotime and then extract what you need using date.

chrishea 182 Nearly a Posting Virtuoso

I am using AVG with Win 7 64-bit Home Premium on an ASUS laptop (2100mhz dual core). I've been running it for almost a year on this system and I haven't had any obvious problems. The system starts a bit slow compared to what it was at the start but I have a lot of stuff on here so I can't specifically point a finger at AVG. Besides Ultimate vs Home Premium there might be something else different that results in mine working and yours not. AVG still does the job for me.

chrishea 182 Nearly a Posting Virtuoso

In the program that processes the form you will still see them as individual fields. When you have an unknown number of fields, the best way to handle it is to have a standard field name followed by an index number (as you are doing). In the receiving program, you can check if the variables exist and then concatenate them before you save them to the database. In this example, I separated the values with commas. That would allow you to explode them to process them as individual fields later. You should do some editing on the incoming fields before you save them. if you use a separator, you'll need to check that it isn't in any of the strings.

$features = "";
$i = 1;

while (isset($_POST[feature$i])) {
      $features .=  $_POST[features$i].","; 
      $i++;
}
epicrevolt commented: Solved my problem, I love you :) +1
chrishea 182 Nearly a Posting Virtuoso

You can't have any output before you use the header.

http://lmgtfy.com/?q=php+headers+already+sent+daniweb

chrishea 182 Nearly a Posting Virtuoso

$_POST is needed when the original form has method=post (which in this case it does). If the form has method=get, then you would need $_GET.

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

Wow, quite a pile of code. We can't see what is in the files that you are reading in. That could be a source of a problem or not (but probably not at this point). It seems that on line 67 it should have been $var_Ulist = ...

On line 109 you should probably dump the arrays (print_r) and the two variables (with an echo) so you can verify that the data is what you think it is.

Your Else If statements at 120, 127 and so forth will never be executed / true. If the statement at line 113 is true, then the statements immediately following the IF will be executed and it will ignore the else if's. On the other hand, if the IF statement at line 113 is false, then all of the Else If statements will also be false because they have the same condition as the initial IF.

chrishea 182 Nearly a Posting Virtuoso

You can't remove it but you should mark it as solved and add any final notes that may make it useful to someone else who has a similar problem. Old posts are there as a reference and can be searched before posting something as a "new" problem.

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

It sounds as if you are trying to install each one individually. There are a number of packages that install everything for you. Xampp, Wamp, Uniform Server, EasyPHP. Probably easier to start over using one of these.

chrishea 182 Nearly a Posting Virtuoso

If you don't already have a copy of the PHP manual please download a copy and consult it first when you have an issue (as I do).

chrishea 182 Nearly a Posting Virtuoso

This is the standard php email statement but there will have to be more to your script than just this. At a minimum, the variables used in the mail statement need to be set to the required values. With respect to 'safety' have a look at the link below:
http://www.w3schools.com/php/php_secure_mail.asp

chrishea 182 Nearly a Posting Virtuoso

There could be a more sophisticated way to check this but a simple way would be to set some session variables in the receiving module equal to your post variables (first time thru). On each call you check the session variables against the $_POST variables and if they are the same, you take no action and optionally issue a warning message.

chrishea 182 Nearly a Posting Virtuoso

You can't have a where clause in an Insert statement. See the format here.

chrishea 182 Nearly a Posting Virtuoso

Usually this means that you don't have the variable in quotes in the form so it only picks up the text up to the first space.

chrishea 182 Nearly a Posting Virtuoso

In the SQL statement, it is treating $sql as a column because it isn't enclosed in single quotes. Add the single quotes and it should work.

chrishea 182 Nearly a Posting Virtuoso

If you are looking for help, you need to tell us / show us what you have already done to try to find /develop the solution.

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

Just select the record from your DB. If no records found then it doesn't exist. Your checkh will be something like

$resource = mysql_query (select * from ... where username like '$username');
 $num_rows = mysql_num_rows ($resource)
 if ($num_rows == 0) {
   // user record doesn't exist
 }
 else {
   // user record exists
 }
chrishea 182 Nearly a Posting Virtuoso

try a print_r for $_POST at line 19 to confirm what is being posted.

chrishea 182 Nearly a Posting Virtuoso

What is your reason for saving everything to one row? It would be simpler to save each one as a separate record. Then, the counting and checking for duplicates is quite straightforward. If you append everything to one record, then you have to read that record every time, break up the content and check against each one in the program. You will be using the database like a flat file and losing out on its capabilities.