Jump to content

NevadaSam

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

Everything posted by NevadaSam

  1. Sometimes people are receiving emails with a blank text area. Please show me the proper way to to write the bold part of this line of code for a mail() header. $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n"; Sam ;
  2. OK, I finally figured out how to write this. Here is what works: if ((!empty($_SESSION['currentLogin']) && $_POST['Login'] != $_SESSION['currentLogin']) || empty($_SESSION['currentLogin'])) { ...check input against user table... } I appreciate your replies and I am sorry I did not explain my self well. Problem Solved! Thanks, Samantha
  3. I appreciate your replies, but I currently have a query and all necessary MySQL commands to compare the input against information in the table. I am not asking for help with that. I wish to update my script. If the person is not changing their login name then it is not necessary to access the MySQL server or table to make a comparison. I need help with an IF statement to say this: if POST-name is not equal to current-name // (Ex: member changing their name) or current-name does not exist // (Ex: new member) Sam ;
  4. cooldude832, I am not having a problem with MySQL statements. I need to word the if statement so the script will know to check the table or not.
  5. That just says the same thing twice. Did you mean something else? And in the case of a new member there would not be a currentLogin and that would cause an error.
  6. When a person registers an unique userID will always identify them so if they want to they can change their login name as long as that login name is not being used by someone else. So when a person enters a login name either as a new member or they are changing their current login name during an update, the script needs to know if it should check the user table. Please help me say this: if POST-name is not equal to current-name // (Ex: member changing their name) or current-name does not exist // (Ex: new member) if ($_POST['login'] != !empty($_SESSION['currentLogin']) || empty($_SESSION['currentLogin'])) { // Check to see if login name exist. I can do this. I just need help with the IF statement. } Sam ;
  7. frost110: In my full code, I do use trim() to remove end spaces. while the beginning does not seem to be a problem, a space on the end will really mess it up. And I remove any extra spaces that may be between words along with comma, quotes, etc. In this small code it did not work right without removing extra white space. I think that was because when I remove 3 letter words only the text was taken out leaving the extra space that was with it. The actual input will come by a user via an input box so anything could happen. Lumio: That may be a much better code. Looks like it should wrap words with 4 or more letters. I was going the long way around doing it backwards. I will try that. Thanks to everyone who look and read. Sam ;
  8. With this script I get the desired results of: Search words used: A big fast red truck But I was wondering if there is a better way. $str is received from a search form. A lot of other code not shown here removes all words less than three characters, because they are not use in a mysql search. This script echos all the words the user submitted with the words that were actually used in bold. Could I have done this better? <?php $str = "A big fast red truck"; $searchwords = preg_replace( '#(\b[\w]{0,3}\b)#', '', $str ); // removes <=3 char words $searchwords = preg_replace('/\s+/', ' ', $searchwords); // removes extra spaces $searchwords = explode(' ', $searchwords); array_walk($searchwords, create_function('&$v, $k', '$v = "/\\b$v\\b/i";')); $str = preg_replace($searchwords, '<strong>\\0</strong>', $str); echo "Search words used: " . $str; ?> Sam ;
  9. When I CREATEd the table this is how I set up the indexes. When ever the database is searched, I want the search to include all the data in both column. How should I set it up to search both columns? FULLTEXT KEY `col1` (`col1`), FULLTEXT KEY `col2` (`col2`) Sam ;
  10. I am looking for a simple way to put an image on top of an image. I know how to use "z-index", but I want to do this without using additional img tags. My images(thumbnails) vary in height and width. The image I want to float on top at the bottom right of the thumbnails is a 12x12 magnifying glass image to indicate the image can be enlarged by clicking the thumbnail. Here is what I have so far. .tn { border: double; float: left; border-color:#0000FF; padding: 3px; margin-top: 0px; margin-right: 10px; margin-bottom: 5px; margin-left: 0px; /* background-image:url(images/magnify.gif) no-repeat right bottom; */ } <img class="tn" src="image.jpg" alt="click to enlarge" /> Sam ;
  11. I have found that there are many post about image resizing in forums. Let me do what I should have done before posting. I will research and study a ot and let you all know if I have any problems. thanks, Sam ;
  12. After my PHP script has uploaded a photo I want to display it in a table cell which is 450 wide and 338 tall. This is a proportional reduction for a image that is of normal shape of 800x600. However if the photo was taken with the camera held sideways or has been cropped and does not have proportional sizes, then it will appear stretched and distorted. So I cannot simply code <img src="$PhotoName" width="450" height="338">. I need PHP to determine if the photo is say: 338x450, then only display it with a width of 253 and use the max height of 338 so it want look distorted. Can this be done with PHP? I know it could not be simple HTML because calculations will have to be made. Sorry I have no code to post on this manner. I wrote the unloader and form, but I have now idea as how to start this. If there are links or code anyone can provide to get me get me started, I will really appreciate it. Thanks, Sam ;
  13. [b]Problem[/b]: When my hit counter scripts crash, visitors won't be forwarded to the site. [b]Discussion[/b]: I use a MySql data base to record the number of hits from different forwarded domains. Yesterday I changed the user password on the account for other reasons without realizing what it would do to my hits counter table access. The results were when the script tried to record the hit and forward a visitor they would see error messages on the screen, the script would die and couldn't be forward with the header() because output from the Warnings and Notices had already been sent. I realize there was something wrong when I check for hits today and saw zero where there should have been over 200. I do not need to get errors, warning, or notices if the scripts fail. It is nice to have the count, but more important for the visitor to be forwarded to the final destination.  [b]Solutions[/b]: I have came up with this code. I have tested in with every situation I can think of (bad login info, db not found, and now table) and it either records the hit and forwards or just forwards. It seems to work find and will prevent what happen from happening again. I would like for others to see it and let me know if you see any possible problems I might have over looked. What variable information which is not shown is in the include file. [code]<?php error_reporting(0); include ("hits.inc"); $CTfrom = 'cosbynet'; $DBConnect = mysqli_connect("$host","$user","$password"); if (!$DBConnect) header($Location); $db = mysqli_select_db($DBConnect, $DBName); if (!db) header($Location); $QuerySend = "INSERT INTO $TableName VALUES(NULL, '$CTdate', '$CTtime', '$CTfrom')"; $QueryResult = mysqli_query($DBConnect, $QuerySend); if (!$QuerySend || !$QueryResult) header($Location); mysqli_close($DBConnect); header($Location); ?>[/code] Sorry about the long post. I appreciate any advice you might have. Sam ;
  14. I am glad you are headed in the right direction now. Good luck with your site. Sam
  15. The weekend was my best time, but let's see what we can do. Perhaps this will be enought to help. First I want to point out that while Godaddy does have short_open_tag set to On, it is not good pratice not to use them. Consider using [b]<?php[/b] instead of [b]<?[/b]. Probably the reason you could not post your index.php code was this fourm has a limit on how my lines of code can be posted. Normally one only needs to post the part they are having a problem with. Whenever you want to share more code you can upload it to a text file (index.txt) and it will be viewable from a link on your site. This is the code you emailed to me. [url=http://nevadasam.zoomcities.com/index.txt]http://nevadasam.zoomcities.com/index.txt[/url] It looks OK and I am sure it is if it worked on the last hosting site. The next place to look is in your connection set up. The second line of your code is looking for a script name [b]connection.php[/b] in a sub-folder from where the index.php file is. This script brings in, (includes), the settings to connect to the database. Another pointer here is you may want to consider giving it a trickier name (the file and folder) for security reasons so no one can guess it. Do that after  you have gotten everything up and running. [code]<?session_start(); include('include/connection.php'); [/code] Make sure the username and password used in the connection.php is what you assigned to your GoDaddy database. And that the database where listed in the connection information is the same as what you are calling it now. From the control panel at GoDaddy find out what your connetion settings are. They are different than most hosting services. They don't use "localhost" I have different server names for the two database I have there. They are: mysql211.secureserver.net, and mysql119.secureserver.net. Yours may be different. ($host = 'mysql211.secureserver.net';) This may get you in the right direction. Let us know how it goes. Sam
  16. Thanks, I knew the ELSE statement could be used. I just was not sure what to say with it.
  17. OK, I created a database and uploaded your dumped file. I did not get any errors and all seems good. Your data seems to be only test data you create so perhaps it is not senistive material as I thought. Does you index.php access the db from the start? If so be sure your login information matches. Even if you do not successfully connect to the db you shouldn't get a blank page. I will need to see the index.php script to know anymore. Sam
  18. pbase, what you sent me was the mysqldump. This is the information used to recreate a database onto a new server. Thanks. I am new to this stuff also and will learn a lot from this experience.  I am going to use the information you sent to go back into my unused GoDaddy account and create what you have. This will take a while but we will learn this together. From your orginal post when you mentioned "script" I thought that you were having a problem with your index.php script and I thought that was what you would be posting or sending. If you have successfully recreated the db and are having a problem with the index.php, please cut and paste it here so others can view your php code. Before you post, be sure to xxx out your login name and actual password from the code.
  19. Your first problem is you have a GoDaddy account. ;D;D I am not a big fan as I have almost a year left on an account that I am not using. If you script was written for PHP 5, you will have to rename your files index.php5 on that hosting service. If you script does not have anything too sensitive or personal you can post it or email it to me as I to have access to their site and can get it to work. Sam
  20. Your hosting service should have a control panel. Click on mySQL there. That may be where you set up the database before. There should be forms there for assigning users to the databases. Use a user_name and that user_password to connect to the server with.
  21. I tried many different variations of the file location modifier ("/public_html/save.txt" and more) but I believe it is a privilege issue. I learn more about the SELECT INTO OUTFILE command since my last post. It seems that the FILE privilege is normally not granted because of security reasons. This from my text: [quote][b][u]The FILE privilege[/u].[/b] This enables a user to access files on the server machine with the same privileges as the MySQL server process. This privilege is useful for executing the LOAD DATA INFILE and SELECT INTO OUTFILE statements that read from and write to server-side files. This privilege, however, can be abused as a backdoor around operating systems security and thus should be granted sparingly.[/quote] I can do the LOAD DATA INFILE on most hosting services. So when I learn more about PHP I will write a script that will SELECT all the data from a table and then I will output it to a text file that way. Thanks for taking time to read my posts. Sam
  22. Thanks for telling me about the CASE statement, fenway. This works. The first set of WHEN - THEN statements does the trick. [code]UPDATE thisTable SET thisColumn = CASE thisColumn WHEN 'd1' THEN 'Data One' WHEN 'd2' THEN 'Data Two' WHEN 'd3' THEN 'Data Three' WHEN 'd4' THEN 'Data Four' WHEN 'Data One' THEN 'Data One' WHEN 'Data Two' THEN 'Data Two' WHEN 'Data Three' THEN 'Data Three' WHEN 'Data Four' THEN 'Data Four' END[/code] I had to add the second set of WHEN - THEN statements because if the query was ran after the new values were set the field would be set as NULL if the old WHEN value was not found. Is there a way to express an ELSE statement so I would not have to use the second set of WHEN - THEN statements? Sam
  23. The case statement would have to be ran from within a php script right? I am new at this but I think I can figure that out. Thanks! I was hoping that it would be something that could work from a query by adding ANDs or something. I'll let you know how I do tomorrow. Sam
  24. I know to change the data in a I simply send an update querry:[quote]UPDATE foods SET SameColumn = 'Red Peas' WHERE SameColumn = 'rpeas'[/quote] But I have several more categories in that SameColumn that I also need to change. [quote]SET SameColumn = 'Whole Milk' WHERE SameColumn = 'wmilk' SET SameColumn = 'T-Bone Steak' WHERE SameColumn = 'tsteak' SET SameColumn = 'Tatar Tots' WHERE SameColumn = 'ttots' [/quote] Is there a way I can send them all at once or will each have to be done one at a time? Sam
  25. Send an email to them requiring that they click on a link to respond and verify that it is a valid email and that they received email sent to that address. sam
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.