Jump to content

diode

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

diode's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello, I'm trying to make a script in which I want to use variables to store the output of: date +%m as well as date +%d and date +%Y. Basically what the goal is, is I want/need to learn how to store the output of commands in variables in shell scripts. Nothing I try works. I am going to have a cron job execute at 12:00 am every day. The cron job will execute a batch file which in turn executes a mysql script. I have a message board, and I want everyone's board points to increase by 1 if they have posted during the day that just ended. I'm going to have a special table that contains their userid and 3 integer fields for month, day, and year for the date they posted. I need mysql to query this table every day at 12:00 am. I need mysql to query this table and return every record for the previous day, such as current date minus one. The reason I want it to do arithmetic to find if they posted during the previous day is because if I merely add a record to this table when they post for the first time during a day, and automatically update a user's points total if a record containing their userid was found, somebody could possibly post a message like at 12:01 am or something BEFORE the query is done running, and either update this person who posted during the day AFTER the one I am checking for, or actually delete this entry if the person posted after the update query, and before the query that will delete all the users' records for the previous day, thereby treating it as if they had posted during the previous day. Then their record would be gone in the table, and if they don't post again for that day, their points wouldn't get updated during the next cron job. It's difficult to explain, but the explanation is more difficult than the concept actually is. If anyone could provide help, or simple scripts to show me how this is done, I'd greatly appreciate it. I know it can't be that difficult really, but sometimes little things are more annoying and elusive than bigger things. Thanks again in advance, diode
  2. Oh I forgot to add this. The problem seems to be that the query has to be able to take information or parameters from the criteria you choose so it knows which tables to select from and join. Thanks :) diode
  3. Hello, I want to write a report or form or something in which you can specify a year or table name, and then it goes and searches that table for that year. I took Access in college several years ago, but we never designed anything that let you type in data that the report or form used in order to determine which table to search. I was thinking about using a combo box or list box and then put in the years in that so it knows what to select. The place I work for wants me to do this, and I'm not even sure it's possible. I hate to make this topic because the board is MSSQL, but that was the closest I could find here. Sorry about the inconvenience. But anyway, I googled, searched the Help in Access, and all resources at my disposal, but I am not finding anything, and I was wondering if anybody knew anything about this. Thanks lol :) diode
  4. Wow, thanks for the info SMC. I'm honorable and won't take advantage of your site since you provided me free and valuable information. So then my isp is preventing me from sending the emails? :( diode
  5. Well here's my code, and I still can't send emails. [code] <?php $email = $_POST['email']; $fromaddress = "do-not-reply@myserveripaddress"; $eol="\r\n"; $mime_boundary=md5(time());  $headers .= 'From: Boards<'.$fromaddress.'>'.$eol;   $headers .= 'Reply-To: Do Not Reply<'.$fromaddress.'>'.$eol;   $headers .= 'Return-Path: Boards<'.$fromaddress.'>'.$eol;    // these two to set reply address   $headers .= "X-Mailer: PHP v".phpversion().$eol;          // These two to help avoid spam-filters   # Boundry for marking the split & Multitype Headers   $headers .= 'MIME-Version: 1.0'.$eol;   $headers .= "Content-Type: multipart/related; boundary=\"".$mime_boundary."\"".$eol; $subject = "Account registration"; $msg = "Thank you for registering for the message boards.$eol $eol---------------------------------$eol Here is your account information:$eol First name:\t$firstname $eol Last name:\t$lastname $eol Account name:\t$acctname $eol Password:\t$password $eol Email address:\t$email\n--------------------------------------------$eol $eol To activate your account, click this link, or enter it in your browser's address bar and go to it.\t\t pagename.php $eol $eol Observe reasonable conduct and enjoy the message boards!"; ini_set(sendmail_from,$fromaddress);  // the INI lines are to force the From Address to be used ! mail($email, $subject, $msg, $headers); ini_restore(sendmail_from); echo " A registration email has been sent to the email address you specified. To activate your account, you must check your email and click on the link provided. Thank you and enjoy the message boards."; ?> [/code] It turns out I do have sendmail installed. SMTP is set to localhost. smtp_port is 25 in phpinfo(). Is it even possible for this to work? lol... Thanks :), diode
  6. Wow do I feel stupid...I forgot PHP was like its own site...:P
  7. Not yet. I'm going to do that now. diode
  8. Sorry to everyone who I haven't responded to. I was out of town last night and had to work today. It's my own personal server in my room. It is a 400 mhz Power Mac G4 running MAMP. Mac OS X 10.4.8, Apache, PHP, and MySQL. I get no error message. It acts like it has sent the mail, and yet I receive nothing. In the "From" field, I don't know what to put. How would I check to see if I have an email daemon running? I can't remember the unix command to do it. This is, of course, if I really need an email daemon. Do I have to have a working email address to send the data? And does it have to be a daemon on the server sending it? Thanks a lot for your time :), diode
  9. I have tried everything suggested here, and it's still not working. What are the requirements in order to email information from a php page to somebody? For example, do I need certain daemons running, other things installed, etc. Thanks :), diode
  10. Hey thanks, Ken. It now posts the complete message to the message list. But whenever there is a ' it still puts a slash before it. How would the pros make a message preview screen before deciding to actually post the message? lol Here is my code now: [code]<?php session_start(); $boardno=$_GET['boardno']; $topicno=$_GET['topicno']; $message = nl2br($_POST['message']); $msgpreview = $message; $sig = $_SESSION['signature']; echo "message: <br>$message<br><br>"; echo "msgpreview: <br>$msgpreview<br><br>";                 if ($message == '')                   {                         echo "<form action='try.php?boardno=$boardno&topicno=$topicno' method='post'>";                           echo "Type your message below: <br><br>";                           echo "<textarea name='message' rows=20 cols=80 wrap>\n\n---\n$sig</textarea>";                           echo "<p><input type='submit'                  value='Preview'/> ";                           echo "<input    type='reset'  name='reset'    value='Reset'>";                         echo "</form>";                   } else                       {                             echo "<form action='msgredir.php?boardno=$boardno&topicno=$topicno' method='post'>"; //                                  echo "$msgpreview"; //                                  echo "msgpreview: <br>".strip_tags($msgpreview)."<br><br>";                                   echo "stripslashes($msgpreview)"; //                                  echo "<input type='hidden' name='message' value='$stripslashes($message)'/>";                                 echo "<input type='hidden' name='message' value='" . htmlentities($message,ENT_QUOTES) . "'/>";                                 echo "<input type='submit'                  value='Post message'/>";                             echo "</form>";                                 echo "<form action='try.php?boardno=$boardno&topicno=$topicno' method='post'>";                                   echo "Type your message below: <br><br>";                                   echo "<textarea name='message' rows=20 cols=80 wrap>$message</textarea>";                                   echo "<p><input type='submit'                  value='Preview'/> ";                                   echo "<input    type='reset'  name='reset'    value='Reset'>";                                 echo "</form>";                     } ?> [/code] Thanks :), diode
  11. It still didn't work. It's doing the same thing. Are forms even the correct way to go about doing this? Here is my code now: [code]<?php session_start(); $boardno=$_GET['boardno']; $topicno=$_GET['topicno']; $message = nl2br($_POST['message']); $msgpreview = $message; $sig = $_SESSION['signature']; echo "message: <br>$message<br><br>"; echo "msgpreview: <br>$msgpreview<br><br>";                 if ($message == '')                   {                         echo "<form action='try.php?boardno=$boardno&topicno=$topicno' method='post'>";                           echo "Type your message below: <br><br>";                           echo "<textarea name='message' rows=20 cols=80 wrap>\n\n---\n$sig</textarea>";                           echo "<p><input type='submit'                  value='Preview'/> ";                           echo "<input    type='reset'  name='reset'    value='Reset'>";                         echo "</form>";                   } else                       {                             echo "<form action='msgredir.php?boardno=$boardno&topicno=$topicno' method='post'>";                                 echo "msgpreview: <br>".strip_tags($msgpreview)."<br><br>";                                 echo "<input type='hidden' name='message' value='$message'/>";                                 echo "<input type='submit'                  value='Post message'/>";                             echo "</form>";                                 echo "<form action='try.php?boardno=$boardno&topicno=$topicno' method='post'>";                                   echo "Type your message below: <br><br>";                                   echo "<textarea name='message' rows=20 cols=80 wrap>$message</textarea>";                                   echo "<p><input type='submit'                  value='Preview'/> ";                                   echo "<input    type='reset'  name='reset'    value='Reset'>";                                 echo "</form>";                     } ?>[/code] I really appreciate it, diode
  12. It's not working. Does this work like sending a form to email? Or do I need an email daemon running on my server? The browser does not show any errors, but I do not receive any email. Thanks, diode
  13. Hello, I had this working, and I accidentally changed some things, thinking it was a different file, and saved it, now I'm stuck. What I'm trying to do is fix my page where it is supposed to let you type your message, then when you click on 'Preview', it loads the same page, only with a table cell containing the message you just typed. The problem is, when you type something with special characters in it, such as, "I'm posting this message.", when you click on 'Preview', it will show, "I/'m posting this message." And when I go to post it after I preview it, the message list shows it as, "I/'m" and that's it. I've spent hours trying to figure it out. Here is my the code portion that deals with posting a message: [code] <?php session_start(); $boardno=$_GET['boardno']; $topicno=$_GET['topicno']; $message = nl2br($_POST['message']); $msgpreview = $message; $sig = $_SESSION['signature']; echo "message: <br>$message<br><br>"; echo "msgpreview: <br>$msgpreview<br><br>";                 if ($message == '')                   {                         echo "<form action='try.php?boardno=$boardno&topicno=$topicno' method='post'>";                           echo "Type your message below: <br><br>";                           echo "<textarea name='message' rows=20 cols=80 wrap>\n\n---\n$sig</textarea>";                           echo "<p><input type='submit'                  value='Preview'/> ";                           echo "<input    type='reset'  name='reset'    value='Reset'>";                         echo "</form>";                   } else                       {                             echo "<form action='msgredir.php?boardno=$boardno&topicno=$topicno' method='post'>";                                   echo "$msgpreview";                                   echo "<input type='hidden' name='message' value='$message'/>";                                 echo "<input type='submit'                  value='Post message'/>";                             echo "</form>";                                 echo "<form action='try.php?boardno=$boardno&topicno=$topicno' method='post'>";                                   echo "Type your message below: <br><br>";                                   echo "<textarea name='message' rows=20 cols=80 wrap>$message</textarea>";                                   echo "<p><input type='submit'                  value='Preview'/> ";                                   echo "<input    type='reset'  name='reset'    value='Reset'>";                                 echo "</form>";                     } ?>[/code] Obviously I cut the code down to simply things, but it does the same thing. Any way to get this looking normal? Thanks in advance :), diode
  14. This is what I use: $con = mysql_connect('localaddress', 'account@server', 'password')  or die('Could not connect: ' . mysql_error()); mysql_select_db('test', $con) or die('Could not select database'); Try making it like that, but of course replace what is in single quotes to fit your computer. Hope it helps :), diode
×
×
  • 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.