jblacdao 2 Light Poster

Try putting a value for the $subject variable you are passing to the mail function. It's all that I can think of right now.

jblacdao 2 Light Poster

HI jb

thanks it worked! I appreciate you taking the time and pointing out my mistakes. Even if I had the syntax correct, I knew I was leaving out something in my overtime.

regards

wavyaquaeyes

no problem, it was my pleasure helping you out :cheesy: don't hesitate to ask help if you need it, I'm always open for it ;)

jblacdao 2 Light Poster

From what I know, I don't think that php will work without a browser. But, you can use it to build a desktop-type applications just that your interface with the system is via browsers and that you need to setup the host locally. Besides, why not use c/c++ if you're only developing desktop applications. Although, php can be used to develop intranet or LAN applications.

jblacdao 2 Light Poster

Non of this has helped i still have the same problem and on top of that it doesn't send to the gesignated email address.

Regards
Ashjenius

There's an error in one line:

$msg = "Email address of sender: stripslashes($_POST['Email'])";

keep in mind that using when using functions together with strings you have to append it instead of just including it in the string itself as shown above. It should be:

$msg = "Email address of sender: ". stripslashes($_POST['Email']);

And you might wanna change the $recipient to a valid email address because that may be the reason why your mail send keeps failing

jblacdao 2 Light Poster

I've checked ur code and you seem to lack a lot of ";" at the end of your statements and the reason that the value of $payCheck is not displayed is because:

1) $_REQUEST["payCheck"] is empty
2) Your computation is not really a computation but a string that shows how the computation is done
3) Also when computing, the result is assigned as if it was assigning a value to a variable. it should be $z = $x * $y, not $x * $y = $z.
3) You're trying to printout the value of $paycheck when in fact it should be $payCheck, remember php variables are case sensitive

To solve your problem here's what you need to do:

1) correct your computation statement and assign the result to $paycheck
2) do not represent your computation as a string and don't enclose your strings in "(" and ")"
3) assign the result to a variable and output that variable in your echo statement

Other things to do:

1) remove these lines because the request data you are trying to get are never set therefore they are useless

$pay = $_REQUEST["pay"]
$payCheck = $_REQUEST["payCheck"]

2) The logic for your computation with overtime pay is kind of odd because you only compute for the overtimed hours when in fact it should be added to the wage for the normal hours worked.

Instead of "$z = $x - 40 * $y * 1.5", …

mbacon commented: Very helpful and specific. +1
jblacdao 2 Light Poster

Refer to my next post, I accidentally submitted my reply twice. Sorry

jblacdao 2 Light Poster

Excellent, thank you very much it did the trick, the data is being sent to the form now. Any idea how to fix the final part? It isn't updating where the when submit is being clicked, I assume this is a fault of the query?
Thanks alot.

Yep, that's easy as well =). The $id in the code block where you execute the update is empty. The reason for that is illustrated here:

if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit") 
   { 
   if (!isset($_POST["submit"])) 
   { 
   $id = (int)$_GET['id']; <--- $id variable assignment statement when form is not submitted
   .
   .
   .
   }
   if ($_POST["submit"]) 
   { 
   $Tom = $_POST["Tom"]; 
   $sql = "UPDATE test4 SET Tom='$Tom' WHERE id='$id'"; <---- $id is not assigned a value because the previous if statement evaluates to false
      $result = mysql_query($sql); 
      echo "Success!"; 
   } 
   }

Based from the logic of your code when you update the record the id value is submitted via post so just assign the value of $id. Just add this line before your update statement

$id = $_POST['id'];

Let me know if it still doesn't work. Cheers :cheesy:

jblacdao 2 Light Poster

Hi joe,

There isn't any problem at all because PHP really outputs series of spaces as just one. I suggest that you either configure the script that inserts the records in the database to automatically converts series of spaces to just one or explode your string to an array such that 1 character string = 1 array element and out each element separately. Hope this helps.

jblacdao 2 Light Poster

Hi Tom, its me again. It seems that you over fetched your query result. You can modifying this part of your code

$result = mysql_fetch_array($sql); 
$myrow = @mysql_fetch_array($result);

to this:

if (mysql_num_rows($sql) > 0)
 $myrow = @mysql_fetch_array($sql);

The reason you were getting an empty result is because the second line in your original code you were trying to fetch a record from an array instead of the resource that you get by executing the mysql_query command.

jblacdao 2 Light Poster

I read the code you uploaded and I don't see any difference from the one that is working. Maybe there are files that you haven't copied to the new server that the old one has and is needed for the links to work. I really can't say what the problem is because the only php code in index.php is the part where the content is included. Try checking the files that are being included in that part of the code and maybe you will see the problem

jblacdao 2 Light Poster

Maybe your problem is not with that script but with replaceObjEmbed.php. Try checking it, maybe that's where the problem is.

jblacdao 2 Light Poster

Can you give us a screenshot of how they look like after you have included it in you PHP? and if possible a snippet of the code where you inserted the sidebar and headers.

jblacdao 2 Light Poster

Hi, can you post a screenshot of what happens when you click on one of the links that don't work? so we could have a better understanding of what could be the problem.

jblacdao 2 Light Poster

Try taking out the extra "," at the last element of your $working_time array

7=>array(11,12,13,14,21,22,23,0,1), <--
jblacdao 2 Light Poster

Well, if you had explained it earlier, I would have replied differently. The answer you're looking for is easy, you can use this piece of code:

$num_rows = 3; // number of rows u want to generate 
for($cur_row = 1; $cur <= $num_rows; $cur_row++)
{
   $random = array(); // array of random values
   while(count($random) < 6) // check whether you have the number of values needed
   {
      $value = rand(6, 49);
      // I assume you need unique values
      if(array_search($value, $random) === FALSE) // value is not yet in array
      {
         // add value to array
         $random[] = $value;
      }
   }
 
   foreach($random as $index => $value)
   {
      print $value;
      if ($index < (count($random) - 1)) // check if its not the last element
         print " "; // print a space
      else print "\n"; // last element, new line
   }
}
jblacdao 2 Light Poster

Aight! if it helps you can also put in "LIMIT 1" at the end of the query so the statement will only delete up to 1 record. Good luck!

jblacdao 2 Light Poster

PHP already has a built in function that randomizes a number given the minimum and the maximum.

$random = rand(6, 49);

Here's the link to the manual that describes the function in case you encounter problems http://www.php.net/manual/en/function.rand.php

jblacdao 2 Light Poster

Try changing your query to:

$sql = "DELETE FROM test4 WHERE id={$_GET['id']}";

Let me know if it works

jblacdao 2 Light Poster

You can use sessions to store the ids of the checked items. The PHP manual has samples so it shouldn't be too hard for you to implement it on your script. But if you have trouble, just let me know and I'll give you a sample code. I just can't do it right now because I'm at work.

ses5909 commented: Good response +1
jblacdao 2 Light Poster

Here is a function that you could try, It's specifically made to retrieve the start and end of the 2nd week of May given the year passed. If you need it to retrieve from another month I think you will be able to do it yourself.

function Get2ndWeek($year)
{
$result = array();
 
// Check if the first day of may falls on a monday
$FirstDay = getdate(mktime(0, 0, 0, 5, 1, $year);
 
// compute how many days is there to the Monday after May 1st
switch($FirstDay["wday"])
{
case 0 : $DaysBeforeNext = 1; break; // Sunday
case 1 : $DaysBeforeNext = 7; break; // Monday
case 2 : $DaysBeforeNext = 6; break; // Tuesday
case 3 : $DaysBeforeNext = 5; break; // Wednesday
case 4 : $DaysBeforeNext = 4; break; // Thursday
case 5 : $DaysBeforeNext = 3; break; // Friday
case 6 : $DaysBeforeNext = 2; break; // Saturday
} 
$NextMonday = $DaysBeforeNext + 1; // 1 is added to signify that we start counting after May 1st
 
$result["Start"] = getdate(mktime(0, 0, 0, 5, $NextMonday, $year));
$result["End"] = getdate(mktime(0, 0, 0, 5, $NextMonday + 6, $year));
 
return $result;
}
jblacdao 2 Light Poster

ur welcome! glad to be of assistance :D

jblacdao 2 Light Poster

Yes, but what I was saying is that based from your script you are trying to use variables for which their variables have not been set, meaning they have null or empty values. Now, judging from your script you can try changing:

[B]mysql_query([/B]"SELECT * FROM users WHERE username='$accepted' AND betakey='$betakey' AND id='$userid' AND email='$email'"[B])[/B];

to:

$result = [B]mysql_query([/B]"SELECT * FROM users WHERE username='$accepted'"[B])[/B];
 
$record = mysql_fetch_array($result, MYSQL_ASSOC);
if (!empty($record))
{
$betakey = $record['betakey'];
$userid = $record['userid'];
$email = $record['email'];
}
else
{
// Insert error handler/User notification that sending of email has failed
}

Try it out and let me know if it still doesn't work

jblacdao 2 Light Poster

Ohhh now I see... I think I had the same problem before. When you include the php file on an html document, the php script does not get executed. Try converting the html into a php script and see if it works

jblacdao 2 Light Poster

Hi! I did a comparison between inc_rate.php and _test.1.php and the difference I saw was that _test.1.php used this code

$res = captcha::check();
  if (isset($res)) {
     if ($res) {
        $msg = "SUCCESS!!";
     }
     else {
        $msg = "FAILED.";
     }
     for ($n=0; $n<5; $n++) {
        echo "$msg\n";
     }

before captcha::form() was called. I couldn't run inc_rate.php on my localhost because I don't have your database so I couldn't really tell, but that's the only difference I see in the scripts based on what you posted.

jblacdao 2 Light Poster

You might wanna check the libraries compiled with your PHP. You get that error because the library that's supposed to implement that function is not compiled with your PHP.

jblacdao 2 Light Poster

Or if you just copy pasted azarudeen's code and didn't put in the page value for the action property in the form tag, you'll definitely get a blank page ^^

jblacdao 2 Light Poster

You can access the text as how Gary used it in his example. Its basically like accessing a variable you have declared only you got from the previous page.

print $_GET['dlurl'];

Is this what u were looking for? or if you want it to appear as a link on your new page

<a href="<?=$_GET['dlurl']?>" >DOWNLOAD FILE</a>
jblacdao 2 Light Poster

Here's an example of how to open new windows with javascript that i got from w3schools: http://www.w3schools.com/js/tryit.asp?filename=tryjs_multiwindows

jblacdao 2 Light Poster

Actually $verbose is just used as a flag once you call the function. Its set to false by default, meaning while copying the files it won't printout anything as files are being copied. However, if you supply a true value once you called this function like

dircopy($src, $dest, true);

as files are copied, you will receive a printout everytime a file is successfully copied

jblacdao 2 Light Poster

I haven't used session_register yet but I have done a login/logout feature and I only used "session_start();" and stored the variables in the $_SESSION variable.

In your case it would be:

<?php
 
include("conf/conf.php");
session_start();
 
 
if($pw=file($PWD_FILE)) $authenticated = 0; 
 
  $_SESSION["AUTH_NAME"] = /*value of name*/ ;

  for($i=0; $i<=count($pw); $i++)
 
   {
 
$line = split(":", $pw[$i], -1);
 
$pass = chop($line[1]);
 
$salt = substr($pass, 0, 2);
 
$ToCompare=$AUTH_NAME.":".crypt($AUTH_PASSWD, $salt);
 
       if(strcmp(trim($pw[$i]),$ToCompare)==0)
 
           {
 
$_SESSION['authenticated']=1;
 
           echo $_SESSION['authenticated'];
 
           }
 
   }

At the start of the succeeding pages, just put in session_start(); and check $_SESSION. I suggest you don't keep the password as a session variable as it may pose as a security risk for the user and you only need the password for authentication anyway.

jblacdao 2 Light Poster

PHPFreaks is more better... i got immediate responce for this thread...... :(.... daniweb Looks good ... but ... not THAT active :(

*Off Topic*
It doesn't mean that if you get no response, means people aren't active. You're not the only one that needs help and have you considered maybe that nobody may have knowledge of what you need or maybe the one's that do have other things to do as well. Besides, there are other ways to solve your problem like researching for information yourself. So stop being a baby and grow up.

*On Topic*
Sorry I do not have any idea on what you need. You happy now?

jblacdao 2 Light Poster

Can u post the code wherein you actually merged the two so we could get a clear picture of how you inserted the captcha code into your comment.php script. It's hard to see where you might have gone wrong if we can't see the actual code.

jblacdao 2 Light Poster

You used the variables but never assigned any value to them before you used them. Are they supposed to get their values from a previous form? If so, you have to assign it to them before you use them.

jblacdao 2 Light Poster

I have encountered this before and you might wanna research on "Magic Quotes" in the php manual. I don't know exactly what to tell you to do, but if you could give an example of your code that outputs the string it would be much better.

jblacdao 2 Light Poster

I've been testing on uploading files and I encountered a weird bug while testing it out because on the initial uploading of the file, my localhost uploads it to the root directory of my xampp rather than in the directory inside my htdocs folder. To make things clear here's what happened.

1.) I upload my file from a page in http://localhost/fileupload/upload.html, which is equivalent to my "C:\xampp\htdocs\fileupload" directory.

3) After the initial upload the file is stored in the "C:\xampp" folder instead of the fileupload folder mentioned above.

4) I tried uploading again, that's when it stores the uploaded files to my uploaded folder.

5) When I deleted the copy on the "C:\xampp" folder and uploaded the file again, it's there again and it didn't replace the copy on the "C:\xampp\htdocs\fileupload" directory.

From this, I deduced that if it doesn't see a copy of a file in the "C:\xampp" directory, the upload goes there. If the file exists, that's the only time it uploads it to the same directory as my page. Is this a config issue or a security issue? Can anyone shed some light on this matter?

Thanks,

Joni

jblacdao 2 Light Poster

if you want the parent window to close when a new page opens, why not just open the new page in the same window?? O_o

I agree with Matt, why would you go all that trouble just for the logout. If you're worried about the back button on the browser, why don't you just put security measures on your pages like checking for sessions/cookies that you set when you login. If their sessions/cookies expire then warn the users and ask them log back in. Most if not all websites with logins do the same thing and they dont have problems with it.

jblacdao 2 Light Poster

Excellent thanks for the quick response! After I posted my question I sort of stumbled ("Googled" ) on that method by accident. Is there something I can read that is a good primer on the DOM model?

A good source of documentation would be at www.w3schools.com. They have a full tutorial on HTML DOM. It would be best to start there coz u can test out the tutorials on the site itself. I'm also starting to learn web programming myself and I find resources there to be most useful