Jump to content

tommr

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by tommr

  1. I have a script that is a collection of code and pieces and parts to keep track of arts and show listings. I would like the script to send me an email when a new user registers or when a show is listed.
  2. I have a php code that uses a database to keep track of events. It is made up of a number of pages and is up and running on my site. http://www.artsandcraftsnetwork.com/shows/ I would like to find out how much it would cost to convert this to a wordpress plugin that would work with other plugins like membership plugins. Or even make it so I can integrate it into a wordpress with tags. thanks
  3. I am looking for a javascript that will display a field name in a field box and when the box is clicked the field name dims and when the typing begins the name disappears entirely. Like this site when you go to enter the contest.. www.lightandfit.com thanks, tom
  4. I have a form that sends the user info to a database. One field it URL People are entering the url with out the http:// and when they do the script puts my domain infront of the www. Is there a way to preload the form imput field with the http:// or is there a way to strip my url from the results.
  5. I was getting help with my script and I just noticed this was added. What does it mean? /*** a rfc compliant web address ***/ $url = "http://www.phpro.org"; /*** try to validate the URL ***/ if(filter_var($url, FILTER_VALIDATE_URL) === FALSE) { /*** if there is no match ***/ echo "Sorry, $url is not valid!"; } else { /*** if we match the pattern ***/ echo "The URL, $url is valid!<br />"; }
  6. Can anyone please help me with my code. I would like to display the data from another column instead of the id in the url generated by the scirpt. <?php include('/home/arts/public_html/shows/includes/config.db.php'); if ($link){ $rpp = 10; // results per page $adjacents = 4; $page = intval($_GET["page"]); if(!$page) $page = 1; $reload = $_SERVER['PHP_SELF']; $sql = "select * from craft_shows WHERE venue_state='MD' order by start_date "; $result = mysql_query($sql) or die(mysql_error()); // count total number of appropriate listings: $tcount = mysql_num_rows($result); $date = strftime("%b %d, %Y", strtotime($row['start_date'])); echo "<table class='table7' width='100%' cellpadding='5' cellspacing='1'>"; echo "<tr><td> </td><td>Date</td><td>City</td><td>Show Name</td><td>Attendance</td></tr>"; echo "<tr><td colspan='7'><hr></td></tr>"; // count number of pages: $tpages = ($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number $date = strftime("%b %d, %Y", strtotime($row['start_date'])); $count = 0; $i = ($page-1)*$rpp; while(($count<$rpp) && ($i<$tcount)) { mysql_data_seek($result,$i); $row = mysql_fetch_array($result); $id = $row['id']; echo "<tr><td>"; echo "<a href=\"/show_submits/show_detail.php?id=$id\">Details</a>"; echo "</td><td>"; echo strftime('%b %d, %Y', strtotime($row['start_date'])); echo "</td><td>"; echo $row['venue_city']; echo "</td><td>"; echo $row['show_name']; echo "</td><td>"; echo $row['num_visitors']; echo "</td></tr>"; $i++; $count++; } echo "</table>"; echo "<br>"; // call pagination function: include("pagination1.php"); echo paginate_one($reload, $page, $tpages, $adjacents); } ?>
  7. That does not seem to be working either. I sent an email to the host tech. They said it was working at their end but I tested it with numerous browsers to no avail. I even called a friend who had never loaded the site and it would not work for him. I think I really would like the page to load with the show name instead of the id from the database but this may not be a mod rewrite issue.
  8. <?php include('../show_submits/includes/config.db.php'); if ($link) { if ($_GET["id"]) { $id = $_GET["id"]; $sql = "select * from craft_shows where id = $id"; if (!empty($row['website'])) if (!empty($row['email'])) $electricity = $row['electricity']; if ($electricity == "1") { $answer = "yes"; } else { $answer = "no"; } $acceptance_criteria = $row['acceptance_criteria']; if ($acceptance_criteria == "1") { $answer1 = "yes"; } else { $answer1 = "no"; } $setup_loc = $row['setup_loc']; if ($setup_loc == "2") { $answer2 = "In and Outdoors"; } elseif ($setup_loc == "1") { $answer2 = "Outdoors"; } else { $answer2 = "Indoors"; } $wares_ac = $row['wares_ac']; if ($wares_ac == "2") { $answer3 = "Buyer/Wholesale and Retail"; } elseif ($wares_ac == "1") { $answer3 = "Retail"; } else { $answer3 = "Retail - Open to general public"; } $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result); echo "<table class='table9'>"; echo "<tr>"; echo "<td class='det-B'>Type of show</td><td class='det-B'>"; echo $answer3; echo "</td></tr>"; echo "<table class='table9'>"; echo "<tr>"; echo "<td class='det-A' width='120'>Venue Name</td><td class='det-A'>"; echo $row['venue_name']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Address</td><td class='det-B'>"; echo $row['venue_address']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>City</td><td class='det-A'>"; echo $row['venue_city']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>State</td><td class='det-B'>"; echo $row['venue_state']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>Zip Code</td><td class='det-A'>"; echo $row['venue_zip']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Start Date</td><td class='det-B'>"; echo strftime("%b %d, %Y", strtotime($row['start_date'])); echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>End Date</td><td class='det-A'>"; echo strftime("%b %d, %Y", strtotime($row['end_date'])); echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Start Time</td><td class='det-B'>"; echo $row['start_time']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>End Time</td><td class='det-A'>"; echo $row['end_time']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Contact</td><td class='det-B'>"; echo $row['contact_name']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>Phone</td><td class='det-A'>"; echo $row['phone']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>email</td><td class='det-B'>"; echo "<a href='mailto:".$row['email']."'>".$row['email']."</a>\n"; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>website</td><td class='det-A'>"; echo "<a href='".( strpos( '://', $row['website'] ) ? '' : '' ).$row['website']."'>".$row['website']."</a>\n"; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Number of Crafters</td><td class='det-B'>"; echo $row['num_crafters']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>Booth Fee</td><td class='det-A'>"; echo $row['booth_fee']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Booth Width</td><td class='det-B'>"; echo $row['booth_size_w']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>Booth Depth</td><td class='det-A'>"; echo $row['booth_size_d']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Electricity Available</td><td class='det-B'>"; echo "$answer"; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>Elctricity Cost</td><td class='det-A'>"; echo $row['electricity_cost']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Setup Locations</td><td class='det-B'>"; echo $answer2; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>Juried</td><td class='det-A'>"; echo "$answer1"; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Jury Fee</td><td class='det-B'>"; echo $row['jury_fee']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>Jury Requirments</td><td class='det-A'>"; echo $row['jury_req']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Application Deadline</td><td class='det-B'>"; echo strftime("%b %d, %Y", strtotime($row['application_dead'])); echo "</td></tr>"; echo "<tr>"; echo "<td class='det-A'>Number of Visitors</td><td class='det-A'>"; echo $row['num_visitors']; echo "</td></tr>"; echo "<tr>"; echo "<td class='det-B'>Special Comments</td><td class='det-B'>"; echo $row['comments']; echo "</td></tr>"; echo "</table>"; } } ?>
  9. here is the url .php?id=89 I would really rather have it end with a better description from the database. Is the a script issue or can it be done with .htaccess please help I am trying this but it does not work. Options +FollowSymLinks RewriteEngine on RewriteRule show_detail/id/(.*) show_detail.php?id=$1
  10. My script prints url's with a ? How can I eliminate the ? and return search engine friendly urls?
  11. I have a form and script that is used to collect information from users. There is one field that is url. There is one field that is email. I want to filter out scripts. I also only want to allow url in the url field and email in the email field. Is there an easy way to filter? I have tried several pieces of code to no avail. <?php $root = $_SERVER['DOCUMENT_ROOT']; include('/home/arts/public_html/shows/includes/config.db.php'); if ($link) { foreach ($_POST as $k => $v) { if (($k == "start_date") || ($k == "end_date") || ($k == "application_dead")) { $varray = explode("/",$v); $v = $varray[2] . "-" . $varray[0] . "-" . $varray[1]; } $v = "'" . addslashes($v) . "'"; if($k != "captcha_code") { $keys[] = $k; $vals[] = $v; } } $fields = implode(",", $keys); $values = implode(",", $vals); //$fields = "id," . $fields; //$values = "null," . $values; $sql = "INSERT into craft_shows ($fields) VALUES ($values)"; $result = mysql_query($sql,$link); if (!$result) { die('There was a problem with your submission. Refresh the page to try again'); } else { echo "Thank you for your submission.<br>"; echo "<a href=\"http://www.artsandcraftsnetwork.com/shows/\">Back to shows</a><br>"; echo "<a href=\"http://www.artsandcraftsnetwork.com/shows/shows_submit.php\">Submit another show</a>"; } } ?>
  12. I am not sure where to put a rel=nofollow tag in this line. echo "<a href='".( strpos( '://', $row['website'] ) ? '' : '' ).$row['website']."'>".$row['website']."</a>\n";
  13. Try this... And get a better date snippet. and start <?php on the beginning of the line. <HEAD> <TITLE>Welcome</TITLE> </HEAD> <BODY> <P>Hi, <?php $firstname = 'Ragena'; // PHP finishes here, now back to HTML ?> Your first name is <?php echo $firstname; ?>. </P> </BODY> </HTML>
  14. What??? I was looking for tips on where to find a logical captcha to use in my script. I don't know how that simple request has become convoluted to the point where someone could think anyone is looking to break codes to post spam. Yikes
  15. Does anyone know of a login script that uses authentication other than reCaptcha. Visitors to my site are having a real hard time reading the new fangled images that are now a part of reCaptcha. I only have one page to protect. Something with a question and answer challenge would be best.
  16. I took a antihistamine for hives and it made me extra stoopid. I forgot to echo $answer thanks for taking the time.
  17. The $row array is from the form that prints the output from the script. echo "<td class='det-B'>Electricity</td><td class='det-B'>"; echo $row['electricity']; echo "</td></tr>"; echo "<tr>"; I didn't design the form. I don't know why they are there.
  18. Would someone please take a look at this. I am trying to use a form to allow users to answer yes or no with radio buttons, and then print it out on another page. I can only get the script to print the number 1 no matter which button is selected. When I check the database the number 1 is recorded no matter which button is selected. In the top of the input form I have <input type='hidden' name='electricity' value='0'> In the body of the input form I have Electricity <input type='radio' name='electricity' value='0'>no <input type='radio' name='electricity' value='1'>yes And on the output page I have $electricity = $row['electricity']; if ($electricity == 1) { $answer = "YES"; } else { $answer = "NO"; } and echo $row['electricity']; I have been over and over this and can not discover my error. Thank you for looking.
  19. Ok then! That is a good thing to know. I really appreciate it. Thanks for the help
  20. The script works fine the way I posted it, without WHERE venue_state='NY' but I wanted to restrict the search to a single state, such as ny. I want the search to look only in rows that include NY. I tried to use WHERE venue_state='NY' in the query but since there is already an instance of WHERE there seems to be a conflict.
  21. sorry about the code brackets. Also I should have included the form. <table class="search-shows"> <tr><td> <form name="search" method="get" action="<?php $PHP_SELF?>"> <select name="state" VALUE="venue_state"> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="DC">District of Columbia</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select> <input type="text" name="find" value="Search for ..." onfocus="if (this.value==this.defaultValue) this.value='';" class="c-imput"/> <Select NAME="field" class="c-select"> <Option VALUE="venue_city"> City </option> <Option VALUE="venue_zip"> Zip Code </option> <Option VALUE="show_name"> Show Name </option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" value=">>" class="c-button" /> </form> </td></tr> </table>
  22. I have a search code for my site and I want to narrow the scope of the search with a drop down that will allow users to pick a state, ( the sql table includes a state field ) or set the script so that i will only search for results for a particular state. In the sql select I have tried every way of using WHERE venue_state='NY' but it will not work. I would really rather allow the users to select a state from a dropdown and then enter the search term - city, zip or venue name. Thank you for looking <?php include('config.db.php'); $find = trim($_GET['find']); $field = $_GET['field']; if($find && $field) { // we have search form submitted // check for values to prevent sql injection $valid_fields = array("venue_zip", "venue_city" , "show_name"); if(!in_array($field, $valid_fields)) die("Error: Invalid field!"); $rpp = 10; // results per page $adjacents = 4; $page = intval($_GET["page"]); if(!$page) $page = 1; $reload = $_SERVER['PHP_SELF'] . "?find=" . urlencode($find) . "&field=" . urlencode($field); echo "<h4>Search Results for $find</h4>\n"; $find = addslashes($find); $result = mysql_query("SELECT *, DATE_FORMAT(`start_date`, '%b %e, %Y') AS s_date FROM craft_shows WHERE $field LIKE '%$find%'"); if(mysql_num_rows($result) == 0) { echo "<p>0 matches found.</p>"; } else { echo "<table class='table7' cellpadding='2'>"; echo "<tr><td> </td><td><strong>Date</strong></td><td><strong>Show Name</strong></td><td><strong>City</strong></td><td><strong>Attendance</strong></td></tr>"; echo "<tr><td colspan='5'><hr class=\"hr2\"></td></tr>"; // count total number of appropriate listings: $tcount = mysql_num_rows($result); // count number of pages: $tpages = ($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number $count = 0; $i = ($page-1)*$rpp; while(($count<$rpp) && ($i<$tcount)) { mysql_data_seek($result,$i); $row = mysql_fetch_array($result); $id = $row['id']; echo "<tr><td>"; echo "<a href=\"/show_submits/show_detail.php?id=$id\">Details</a>"; echo "</td><td>"; echo $row['s_date']; echo "</td><td>"; echo $row['show_name']; echo "</td><td>"; echo $row['venue_city']; echo "</td><td>"; echo $row['venue_state']; echo "</td></tr>"; echo "<tr><td colspan='5'><hr class=\"hr3\"></td></tr>"; $i++; $count++; } echo "</table><br>"; function paginate_one($reload, $page, $tpages) { $firstlabel = "First"; $prevlabel = "Prev"; $nextlabel = "Next"; $lastlabel = "Last"; $out = "<div class=\"pagin\">\n"; // first if($page>1) { $out.= "<a href=\"" . $reload . "\">" . $firstlabel . "</a>\n"; } else { $out.= "<span>" . $firstlabel . "</span>\n"; } // previous if($page==1) { $out.= "<span>" . $prevlabel . "</span>\n"; } elseif($page==2) { $out.= "<a href=\"" . $reload . "\">" . $prevlabel . "</a>\n"; } else { $out.= "<a href=\"" . $reload . "&page=" . ($page-1) . "\">" . $prevlabel . "</a>\n"; } // current $out.= "<span class=\"current\">Page " . $page . " of " . $tpages . "</span>\n"; // next if($page<$tpages) { $out.= "<a href=\"" . $reload . "&page=" .($page+1) . "\">" . $nextlabel . "</a>\n"; } else { $out.= "<span>" . $nextlabel . "</span>\n"; } // last if($page<$tpages) { $out.= "<a href=\"" . $reload . "&page=" . $tpages . "\">" . $lastlabel . "</a>\n"; } else { $out.= "<span>" . $lastlabel . "</span>\n"; } $out.= "</div>"; return $out; } echo paginate_one($reload, $page, $tpages, $adjacents); } } ?>
  23. Thank you PFMaBiSmAd very much. This is working fine now. I tried to condense the code for the query but I did not have section grouped properly. I'm not convinced that I can learn this from a book. And thanks to all those who contributed and helped with this problem especially kenrbnsn and Pikachu2000. This thing is almost ready, just 2 more flaming hoops!
×
×
  • 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.