Jump to content

diode

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Everything posted by diode

  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
  15. Oh yeah, forgot to add, that I tried searching the topics on here, and didn't find what I was looking for. diode
  16. Hello, What I am making is an account registration part of my website. The registration form works and it submits it to the next page and all that. But on the page it submits it to, I'm making it so that it inserts a row into a table using MySQL and adds them to the users table so that they can log in and use the site and stuff. The variables I'm using on this initial account creation are: $firstname $lastname $acctname $password $email I want to send them an email from the page that receives the form, to show them their account details, and provide a link for them to click on to activate the account. But I can't get the email sender thing to work. I'm sure it's probably something easy, but I couldn't find it in the PHP Manual that came with my php. Thanks in advance :), diode
  17. Ok I think I get it now. damn it's late. I'll have to try it tomorrow, er, later on today. Thanks :), diode
  18. If the session_start() function must be located near the top of the code, then when a user goes to the login page, the page would automatically start the session even if he/she entered invalid log-in information. I was going to do a conditional if statement and start the session if the user entered correct and valid log-in information, but alas, this cannot be done because it must be near the top of the page. So my question to you is this, how would you prevent a user from logging in, or starting a session, whichever it technically is, if he/she enters invalid log-in information? Thanks :), diode
  19. I would suggest simplifying your value checking ($_POST etc) by putting $thisisavariablename=$_POST['thisisavariablename']; right after the "$company='Wealth Power Freedom';" line. This assigns the value of whatever was in the form field to $thisisavariablename obviously, but it makes it easier to do conditional checking on it later on. Do this for any form field that you want to send back to this page. Oh, and make sure that the form "action" page is the same filename as the one that you got your code from if you want it to work. Hope this helps, :) diode
  20. That will do nothing to pass values from page to page...and I forgot to say that I have that line there. Thanks, :) diode
  21. Oh yeah, forgot, make sure that line is between the first <?php and the ?> tag, since the line I suggested is php code. Hope it helps, :) diode
  22. Try putting an echo statement before the line, such as: [code] echo '<form name="thisForm" method="post" action="<?= $filename.$extension ?>#status-message" onSubmit="return checkForm()">';[/code]
  23. Hello, How should I pass the value of the status of the user's account that is signed in (integer), the account number of the logged in account (integer), and a couple other integer variables if I don't want them to be able to see that they are being passed from page to page? I don't want them in the url. How do most messageboards keep track of information on logged-in sessions such as these, so it will say Welcome <acctname>? Or keep track of the theme of the page layout, order of messages that appear on the page, etc.? And if you suggest cookies, can you please give an example of how it's done...you should know that I have spent hours studying the php manual's examples on registering session variables or something, and I'm still confused, it's not working. And just so you know: PHP Version 4.4.1 Darwin PowerMac-G4.local 8.8.0 Darwin Kernel Version 8.8.0: Fri Sep 8 17:18:57 PDT 2006; root:xnu-792.12.6.obj~1/RELEASE_PPC Power Macintosh Thanks in advance! :) diode
  24. Another advantage to the method I was trying to do would be that I could make each topic its own table, and then to keep the names different, I could just automaticaly increment the topic id. Again, if I am very wrong on this whole thing, please enlighten me on this. Thanks :D, 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.