Jump to content

NevadaSam

Members
  • Posts

    26
  • Joined

  • Last visited

    Never

About NevadaSam

  • Birthday 03/08/1992

Profile Information

  • Gender
    Female
  • Location
    USA

NevadaSam's Achievements

Newbie

Newbie (1/5)

0

Reputation

  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
×
×
  • 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.