
doni49
Members-
Posts
515 -
Joined
-
Last visited
Everything posted by doni49
-
Well I had an epiphony (sp?) last night while I was in bed trying to go to sleep. What was happening is that the old code REQUIRED that you type in the "www" when you visit the site. If you didn't then it didn't add the needed folder to the include_path. Thanks for taking a look. I had to change the following [code] $servername = explode(".",$_SERVER['SERVER_NAME']); switch ($servername[1]) { case 'site1': $incpath2 = "/home2/username/includes/site1"; break; case 'site2': $incpath2 = "/home2/username/includes/site2"; break; case 'site3': $incpath2 = "/home2/username/includes/site3"; break; }[/code] to [code]if (eregi ("site1", $_SERVER['SERVER_NAME'])){ $incpath2 = "/home2/username/includes/site1"; }elseif(eregi ("site2", $_SERVER['SERVER_NAME'])){ $incpath2 = "/home2/username/includes/site2"; }elseif(eregi ("site3", $_SERVER['SERVER_NAME'])){ $incpath2 = "/home2/username/includes/site3"; } [/code]
-
I just downloaded PHPMailer. 1) I'm looking throught the docs and not sure what route to take. I'm on a hosted linux server with PHP5. In the past, whenever I've sent any email using PHP, I did so with mail(). But CPanel tells me a "path to sendmail". So I'm pretty sure I can also use sendmail. I also have access to three smtp servers. Can someone help me figure out the pros and cons of one vs the others? Also, assuming for a minute that I DON'T use SMTP, do I need to upload class.smtp.php to the server? 2) The docs tell me that I can set the encoding to one of 5 values. I'm not sure what the different ones mean. I'm interested in being able to send messages that have HTML (but also have plaintext for email clients that can't--or are set not to--display HTML), be able to send file attachments sometimes. The options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable". 3) What's the difference between "Sender" and "From"?
-
[quote author=jwk811 link=topic=109914.msg443463#msg443463 date=1159497403] ok and what would i add to the script to redirect to another page? [/quote] I assume you're wanting to thank the user for sending the email or something like that--that's what I think you meab by 'redirect to another page'. header("Location: thankyou.html");
-
It sounds like you're saying that you have a "delete" button next to each record in the table that's displayed. Why not just put a checkbox next to each record? Then a Submit button at the bottom. When the submit button is clicked, delete all records that were checked. Display the record as a link. Assume for a minute that you want to delete a user. userID is unique. So your link could look like: deleteuser.php?user=baduser Then deleteuser.php would retrieve the userID from the Get array. Personal, I'd prefer the first suggestion. If you had multiple records to delete you could just check them all. The second one would require you to keep clicking the links.
-
I have a bit of a problem. My php file has several include calls--most of the included files are in the same folder. But SOMETIMES one file is not able to be located even though the other included files CAN be located. The one file that is throwing not found errors is [b]FRDBConnect.inc[/b]. The include file (comm_config.inc) uses the "set_include_path" function to change the include path to include the folder containing my include files. The times that I've loaded the page myself--no errors. When the techs at the web host, load the page--no errors. But Thursday night around 9pm, I recieved an error message (from the error handler) informing me that someone tried loading the page and [b]FRDBConnect.inc[/b] could not be found. This was the third message over the course of the previous 4 days or so. My web host INSISTS that it's not a server issue and MUST be a coding issue. But that just doesn't make any sense to me. If it's a coding issue, wouldn't it either work ALWAYS or NEVER work? [code] <?php //This is index.php $pgTitle = "Welcome to mysite1.com"; include("header.inc"); require_once ('FRDBConnect.inc'); // Connect to the database. ?> Page specific HTML content here. <?php include("footer.inc"); ?> [/code] [code] <?php //This is header.inc (in the same folder as index.php). include("/home2/username/includes/common/comm_config.inc");// <==This include file sets up configuration for all three of my web sites. Code shown below. include("/home2/username/includes/Site1/header2.inc"); ?> [/code] [code] //This is comm_config.inc <?php $incpath = get_include_path(); $incpath = explode(":", $incpath); if (empty ($_SESSION['sessionStarted'])){ $_SESSION['sessionStarted'] = TRUE; ob_start(); session_start(); } $servername = explode(".",$_SERVER['SERVER_NAME']); switch ($servername[1]) { case 'site1': $incpath2 = "/home2/username/includes/site1"; break; case 'site2': $incpath2 = "/home2/username/includes/site2"; break; case 'site3': $incpath2 = "/home2/username/includes/site3"; break; } //pull the include_path apart so that I can rebuild it //as ".:my_common_include_folder:my_site_specific_include_folder:default_include_folders_as_specified_by_web_host" $incpath3 = ""; for ($i = 1; $i <= count($incpath) - 1; $i++) { $incpath3 .= ":" . $incpath[$i]; } $incpath3 = ".:/home2/username/includes/common:" . $incpath2 . $incpath3; set_include_path($incpath3); //From here to the end of this file, I set up error handling--thanks to a script from one of Larry Ulman's books. // This script determines how errors are handled. // Flag variable for site status: if (! $live){ $live = TRUE; //$live = FALSE; } date_default_timezone_set("America/New_York"); // Error log email address: $webmaster_email = "[email protected]"; //'contactform@' . $servername[1] . "." . $servername[2]; // Create the error handler. function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) { global $live, $webmaster_email, $incpath2; if ($live){ $lineterm = "\n"; }else{ $lineterm = "<br />"; } // Build the error message. $message = "An error occurred in script '" . $e_file . "' on line " . $e_line . ": " . $lineterm . $e_message . $lineterm . $lineterm; // Add the date and time. $message .= "Date/Time: " . date('n-j-Y H:i:s') . $lineterm . $lineterm ; $message .= "Include Path: " . get_include_path() . $lineterm . $lineterm; $message .= "Files in " . $incpath2 . ": " .$lineterm; if (file_exists($incpath2) && is_dir($incpath2)) { if ($handle = opendir($incpath2 . "/")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $message .= $file . $lineterm; } } closedir($handle); } } else { $message .= "The Folder " . $incpath2 . " does not exist." . $lineterm . $lineterm; } $message .= "$lineterm Files in common folder:" . $lineterm; if (file_exists("/home2/donirela/includes/common") && is_dir("/home2/donirela/includes/common")) { if ($handle = opendir("/home2/donirela/includes/common/")) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $message .= $file . $lineterm; } } closedir($handle); } } else { $message .= "The Folder '/home2/donirela/includes/common' does not exist." . $lineterm . $lineterm; } // Append $e_vars to the $message. $message .= "<pre>" . print_r ($e_vars, 1) . "</pre>" . $lineterm; if ($live) { // Don't show the specific error. // error_log ($message, 1, $webmaster_email); // Send email. $headers = "From: " . $webmaster_email . "\r\n"; mail($webmaster_email, "PHP Error Message", $message, $headers); // Only print an error message if the error isn't a notice. if ($e_number != E_NOTICE) { echo '<div id="Error">A system error occurred. We apologize for the inconvenience. The webmaster has been notified of the error and will get it fixed ASAP.</div><br />'; } } else { // Development (print the error). echo '<div id="Error">' . $message . '</div><br />'; } } // End of my_error_handler() definition. // Use my error handler. set_error_handler ('my_error_handler'); ?> [/code] [code] This is Header2.inc--it contains no PHP code. It's all HTML content that sets up the page title, links the CSS file, and sets up all the common items that go across the top of all pages on the site. [/code] [code] <?php //This is the FRDBConnect.inc file. The code in this file as you'd expect, //opens the database connection. if (!isset ($ignoreDB)){ $dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("dbname"); } function disconnectDB(){ mysql_close($dbc); } function escape_data($data){ global $dbh; if (ini_get('magic_quotes_gpc')){ $data = stripslashes($data); } return $data; } ?> [/code] [code] This is footer.inc--it contains no PHP code. It's all HTML content that puts the copyright info at the bottom of the page. [/code]
-
I'm using a web host for my web site. I am able to use .htaccess files. I need to add two folders to the include_path statement for my web site. Every time I use the PHP_value directive in my .htaccess file, I get an internal server error when I try to load my web page. If I take the line OUT of the .htaccess file, there's NO error when loading the web page. Before making any changes, [I]phpinfo()[/I] tells me this is the value of the include_path variable: [quote] .:/usr/lib/php:/usr/local/lib/php[/quote] The following is the line I'm putting in my .htaccess file: [QUOTE] php_value include_path ".:/usr/lib/php:/usr/local/lib/php"[/QUOTE] I'm trying to get it working--then add my two folders to the path. Does anyone have any ideas? THANKS! EDIT: I FINALLY got a response from my web host. They tell me that the php_value directive is disabled. Can anyone think of any alternatives that I can use? One folder is outside of the public area (under the root). This folder includes some php files that I can NOT allow anyone to access. I want to include these files without having to hard code the path everytime I include them. That's one folder. I also have one other folder that is in the public area. Again I don't want to have to type the path everytime. Thanks.
-
I use a webhost for my websites. I have one main domain with 2 add-on domains. I've had this service for about a year. Since that time, I've had three seperate PHP.ini files--one in the public_html folder for each domain. The purpose of each PHP.ini file is that it sets the include search path for each domain. But now all of a sudden, the PHP.ini file stopped loading therefore the include path has not been set as it's supposed to be and has been for the past year. When I asked my web host about it, I was informed that it should NEVER have worked this way and they don't allow individuals to use their own PHP.ini files. Anyone have any ideas on how I can set the include path for MY domains on a hosted account? I don't want to have to specify the whole path with every include statement but I want to keep the include files seperate for security reasons. Thanks. EDIT: Ok I've found something that SEEMS like it should be what I need. But it's not working as expected. First here's a link to a tutorial I found on this site. www.phpfreaks.com/tutorials/10/0.php There are three examples shown in the tutorial, I'm looking at the THIRD example. The following is what I put in my .htaccess file (I do have rights to keep my own .htaccess file): [b]php_value include_path .:[color=red]/home2/username/includefolder1[/color]:[color=red]/home2/username/public_html/php[/color]:/usr/lib/php:/usr/local/lib/php [/b] When I try to load a web page with this line there, I get an internal server error (500). When I take this line out, it just tells me that it can't find my include files. I need it to look 1st in the same folder as the page that's loading. Then in the two folders that are RED above. Then to the default location as provided by the server's default settings. The following is the default include_path before I make my changes (as told by [i]phpinfo()[/i]). [b].:/usr/lib/php:/usr/local/lib/php [/b] Thanks again!
-
All you do is pass the query result to this function. It highlights every other row. [a href=\"http://www.phpfreaks.com/quickcode/Table-Generator/171.php?higlight=table\" target=\"_blank\"]http://www.phpfreaks.com/quickcode/Table-G...?higlight=table[/a]
-
That's strange. I only put them in there because I was getting error messages that there was something wrong with the syntax. When I put them in the error message went away. Is "Fields" a reserved name or something? While waiting to hear from someone, I kept trying different things. I changed "Fields" to "Flds" and still got the column names anyway. But then as soon as I took the quotes back out, it worked fine (with it still using "Flds"). Thanks for the help.
-
This is a code snippet from my PHP file. [code] $query = "SELECT 'setName', 'fields' FROM userFieldSets WHERE user_id='$uid'"; $result = @mysql_query ($query) or die ('I cannot get fields from the database because: ' . mysql_error()); $row = mysql_fetch_array ($result, MYSQL_NUM); if ($row) { // A match was made. echo "0: " . $row[0] . "<br>"; echo "1: " . $row[1] . "<br>"; } [/code] It shows this in my browser. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] 0: setName 1: fields [/quote] This is copy/pasted from phpMyAdmin. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] [b]id user_id tblName setName fields [/b]1 1 mainIndex Default 1,2,3,4,5,6,7,8,10,13,14 2 1 propertyAmtsDue Default 1,2,3,4,5,6,7,8,10,13,14 3 1 propertyContact Default 1,2,3,4,5,6 [/quote]
-
Thanks for taking the time to reply. I found it last night. I don't remember removing it, but one of the fields that the posted script was trying to add data to was not there. Therefore it was failing. The only thing I could find that looked out of the ordinary was that "collation" stuff--Latin Swedish? Rather than post back here saying "never mind", I figured I'd let the thread die.
-
[code] $query = INSERT INTO users (username, first_name, last_name, password, registration_date, phone_num, secretAU, secretQU, secretAP, secretQP, fax_num, email) VALUES ('doni49', 'Don', 'Ireland', PASSWORD('kirsten'), NOW(), '215-932-2391', 'Jennifer', 'What was your first girlfriend\'s name?', 'Deland', 'What is your father\'s middle name?', '508-546-0464', '[email protected]') $result = @mysql_query ($query); // Run the query. [/code] It fails to add the data to the DB. I've confirmed that the script IS logging in. The user has "ALL PRIVILEDGES" to the DB. The "result" variable ends up with NO value. [code] echo '<br><br><br>Hi<br>' . $result . 'Bye<br><br><br>'; [/code] The above shows this: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Hi Bye [/quote] I THINK it might have something to do with the "Collation" in the user table fields, when I try to remove the collation via phpMyAdmin, it says they were altered. But then when I check the user table structure, the collation is back. I've attached an image showing the table structure in phpMyAdmin. [img src=\"http://67.62.63.125/usertable.jpg\" border=\"0\" alt=\"IPB Image\" /] Can someone help me track this down? TIA1