Paul_Bunyan
Members-
Posts
16 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Paul_Bunyan's Achievements
Newbie (1/5)
0
Reputation
-
[SOLVED] implementing a timer for database spring cleaning
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
Thank you! Cronjobs will do just what I need! -
Hi all. I'm maintaining a database of engineers with some php pages linked to an Oracle database. I would like to be able to maintain a record of how long it has been since a user has last logged in to update their profile and if it has been a year automatically send them a notification. I'm not sure how to implement a timer that would check each users profiles. I was just hoping that someone could suggest an approach as I haven't as of yet figured out how to tackle this. Thanks in advance for any ideas.
-
[SOLVED] Submit button requires that I click it twice...
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
I'm pretty new to PHP and I took over a project for someone. I modelled all my pages after his and it was just how he did things. I'll look into using $_POST instead. Thanks for the heads up. Ah ok, thank you. -
Hi al. I'm encountering a weird error where my form doesn't get submitted unless I click it 2 times. I don't mean double click, but only after I have submitted it twice. I just wanted to see if someone could take a look at my code to see if there is something obvious that I am overlooking. Thanks for any insight. **EDIT: I don't know where those boxes came from. I can't see how to remove em... <?php // connection statement require_once('../Connections/pubs_db.php'); // additional functions require_once('../includes/functions.inc.php'); require_once('../php/functions.php'); // build the form action $editFormAction = $HTTP_SERVER_VARS['PHP_SELF'] . (isset($HTTP_SERVER_VARS['QUERY_STRING']) ? "?" . $HTTP_SERVER_VARS['QUERY_STRING'] : ""); if (isset($HTTP_POST_VARS["Submit"])) { if($HTTP_POST_VARS['contact_email'] != "") { $traceMsg = "email is not blank"; // check if the user id and password combination exist in database $sql = "SELECT username, password FROM user_directory WHERE contact_email=".squote_string(parse_string($HTTP_POST_VARS['contact_email'])); $result = $pubs_db->Execute($sql) or die('Query failed. ' .$pubs_db->ErrorMsg().$sql); $commit = $pubs_db->Execute("commit") or die($pubs_db->ErrorMsg()); $totalRows = $result->RecordCount(); if ($totalRows == 1) { //set subject $subject = "Geotech Account Information"; //set recipient $recip = $HTTP_POST_VARS['contact_email']; //email username and password $headers = "From: wo@email.com"; $body = "This is your account information for your Geotech skills account:\n Username: ".$result->Fields('username')."\n Password: ".$result->Fields('password')."\n\ Josh Morsel Buns"; # The format of the mail() function: #mail ( string to, string subject, string message [, string additional_headers [, string additional_parameters]]) if(mail($recip, $subject, $body, $headers ) == false) { $errorMessage = 'Email failed'; } else { // after login we move to the index page $insertGoTo = "index.php"; KT_redir($insertGoTo); } } else { $errorMessage = 'Email not on file.'; } } else { $errorMessage = 'You must enter your email.'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <link href="../mainstyl.css" rel="stylesheet" type="text/css" /> <link href="../mainstyl.css" rel="stylesheet" type="text/css" /> </div> </head> <style type="text/css"> <!-- .style4 {font-size: 24px} --> </style> </head> <body> <p align="center" class="xsmallnavybold"><br /> <br /> <span class="navybold style4">Username/Password retrieval :</span></p> <p align="center" class="maroonitalicbold">Directions: Please enter the contact email that you have for this Geotech skills account. Your username and password will be emailed to you.</p> </div> <?php if ($errorMessage != '') { echo $errorMessage; } ?> </p> <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data"> <table width="400" border="1" align="center" cellpadding="2" cellspacing="2" class="tbl_greenbordersolid"> <tr> <td width="150" class="largebold">Contact Email:</td> <td><input name="contact_email" type="text" id="contact_email" value="<?php echo $HTTP_POST_VARS['contact_email']; ?>" /></td> </tr> <tr> <td width="150"> </td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </form> </body> </html>
-
[SOLVED] Uploading photos to web server.
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
I just wanted to say thanks for all the help. It turns out that even though Dreamweaver was telling me that I had changed the permissions on my folder, on my web server it was not changing. I had to SSH in and chmod it. That, and I had to use the absolute path for my destination. Thank you! -
[SOLVED] Uploading photos to web server.
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
I'm still trying to figure this out so I thought I'd bump the thread to see if anyone had any other ideas where I might be going wrong. Thanks for the help so far! -
I got a job with US Forest Service... ;D
-
my current playlist: chromeo the doors cut copy A-Track the police the bollweevils steed lord the bloody beatroots gangstarr mstrkrft dropkick murphys goldfrapp Death Proof OST VND & LSM Guns n Bombs
-
[SOLVED] Uploading photos to web server.
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
Ok, so I found my temp directory for files and it's permissions are already set to 775. I'm still getting this error: Warning: move_uploaded_file(images/1215800976.jpg) [function.move-uploaded-file]: failed to open stream: & Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/fsfiles/ref/infocenter/fsweb/files/phpKk35Ea' to 'images/1215800976.jpg' -
[SOLVED] Uploading photos to web server.
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
Thanks for the replies guys. I'm now using move_uploaded_file but I am having trouble locating my php.ini so that I can see where my temp file is located. -
Hello. I am having problems uploading photos to my web server. I have set the permissions on the file "images" to 777 via dreamweaver but when I submit the upload I still get the error message: Warning: copy(images/1215797607.jpg) [function.copy]: failed to open stream: Permission denied I am using code found on this page (http://www.reconn.us/content/view/30/51/): I thought it was a permissions error at first but now I am wondering if there is something I may have overlooked in the code. Thanks in advance. <?php //define a maxim size for the uploaded images in Kb define ("MAX_SIZE","100"); //This function reads the extension of the file. It is used to determine if the file is an image by checking the extension. function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } //This variable is used as a flag. The value is initialized with 0 (meaning no error found) //and it will be changed to 1 if an errro occures. //If the error occures the file will not be uploaded. $errors=0; //checks if the form has been submitted if(isset($_POST['Submit'])) { //reads the name of the file the user submitted for uploading $image=$_FILES['image']['name']; //if it is not empty if ($image) { //get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and will not upload the file, //otherwise we will do more tests if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { //print error message echo '<h1>Unknown extension!</h1>'; $errors=1; } else { //get the size of the image in bytes //$_FILES['image']['tmp_name'] is the temporary filename of the file //in which the uploaded file was stored on the server $size=filesize($_FILES['image']['tmp_name']); //compare the size with the maxim size we defined and print error if bigger if ($size > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } //we will give an unique name, for example the time in unix time format $image_name=time().'.'.$extension; //the new name will be containing the full path where will be stored (images folder) $newname="images/".$image_name; //we verify if the image has been uploaded, and print error instead $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; } } } } //If no errors registred, print the success message if(isset($_POST['Submit']) && !$errors) { echo "<h1>File Uploaded Successfully! Try again!</h1>"; } ?> <!--next comes the form, you must set the enctype to "multipart/frm-data" and use an input type "file" --> <form name="newad" method="post" enctype="multipart/form-data" action=""> <table> <tr><td><input type="file" name="image"></td></tr> <tr><td><input name="Submit" type="submit" value="Upload image"></td></tr> </table> </form>
-
Drop down box not selecting the correct default value.
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
Ah ok. I figured it out and I feel pretty dumb. The table in Oracle was a char(20) so the value was being stored with the extra whitespaces included. So 151 was stored as "151 ". Thanks for the help! -
Drop down box not selecting the correct default value.
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
Interesting results. So, the expected value is being echoed. But the correct drop down option is not being selected. So for example, when I select a record with the value 151, the drop down box shows the default value as "Not Applicable. 151" -
Drop down box not selecting the correct default value.
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
Here is the source that is generated: <tr> <th align="left" valign="top" scope="row">Total Jumps: </th> <td align="left" valign="top"> <select name="total_jumps" id="total_jumps"> <option value="NA" >Not applicable.</option> <option value="19" >< 20</option> <option value="21" >20 to 49</option> <option value="51" >50 to 99</option> <option value="101" >100 to 149</option> <option value="151" >150 to 199</option> <option value="201" >200 to 249</option> <option value="251" >250 to 299</option> <option value="300" >> 299</option> </select> </td> <td align="left" valign="top">*ND</td> </tr> -
Drop down box not selecting the correct default value.
Paul_Bunyan replied to Paul_Bunyan's topic in PHP Coding Help
Ah, sorry I wasn't specific. It doesn't select the correct option. It always selects, "Not Applicable." . I tried your solution mbeals, but I still can't get the right option to be selected. I also tried all of the variations given by Jabop. Thanks for the help so far