Jump to content

foevah

Members
  • Posts

    162
  • Joined

  • Last visited

    Never

Everything posted by foevah

  1. I am trying to do this tutorial: http://www.easykiss123.com/?p=32 I want to send a SMS to a T-Mobile mobile which is in the UK. This form I am making is for a restaurant so basically when a customer fills in the form the restaurant will get a text message saying someone has made an order. Right now the tutorail tells me to refer to this page to find the providers Email to SMS Gateway code: http://en.wikipedia.org/wiki/SMS_gateways I dont see T-Mobile UK and I have done some google searching but with no luck.. This is the line of code I need to edit correctly: $to = '07985669856@yourCellProviderGateway.com'; //add phone number as email here any ideas what the yourCellProviderGateway.com would be for T-Mobile uk?? If anyone knows a better tutorial then please point me in the right direction. I am also looking to modify this form so it puts all submitted entries into a database.
  2. Question is how can I echo data into a form (text area?) and then when the user submits the form it updates the records in the database? This sounds hard to me.. Are there any tutorials on this? I did a quick google search for 'php form text area echo' / other variations and nothing seems to appear. Is there a known saying for what I am trying to search for?
  3. slawrence10 > That makes perfect sense to me. Thanks for breaking it down. I do have some knowledge of MySQL databases and some PHP knowledge. Once I have created the database table and added all the records for the main image, content, title ect.. I then need to echo this data out onto the web page. I also need to have forms for each record which updates the database entries if the users edits and submits the form.. Question is how can I echo data into a form (text area?) and then when the user submits the form it updates the records in the database? This sounds hard to me.. Are there any tutorials on this? I did a quick google search for 'php form text area echo' / other variations and nothing seems to appear. Is there a known saying for what I am trying to search for? rhock_95 > course im using see and no tables.. I think you got confused when slawrance10 said table as in a database table..
  4. Hi everyone, I would like to a very simple CMS. Simple as in: The ability to edit one page - not a whole site. The content of the site will have main image which will be uploaded, resized and put into the database. This will then be displayed on the web page. The text in the content will also be editable via a CMS. This sounds simple but yet I have no idea on how to do this.. Please can someone help me achieve this? Are there any online tutorials that teach this 'simple' CMS or could someone here help me step by step on how to do this?
  5. Hi everyone, I would like to know how to output a .txt into a PHP page and then style the text that is inside the .txt file. For example lets say I have this in the .txt file: Then on my PHP page I would like the .txt file to be shown with styles like this: Hello my name is Mathew Please can someone help me? I have done some research but I have not had much luck in finding an exact solution.
  6. wolphie - yours doesnt work either. ok i have been given 3 different methods here and i cant get any to work :-\
  7. I replaced phpQuestioner's code with yours xyn and now the browser says: Can someone explain the isset() function that this tutorial im reading decides to miss out? Also is it possible for it to say you can't swear on the same page as the form instead of going to a new page then having to click back? So if the user enters an invalid email and swears in the feedback text area can it say invalid email and you can't swear underneath each field instead of it going to a new page?? I have tried using this swear word code but the browser gives me another error message: $swarewords= array(bad,mouth,mother,screw,off); if ($swarewords=!) { echo "no sware words were found."; } else { echo "You naughy person you!"; }
  8. I added your code above the mail() function and the browser gives me this message: This is the processfeedback.php with your code added: <?php //create short variable names $name=$HTTP_POST_VARS['name']; $email=$HTTP_POST_VARS['email']; $feedback=$HTTP_POST_VARS['feedback']; $toaddress = 'feedback@example.com'; $subject = 'Feedback from web site'; $mailcontent = 'Customer name: '.$name."\n" .'Customer email: '.$email."\n" ."Customer comments: \n".$feedback."\n"; $fromaddress = 'From: webserver@example.com'; $badwords = array("fuck","swearword"); // add each prohibited word in this array // repeat the IF condition below for each field you want to be filtered if (eregi('('.implode('|',$badwords).')', $feedback){ echo "HEY YOU ARE NOT ALLOWED TO SWEAR!"; exit; } // email address validation to check for specific symbols if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email)) { echo "PLEASE ENTER A VALID EMAIL ADDRESS!"; exit; } mail($toaddress, $subject, $mailcontent, $fromaddress); ?> <html> <head> <title>Feedback Submitted</title> </head> <body> <h1>Feedback submitted</h1> <p>Your feedback has been sent.</p> </body> </html> In this tutorial I am reading it says I have tried finding a tutorial on adding the isset() function to this feedback form but I can't find anything that will help me. Can someone explain how I can add isset() to this form please? I would also like to know why phpQuestioner's swear word filter and email validation doesnt work?
  9. I have this real simple form that I want to add validation checking to. So if the user enters in some swear words in the feedback and then they submit the form I wont it to say underneath the form HEY YOU ARE NOT ALLOWED TO SWEAR! I would also like to check if the user has entered a correct email using the @ sign. I am not sure how to do this. Please can someone help? <form method="post" action="processfeedback.php"> Your name: <br /> <input type=text name="name" size=40><br /> Your email address: <br /> <input type=text name="email" size=40><br /> Your feedback:<br /> <textarea name="feedback" rows=5 cols=30> </textarea><br /> <input type="submit" value="Send feedback"> </form>
  10. ok so i searched for bbcode and only my thread came up :-\
  11. Hi everyone I have built a php blog from a basic tutorial and it doesnt tell me how I can post a link with my blog entires. If I type www.phpfreaks.com it won't let the user click on the link. Please can someone help me add this function to my blog form? Below I will show you the code I have in my blog entry form and the view blog entries page. This is my blog form code: <?php $current_month = date("F"); $current_date = date("d"); $current_year = date("Y"); $current_time = date("H:i"); if (isset($_POST['submit'])) { $month = htmlspecialchars(strip_tags($_POST['month'])); $date = htmlspecialchars(strip_tags($_POST['date'])); $year = htmlspecialchars(strip_tags($_POST['year'])); $time = htmlspecialchars(strip_tags($_POST['time'])); $title = htmlspecialchars(strip_tags($_POST['title'])); $image = htmlspecialchars(strip_tags($_POST['image'])); $entry = $_POST['entry']; $password = htmlspecialchars(strip_tags($_POST['password'])); $entry = nl2br($entry); //checking for emptys if (strlen($_POST['title'])>0 && strlen($_POST['title'])<255 && strlen($_POST['entry'])>0 && strlen($_POST['entry'])<4000000000) { $title = (!get_magic_quotes_gpc()) ? mysql_real_escape_string($_POST['title']): $_POST['title']; $entry = (!get_magic_quotes_gpc()) ? mysql_real_escape_string($_POST['entry']): $_POST['entry']; $timestamp = $current_time; include "connect.php"; $password = (isset($_POST['password']))? 1:0; @mysql_connect($server, $connect, $pass) or die(__LINE__. mysql_error()); @mysql_select_db($database) or die(__LINE__. mysql_error()); //If the Submitbutton was pressed do: $uploaddir="./blog_images"; $filename = $_FILES['imagefile']['name']; $filename = renfilename($filename,$uploaddir); if ($filename != "") { chdir($uploaddir); if (preg_match('/(\.jpg)$/i', $filename)) { if (!file_exists($filename)) { if (move_uploaded_file($_FILES['imagefile']['tmp_name'], $filename)) { chmod($filename, 0755); $new_name = preg_replace('/_big/','_small',$filename); $sql = "INSERT INTO `php_blog` (`timestamp`,`title`,`entry`,`password`,`image`) VALUES (NOW(), '$title','$entry','$password','$new_name')"; $result = mysql_query($sql) or print("Can't insert into table php_blog.<br />" . $sql . "<br />" . mysql_error()); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><title>Blog entry form</title> <script type="text/javascript"> function addsmiley(string) { var newtext = string; document.addthread.entry.value += newtext; document.addthread.entry.focus(); return; } </script></head> <head> <form name="addthread" method="post" action="<?php echo $_SERVER['../PHP_SELF']; ?>" enctype="multipart/form-data"> <p><strong><label for="month">Date (month, day, year):</label></strong> <select name="month" id="month"> <option value="<?php echo "$current_month"; ?>"><?php echo "$current_month"; ?></option> <option value="January">January</option> <option value="February">February</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="September">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option> </select> <input type="text" name="date" id="date" size="2" value="<?php echo $current_date; ?>" /> <select name="year" id="year"> <option value="<?php echo $current_year; ?>"><?php echo $current_year; ?></option> <option value="2004">2004</option> <option value="2005">2005</option> <option value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> <option value="2009">2008</option> <option value="2010">2010</option> </select> <strong><label for="time">Time:</label></strong> <input type="text" name="time" id="time" size="5" value="<?php echo $current_time; ?>" /></p> <p><strong><label for="title">Title:</label></strong> <input type="text" name="title" name="title" size="40" /></p> <img src="../images/smileg.gif" width="15" height="15" onClick="addsmiley('')"> <img src="../images/wink.gif" width="15" height="15" onClick="addsmiley('')"> <img src="../images/bold.gif" onClick="addsmiley('[b][/b]')"> <img src="../images/italic.gif" onClick="addsmiley('[i][/i]')"> <p><strong><label for="password">Password protect?</label></strong><input type="checkbox" name="password" id="password" value="1" /></p> <p><textarea name="entry" cols="80" rows="20" id="entry"></textarea></p> <input type="file" name="imagefile"> <input type="submit" name="submit" value="Save"> </form> </head> </html> This is my view blog entry code: <?php include "connect.php"; @ mysql_connect($server, $connect, $pass) or die(__LINE__. mysql_error()); @ mysql_select_db($database) or die(__LINE__. mysql_error()); function smiley($content) { $find[] = ""; $replace[] = "<img src='../jecgardner/images/smileg.gif' alt='smile'/>"; $find[] = ""; //NEW SMILEY SEARCH $replace[] = "<img src='../jecgardner/images/wink_b.gif' alt='wink'/>";//NEW SMILEY REPLACE $find[] = "[b]"; //Look for bold tag $replace[] = "<span style='font-weight: bold;'>"; //Replace with span tag $find[] = "[/b]"; //Look for bold end tag $find[] = "[.code]"; //Look for code tag $replace[] = "<span style='background-color:#646464; color: white;'>"; //Replace with span tag $find[] = " [./code]"; //Look for code end tag $replace[] = "</span>"; //replace with end span echo str_replace($find, $replace, $content);//This always needs to be at the end of the function } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>James Gardner: Web Designer</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="title" content="James Gardner's university website" /> <script type="text/javascript" src="tooltip.js"></script> <link href="css/main.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main_text"> <?php function showinweb($val) { $val = nl2br($val); //return returns the value and ends execution of function, so any line below it is ignored return($val); } $page = (!isset($_GET['page'])) ? 1: $_GET['page']; // Define the number of results per page $max_results = 3; // Figure out the limit for the query based // on the current page number. $from = (($page * $max_results) - $max_results); // Perform MySQL query on only the current page number's results $sql = "SELECT id, DATE_FORMAT(timestamp, '%a.%b.%y') as dateAdded, title, entry, password, image FROM php_blog ORDER BY timestamp DESC LIMIT $from, $max_results"; $result = mysql_query($sql) or print ("Can't select entries from table php_blog.<br />" . $sql . "<br />" . mysql_error()); $i =1; while($row = mysql_fetch_assoc($result)) { echo "<div class='box1'>"; echo "<p class='blogtitle'> <span class='blogtit'>".showinweb($row['title'])."</span></p><br />"; echo "<br /><br />".smiley(showinweb($row['entry'])); echo "<img src=\"entry/blog_images/".showinweb($row['image'])."\" alt=\"\" class=\"thumb\"/>"; echo "<br />".showinweb($row['dateAdded']); } ?> </div> </body> </html> EDITED BY WILDTEEN88: Please use code tags ( )
  12. my question is: I want to make my contact form recognize if the user hasn't enter in all the fields. I want my form to say next to the fields that haven't got the correct info in them to say something like (after submission) "you have forgotten to enter your name.." or if they use a swear word in the message field I want it to say "no swearing allowed!" any ideas? can you show me some example code please
  13. Hi everyone I was just wondering how to make my contact form recognize if the user has actually entered any information into the fields. Right now if the user just clicks submit then an email will be sent to me without them having to enter any info into the fields.. Please can someone tell me how to prevent this? I would also like to know how I can filter the message field from letting the user enter in profanity? This is the HTML for my contact form: <form method="post" action="contact.php"><p class="class2"> your name:<br /> <input type="text" name="name" size="19"><br />your email:<br /> <input type="text" name="email" size="19"><br />subject:<br /> <textarea rows="5" name="message" cols="30"></textarea> <br /> <input type="submit" value="submit" name="submit"> </form> This is the PHP for my contact form: <?php if(isset($_POST['submit'])) { $to = "jecgard@gmail.com"; $subject = "Form Tutorial"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { } ?>
  14. ok its nearly working.. I would like to ask a few more questions: The footer on my homepage repeats Home twice (Home > Home) to make it say one Home I deleted $pagetitle="Home" from: <?php $pagetitle="Home"; include '/home/webmedia/public_html/jecgardner/breadcrumb.php'; ?> I dont know if this is cheating or acceptable to delete $pagetitle="Home" so it says Home once. I have left the pagetitle in place so you can see what I mean CLICK HERE and scroll to the footer to see what I mean! The contact page, year 2 and year 3 pages breadcrumb seem to be working fine However I have another problem when I try to add the breadcrumb to my comments page. This is because my comments page (journal.php) is inside a folder and not on the root directory. This is the code I added to the comments footer: <?php $pagetitle="Comments"; include '/home/webmedia/public_html/jecgardner[u]/entry/[/u]breadcrumb.php'; ?> This is what displays on the comments page: Home > jecgardner Comments Why is it showing jecgardner? I have tried linking the breadcrumb like I have on all the other pages and I have also added the same breadcrumb file into the entry folder which is shown above. Any ideas how to fix this please? I have one more question! Which is about the arrow (>) I have added in the breadcrumb.php file: echo ' > '.$pagetitle.' '; I was wondering how to not have the arrow appear on the home page? It looks ok on all the other pages Home > Contact.. But Home > wouldnt make sense? Is there a way around this?
  15. Ok I am using this on my homepage: <?php $pagetitle="Home"; include 'breadcrumb.php'; ?> on my and I am using this on my contact page: <?php $pagetitle="Contact"; include '/home/webmedia/public_html/jecgardner/breadcrumb.php'; ?> Both seem to be ok but each page now lists all the links in the footer that I have added into the breadcrumb.php file. On my home page I just want it to display: Home On the contact page footer I want it to look like this: Home > Contact Why does the home page and contact page both show all the links on the footer??: Home Contact Year 2 This is how the breadcrumb.phps looks like: <? $ul_id='crumbs'; $bc=explode("/",$_SERVER["PHP_SELF"]); echo '<li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/">Home</a></li>'; echo '<li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/contact.php">Contact</a></li>'; echo '<li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/year2.php">Year 2</a></li>'; while(list($key,$val)=each($bc)){ $dir=''; if($key > 1){ $n=1; while($n < $key){ $dir.='/'.$bc[$n]; $val=$bc[$n]; $n++; } if($key < count($bc)-1) echo '<li><a href="'.$dir.'">'.$val.'</a></li>'; } } echo '<li>'.$pagetitle.'</li>'; echo '</ul>'; ?>
  16. Ok I have changed this code in breadcrumb.php to the following: echo '<li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/">Home</a></li>'; echo '<li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/contact.php">Contact</a></li>'; echo '<li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/year2.php">Year 2</a></li>'; When you view my homepage there is no Home link in the footer? But when you view the contact page it lists all of these in the footer: # Home # Contact # Year 2 # Contact On the contact page it should just be Home > Contact Why is it showing links to all the other pages in the footer and why isnt there any link on my home page?
  17. This line works: <?php $pagetitle="Contact"; include '/home/webmedia/public_html/jecgardner/breadcrumb.php'; ?> And I added the same to my index (home) page which looks like this: <?php $pagetitle="Home"; '/home/webmedia/public_html/jecgardner/breadcrumb.php'; ?> When I view my index page I dont see any Home link on the footer? This is where I have put the include: <div id="footer_bl"></div> I have added the following lines to the breadcrumb.php file: echo '<ul id="'.$ul_id.'"><li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/contact.php">Contact</a></li>'; echo '<ul id="'.$ul_id.'"><li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/year2.php">Year 2</a></li>'; echo '<ul id="'.$ul_id.'"><li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/year3.php">Year 3</a></li>'; When you view the contact page on the footer it lists all the links (year2 and year3) but when you view the home page it doesn't even display the Home link??
  18. this is where the breadcrumb.php file is: http://www.newmedia.lincoln.ac.uk/jecgardner/breadcrumb.php it does exist.. It only says Home though.. Should I add this line to the breadcrumb file?: echo '<ul id="'.$ul_id.'"><li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/">Contact</a></li>'; and do the same for all the other pages on my site?
  19. I am trying to get breadcrumbs work on the footer of my site. I am using the code from this site: http://gr0w.com/articles/code/php_br...links_creator/ This is how my breadcrumb.php code looks like: <? $ul_id='crumbs'; $bc=explode("/",$_SERVER["PHP_SELF"]); echo '<ul id="'.$ul_id.'"><li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/">Home</a></li>'; while(list($key,$val)=each($bc)){ $dir=''; if($key > 1){ $n=1; while($n < $key){ $dir.='/'.$bc[$n]; $val=$bc[$n]; $n++; } if($key < count($bc)-1) echo '<li><a href="'.$dir.'">'.$val.'</a></li>'; } } echo '<li>'.$pagetitle.'</li>'; echo '</ul>'; ?> I am not sure if I should paste this line twice but change Home to Contact: echo '<ul id="'.$ul_id.'"><li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/">Contact</a></li>'; On my index.php page I have put the following include code on my footer: <?php $pagetitle="Home"; include("newmedia.lincoln.ac.uk/jecgardner/breadcrumb.php"); ?> I have put the same line above on my contact.php page but changed "Home" to "Contact" <?php $pagetitle="Contact"; include("newmedia.lincoln.ac.uk/jecgardner/breadcrumb.php"); ?> When I view my site the browser gives me this error: Please can someone help me fix this!?
  20. no answers? neither mathguard or captcha works on my comments form
  21. I have also tried adding this but it still doesnt work if (empty($_POST['name']) || empty($_POST['email']) || empty($_POST['comment']) || empty($_POST['mathguard_answer'])) { die("You have forgotten to fill in one of the required fields! Please make sure you submit a name, e-mail address and comment."); }
  22. this is the same problem i am experiencing with GuiltyGear's captcha.... @ Azu - I can probably add another column to my comments table with tinyint default 0. This is how my blog comments table currently looks like without adding a new column: I have a page called editcomments.php which lets me see all the comment entries and I can then click on each comment entry and edit or delete each one seperately. How would I go about determining if an entry is 0 or 1? This method comes across complicated
×
×
  • 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.