Jump to content

Tandem

Members
  • Posts

    251
  • Joined

  • Last visited

    Never

Everything posted by Tandem

  1. The following lines are writing entries into a text file. [code]$line = date("m.d.y") . "|" . $poster . "|" . $_POST['news']; fwrite($fp, $line); [/code] The problem is i'm getting this output in the text file: [quote] 07.18.06|Tandem|07.18.06|Tandem|Some sort of message [/quote] The date and my name are being written into the text file twice and i don't know why. I guess it doesn't really matter that much as i can work around it if need be, but for the sake of cleanliness i'd like to fix it, so i'd be grateful if somebody could point out the reason. Thanks in advance -Tandem
  2. What about if i want the delay to be in minutes or hours?
  3. Ok, on my website, i want my members to only be able to do certain things after a time limit has passed. For example, i only want them to be able to submit a certain form once a day. How do i go about doing that? I couldn't google it bbecuse i didn't know what it would be called. Thanks in advance. -Tandem
  4. I'm writing a script so that members can change their passwords. I'm starting the script by checking the form for errors. The first error i'm checking for is empty fields. This below script does this semi-successfully. It prints out that an error has occurred and what the errors are depending on which field is empty. The problem is that it always prints out that there has been an error, even if all the feilds have been filled in. [code]<?php session_start(); include 'db.php'; include 'session_check.php'; $current_pass = $_POST['current_pass']; $new_pass = $_POST['new_pass']; $confirm_pass = $_POST['confirm_pass']; //Checking for empty fields if ((empty($current_pass)) || (empty($new_pass)) || (empty($confrim_pass))) { echo '<div class="error">*The following errors occurred:</div>' . "\n"; if (empty($current_pass)) { echo '<div class="error">You did not specify your Current Password</div>' . "\n"; } if (empty($new_pass)) { echo '<div class="error">You did not specify your New Password</div>' . "\n"; } if (empty($confirm_pass)) { echo '<div class="error">You did not Confirm your New Password</div>' . "\n"; } include 'Account_Manager.php'; exit(); } ?>[/code] Can any tell me why, and how to fix it? Thanks in advance. -Tandem
  5. Still getting an error. I had it with the syntax you said, before, but i changed it to the '<<HERE' etc in the hope that it would somehow fix the problem. I'm getting a different error now though, perhaps you might be able to tell whats wrong from that. It's: Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\Program Files\Apache Group\Apache2\htdocs\Train_station.php on line 103 Heres a few line of the relevant code: [code] if (!empty($travel)){ $location_check = mysql_query("SELECT LOCATION FROM USERS WHERE USERID='$_SESSION[userid]'"); $location = mysql_result($location_check,0); print "You are currently in $location\n"; switch ($travel){ case "NY": $sql = mysql_query("UPDATE USERS SET LOCATION='New York' WHERE USERID='$_SESSION[userid]'"); /*(line 103)*/echo "<div class="whitetext" align="center">Welcome to New York!</div>\n"; break; [/code]
  6. I've since changed that, but the error is still happening...
  7. I'm having a problem using switch/case. I've probably missed something obvious, but i can't work it out for the life of me. I'm getting this error: Parse error: parse error, unexpected T_SL in C:\Program Files\Apache Group\Apache2\htdocs\Train_station.php on line 97 Here's the relevant code from the page: [code] <?php $travel = $_POST['travel']; if (empty($travel)) { travel_form(); } if (!empty($travel)){ switch ($travel){ case "NY": $sql = mysql_query("UPDATE USERS SET LOCATION='New York' WHERE USERID='$_SESSION[userid]'"); /*(line 97)*/print <<<HERE <div class="whitetext" align="center">Welcome to New York!</div>\n HERE; break; case "LA": $sql = mysql_query("UPDATE USERS SET LOCATION='Los Angeles' WHERE USERID='$_SESSION[userid]'"); print <<<HERE <div class="whitetext" align="center">Welcome to Los Angeles!</div>\n HERE; break; case "CH": $sql = mysql_query("UPDATE USERS SET LOCATION='Chicago' WHERE USERID='$_SESSION[userid]'"); print <<<HERE <div class="whitetext" align="center">Welcome to Chicago!</div>\n HERE; break; case "HN": $sql = mysql_query("UPDATE USERS SET LOCATION='Houston' WHERE USERID='$_SESSION[userid]'"); print <<<HERE <div class="whitetext" align="center">Welcome to Houston!</div>\n HERE; break; case "PH": $sql = mysql_query("UPDATE USERS SET LOCATION='Philadelphia' WHERE USERID='$_SESSION[userid]'"); print <<<HERE <div class="whitetext" align="center">Welcome to Philadelphia!</div>\n HERE; break; case "DT": $sql = mysql_query("UPDATE USERS SET LOCATION='Detroit' WHERE USERID='$_SESSION[userid]'"); print <<<HERE <div class="whitetext" align="center">Welcome to Detroit!</div>\n HERE; break; default: print "Error!\n"; } travel_form(); } ?> <?php function travel_form { print <<<HERE <table cellpadding="0" cellspacing="0" width="30%" align="center"> <tr><td class="tablehead" colspan="2">TRAVEL TO</td></tr> <form type="POST" action="train_station.php"> <tr><td class="radio"><input type="radio" name="travel" value="NY"></td><td class="topcity">New York</td></tr> <tr><td class="radio"><input type="radio" name="travel" value="LA"></td><td class="city">Los Angeles</td></tr> <tr><td class="radio"><input type="radio" name="travel" value="CH"></td><td class="city">Chicago</td></tr> <tr><td class="radio"><input type="radio" name="travel" value="HN"></td><td class="city">Houston</td></tr> <tr><td class="radio"><input type="radio" name="travel" value="PH"></td><td class="city">Philadelphia</td></tr> <tr><td class="radio"><input type="radio" name="travel" value="DT"></td><td class="city">Detroit</td></tr> <tr><td class="s" colspan="2"><input type="submit" name="submit" value="Travel!"> </form> </table> HERE; } ?> [/code] In case you're wondering what on earth is going on, i'm building a text-based MMO. This is my project to help me learn php, and i kinda always wanted to do it too :P. This is the relevant code on the train_station.php page. This page changes the user's location to a different city in the game. I've labeled line 97 for you. Would appreciate it if somebody could point out to me what i've done wrong. Thanks in advance -Tandem
  8. How about if the username and pasword do not match, print an error message and then include'login page url here; ...
  9. Ok here goes... I want to be able to stop people from registering usernames with certain characters in them (* for example), on my website by giving them an error message if they have used any of the certain characters that i would consider illegal. Is there a way to do this? Another similar question, but for something totally different: I have a form that i only want the user to be able to send numbers, or they get an error message. How would i do this? i would be grateful if somebody could help me out on both counts :) Thanks in advance. -Tandem
  10. Awesome, I couldn't have asked for btter help! Thankyou.
  11. Ok, i'm mysql_query()'ing and then mysql_result()'ing, so that i can print values from my database onto my site. One of these is an integer. I want there to be commas in the integer if possible. For example: instead of 1000000 - it would be 1,000,000. Is this possible? if so how? Thanks in advance. -Tandem
  12. Ok, here we go... Lets say php is our e-mail client for sending e-mail, much like Outlook Express or something like that. The client sends the e-mail to a smtp server, which in turn sends the e-mail to the desired e-mail address. To send e-mail with php you need to set up an smtp server on your computer. Just search google, pick one and download/install it, then configure it, and then edit the mail function in php.ini to match it
  13. Do you have php set up to work with a mail server? If not the mail function is useless.
  14. I'm pretty sure that port 25 is blocked :( The aol smtp server requires AUTH and i don't know how to use this. When i send the mails they are at least recieved by the server even though they cannot be sent to the e-mail address, so i should be able to successfuly build and test my site, which is all i'm looking to do atm. Thanks for your help amyway Tom!
  15. I've tried quite a few, and they've all sucked.  :-\ Was hoping someone might reccommend a good one...
  16. Ok, i want to be able to use the mail function, so i need to set up a mail server (correct?). I would appreciate it if somebody could reccomend me a (free) mail server that's averagely simple to configure and if possible some simple instructions to get it working would be great. Please only reply if know about this area from experience. Thanks in advance. -Tandem
  17. Ok i managed to stop the errors, but the e-mails aren't being recieved. Surely thats a problem with the server? I'm not really sure, but i've decided that i don't like PostCast and i'm uninstalling it anyway. I'd appreciate it if you could talk me through setting up Mercury :)
  18. I tried that, and just about everything else i could think of and i keep getting: [code]Warning: mail() [function.mail]: SMTP server response: 500 please set from & to first... in C:\Program Files\Apache Group....etc.[/code] Any suggestions? :/
  19. I just downloaded PostCast mailserver, and configured php.ini to work with it, but now i'm getting this error: "Warning: mail() [function.mail]: SMTP server response: 500 please set from & to first... in C:\Program Files\Apache Group\Apache2\htdocs\register.php on line 83 Your membership information has been mailed to your email address! Please check it and follow the directions! " Here is lines 81 & 82: [code]    mail($email, $subject, $message,          "From: Tandem<Tandem@localhost>\n");  [/code] Any idea why this is happening? And would you reccommend mercury instead of this?
  20. I had problems trying to run the latest version of apache(2.2.2 at the time(ithink)) with php5. Then i tried apache 2.0.58 and it was pretty simple.
  21. Ok, i'm currently building a website (i'm hosting it on an apache webserver on my computer whilst i complete and test it (if that matters)). When users register their account they are sent an e-mail containing activation details for their account. I'm having trouble trying to get the e-mails to actually send. I'm trying to send the e-mails through my AOL e-mail account for the time being until i complete my site and host it somewhere else. I changed php.ini correctly, but then i realised that AOL requires authentication to send the e-mails. Apparently the mail function doesn't support this....(correct me if i'm wrong). Can anyone suggest a possible solution for me? It doesn't matter what it is as long as the e-mails send :) Thanks -Tandem
×
×
  • 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.