Jump to content

digitalgod

Members
  • Posts

    374
  • Joined

  • Last visited

    Never

Everything posted by digitalgod

  1. sure thing admin sure thing admin.php it's not letting me post the part that uploads the images.... [code] case "newnews";         $process=$_POST['process'];         $num_news = $_POST['num_news'];         if ($process == "yes") {         $today = date("Ymd");                                $result=mysql_query("SELECT * FROM ".$prefix."news WHERE date='$today") or die(query_error());         $row=mysql_fetch_array($result);           if ($row['id'] = "") {           $tmpl->add_template("news_no");           }           else {               $qtmp = array();             for ($i=1;$i<=$num_news;$i++) {                 $qtmp[] = "content ='" . mysql_real_escape_string(trim(stripslashes($_POST['news_content'.$i.'']))) . "'";                 $query = "INSERT INTO ".$prefix."news set " . implode(', ',$qtmp);                   $result = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());             }           $tmpl->add_template("news_success");           }         }         else {         $tmpl->add_template("news_form");         }       break; [/code] and news_form.php [code] <div id="article"> <style>     .lbl {         display: block;         width: 35%;         float: left;         font-weight: bold;     }     .bx {         display: block;         width: 80%;     }     .txtinp {         width: 100%;     }     </style> <?php     $tmp = array();     $tmp[] = '<form action="admin.php?a=newnews" method="post" name="form" id="form">';     if (!isset($_POST['num_news'])) {         $tmp[] = 'Number of news: <select name="num_news">';         for($i=1;$i<=10;$i++)             $tmp[] = '<option value="' . $i . '">' . $i . '</option>';         $tmp[] = '</select>';         $tmp[] = '<br><br><input type="submit" name="submit" value="Set number of news">'; }     else {         $tmp[] = '<input type="hidden" name="process" value="yes" />';         $tmp[] = '<input type="hidden" name="size_limit" value="500" />';         for ($i=1;$i<=$_POST['num_news'];$i++) {             $tmp[] = '<span class="lbl">News #' . $i . '<br><br> Upload Pic:</span><br><br><span class="bx"><input type="file" class="txtinp" name="file[' . $i . ']"></span><br>';             $tmp[] = '<span class="lbl">Content:</span><span class="bx"><textarea class="txtinp" rows=10 cols=60 name="news_content[' . $i . ']"></textarea></span><br>';             $tmp[] = '<hr>'; }         $tmp[] = '<input type="submit" name="submit" value="Submit News">';     }     $tmp[] = '</form>';     echo implode("\n",$tmp)."\n";     ?> </div> [/code]
  2. [!--quoteo(post=382391:date=Jun 10 2006, 10:19 PM:name=kenwvs)--][div class=\'quotetop\']QUOTE(kenwvs @ Jun 10 2006, 10:19 PM) [snapback]382391[/snapback][/div][div class=\'quotemain\'][!--quotec--] I purchased an auction script that uses the extension php on the files. I know absolutely nothing about this, but I have used HTML in the past. I am trying to insert a couple of pay per click sites on a page, and have put the proper code in, and one appears, or both will appear, but I can't get one to go on the left side of the page, and one on the right. They appear one on top of the other. I have tried using <align="left" and <div align="left" and different variations, just trying anything. I am not even positive where to put the command. These two codes use <script type='text/javascript'> Hope you can help me with this, as I am sure the time has come that I will need to learn and understand atleast the basics of this language. Thanks, Ken [/quote] mind posting some code? Try making a table with 3 columns, putting one in the first column and aligning it to the left and the second in the 3rd column and aligning it to the right.
  3. ok I think I found how [code] $num_news = $_POST['num_news']; $qtmp = array();             for ($i=1;$i<=$num_news;$i++) {                 $qtmp[] = "content ='" . mysql_real_escape_string(trim(stripslashes($_POST['news_content'.$i.'']))) . "'";                 $query = "INSERT INTO ".$prefix."news set " . implode(', ',$qtmp);                   $result = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());             } [/code] but it's giving me a database error but "content" exists so I don't know what's the problem
  4. one more thing, I can't seem to process the form... [code] qtmp = array();             foreach($_POST as $k => $v)                 switch($k) {                     case 'news_content':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "content ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                               } [/code] how can I collect all the info if there's more than 1 story and would it be better to store each story in it's own row, linked by their date or put everything in the same row and just seperate them with | or something like that?
  5. thank you very much Ken :) I honestly don't know why I missed that :P
  6. thanks Ken, after a few mods it works perfectly for what I need. There's only one problem though, I need to add a hidden field but in the 2nd part of the form because it submits to admin.php?a=newnews and if the hidden field = yes the admin.php processes it I tried placing an echo with the hidden process but that didn't work so whenever it submits it just goes back and asks how many stories.. Any ideas what I can change? [code] <?php     $tmp = array();     $tmp[] = '<form action="admin.php?a=newnews" method="post" name="form" id="form">';     if (!isset($_POST['num_news'])) {         $tmp[] = 'Number of news: <select name="num_news">';         for($i=1;$i<=10;$i++)             $tmp[] = '<option value="' . $i . '">' . $i . '</option>';         $tmp[] = '</select>';         $tmp[] = '<br><br><input type="submit" name="submit" value="Set number of news">'; }     else {         echo '<input type="hidden" name="process" value="yes" />';         for ($i=1;$i<=$_POST['num_news'];$i++) {             $tmp[] = '<span class="lbl">News #' . $i . '<br><br> Upload Pic:</span><br><br><span class="bx"><input type="file" class="txtinp" name="file[' . $i . ']"></span><br>';             $tmp[] = '<span class="lbl">Content:</span><span class="bx"><textarea class="txtinp" rows=10 cols=60 name="news_content[' . $i . ']"></textarea></span><br>';             $tmp[] = '<hr>'; }         $tmp[] = '<input type="submit" name="submit" value="Submit News">';     }     $tmp[] = '</form>';     echo implode("\n",$tmp)."\n";     ?> [/code]
  7. hey guys, just started making a news system. What I'm trying to do is being able to tell the script how many "stories" I want and it displays the appropriate number of input boxes. so for example, I need 3 stories it will automaticly make 3 input boxes, if I need 5 it will make 5 input boxes, etc. I'd also like to be able to have it on the same form, without having to create 2 seperate forms. Any ideas on how I can do this?
  8. [!--quoteo(post=381305:date=Jun 8 2006, 05:49 AM:name=sab)--][div class=\'quotetop\']QUOTE(sab @ Jun 8 2006, 05:49 AM) [snapback]381305[/snapback][/div][div class=\'quotemain\'][!--quotec--] The query still not updating logout_datetime column :( +--------+----------+---------------------+---------------------+ | log_id | username | login_datetime | logout_datetime | +--------+----------+---------------------+---------------------+ | 1 | abc | 2006-06-07 17:10:35 | 0000-00-00 00:00:00 | | 2 | abc | 2006-06-07 17:11:49 | 0000-00-00 00:00:00 | +--------+----------+---------------------+---------------------+ 2 rows in set (0.05 sec) any suggestions? [/quote] just replace the part that says WHERE id = 1 with WHERE username = and that variable or session you used to store the username something like mysql_query("UPDATE access_log SET logout_datetime = date('Y-m-d h:i:sa', time()) WHERE username = '$username' ");
  9. [!--quoteo(post=380999:date=Jun 7 2006, 10:19 AM:name=sab)--][div class=\'quotetop\']QUOTE(sab @ Jun 7 2006, 10:19 AM) [snapback]380999[/snapback][/div][div class=\'quotemain\'][!--quotec--] I have solved half of the problem, I have managed to insert login time but how do i insert logout time can any1 help plzzz. thanks in advance here is my logout code: session_start(); $_SESSION['logged_in'] = 0; setcookie('login_cookie', false, time() - 3600, '/secure/', 'index.php'); mysql_query("update access_log set logout_datetime = date('Y-m-d h:i:sa', time()) "); session_destroy(); header("Location: index.php"); ?> [/quote] mysql_query("UPDATE access_log SET logout_datetime = date('Y-m-d h:i:sa', time()) WHERE id = 1 "); should do the trick
  10. [!--quoteo(post=380926:date=Jun 7 2006, 05:02 AM:name=sab)--][div class=\'quotetop\']QUOTE(sab @ Jun 7 2006, 05:02 AM) [snapback]380926[/snapback][/div][div class=\'quotemain\'][!--quotec--] thanks for the reply but if I use update I will overwrite the login/logout time. I want keep the old login as well as new one. I might need a new table for this but not sure. Also how can i have 2 timestamp columns in a table one for login and one for logout you help is much appreciated thanks [/quote] you can have as many timestamp columns in a table as you want. If you want to keep the old login you'll probably have to make a new table with just: id users login_time logout_time , where users is the name of your user that logged in/out.
  11. [!--quoteo(post=380577:date=Jun 6 2006, 08:48 AM:name=sab)--][div class=\'quotetop\']QUOTE(sab @ Jun 6 2006, 08:48 AM) [snapback]380577[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi Guyz After getting assistance on the previous posts, here I am with another one. I want to record the time when user login and logout of the web. I have searched through the web and found web stats and access counters etc but I dont need something as detailed as that I have a very small website with users given login passwords to go and add reports (done in php/mysql). Can someone direct me to a suitable tutorial or a sample I can look at -- thanks. [/quote] just add something like this after the login verification is succesful $logged = date("H:i:s"); and UPDATE it in your user's table same thing for loggout, just make sure you make 2 new rows in your database, one for the time they logged in and the other for the time they logged out
  12. you need to have all of the input boxes and your button in the same MC and give it an instance name of formMC or whatever you want. You can also add a dynamic text box and give it a var of "status" so that people know what's going on when they submit the form then on your button add [code] on (release) {         if (!your_email.length || your_email.indexOf("@") == -1 || your_email.indexOf(".") == -1) {         status = "Please enter a valid E-mail address";     }     else if (!your_name.length) {         status = "Please Enter your name before Sending";     }     else if (!message.length) {         status = "Please enter some text in you message";     }          else {         loadVariablesNum ("send.php", "0", "Post");         status = "Sending... ";     } } [/code] and in your send.php you do it like every other php form, you make it collect the info using $_POST and mail the message. To send back info to your status box just add Print "_root.formMC.status=Your mail has been sent"; after your mail() function [!--quoteo(post=380632:date=Jun 6 2006, 11:24 AM:name=AgentSmith)--][div class=\'quotetop\']QUOTE(AgentSmith @ Jun 6 2006, 11:24 AM) [snapback]380632[/snapback][/div][div class=\'quotemain\'][!--quotec--] I have a web template that is written in FLASH and has a feedback comment box that asks the user to enter thier name email and a comment. The FLASH site uses an HTML file for data configuration, and the variable for the email adress is set as $recipient, I have looked in the tutorials and do not see how to get the email to be sent to me including the comment. Within the FLASH code are the variables for $your_name $your_email and $message, is there an example in the tutorials to show me how to do the post form? I appologise if this has been covered somewhere, but I couldnt find a search result for this that deals with FLASH and PHP. Cheers! :-) [/quote]
  13. [!--quoteo(post=380256:date=Jun 5 2006, 12:56 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Jun 5 2006, 12:56 PM) [snapback]380256[/snapback][/div][div class=\'quotemain\'][!--quotec--] yes, you can setup a cron job which will then execute your php script every 24hours. [/quote] yeah that's what I thought but wasn't sure. thanks guys
  14. [!--quoteo(post=380161:date=Jun 5 2006, 07:07 AM:name=stephenk)--][div class=\'quotetop\']QUOTE(stephenk @ Jun 5 2006, 07:07 AM) [snapback]380161[/snapback][/div][div class=\'quotemain\'][!--quotec--] You could maybe loop through the table each day and select entries that are more than 3 days old. Use a PHP script to grab the entries from the main table, insert them into the archive table then delete them on the main table. Stephen [/quote] hey Stephen, is there a way to make an automatic process without having to run that script myself every day?
  15. hey guys, I was wondering what would be the most efficient way to archive a MySQL table. I have a table that has over 100 entries added to it per day, I need to archive them somewhere to be able to review them later.
  16. thanks guys but I think you're missing my point... the first form is named edituser_form1.php and the second is named edituser_form2.php edituser_form1.php submits to admin.php which controls everything, so admin.php does the mysql query to check if the user exists, if so it will include edituser_form2 if not it will include username_no so I can't really use GET... is there another way I can do this? admin.php stores the variables and I don't understand why edituser_form2 doesn't want to see those varibables... any ideas? edit oh and I can't add a varible to the link from admin.php (ie edituser_form2.php?u=user1) because the way I made the template system is that I just type the name of the file and it adds the .php by itself.... changing that now would be a really big hassle...
  17. [!--quoteo(post=378547:date=May 30 2006, 08:32 PM:name=legohead6)--][div class=\'quotetop\']QUOTE(legohead6 @ May 30 2006, 08:32 PM) [snapback]378547[/snapback][/div][div class=\'quotemain\'][!--quotec--] use GET method to send the user id to the edit page then go $id=$_GET['field of id']; connect to db and put WHERE id=$id [/quote] can you please elaborate? The form itself submits to admin.php not to the second form
  18. Hey guys, I have 2 forms, one that let's you choose a user to edit and the other is for the actual editing. What I'm trying to do is when you select a user to edit and click on Edit it will take you to the 2nd form with all the input boxes filled with the correct info from the db. Should be very simple but I'm using a template system that doesn't seem to allow me to pass information like that. here's an example [code] case "edituser":       $process=$_POST['process'];         if ($process == "yes") {         $process_b=$_POST['process_b'];         $username=$_POST['username'];                    if ($process_b == "yes") {           $new_uname=$_POST['new_uname'];           $new_email=$_POST['new_email'];           $new_fname=$_POST['new_fname'];           $new_lname=$_POST['new_lname'];           $new_active=$_POST['new_active'];             if (strlen($new_uname) < 5 || strlen($new_email) < 6 || strlen($new_name) < 3 || strlen($new_active) < 2) {             $tmpl->add_template("edituser_tooshort");             }             else {             mysql_query("UPDATE ".$prefix."users SET username='$new_uname',email='$new_email',fname='$new_fname',lname='$new_lname',active='$new_active' WHERE username='$username'") or die(query_error());             $tmpl->add_template("edituser_success");             }           }           else {           $result=mysql_query("SELECT * FROM ".$prefix."users WHERE username='$username'") or die(query_error());           $row=mysql_fetch_array($result);             if ($row['id'] != "") {             $tmpl->add_template("edituser_form2");             }             else {             $tmpl->add_template("username_no");             }           }         }         else {         $tmpl->add_template("edituser_form1");         }             break; [/code] and here's edituser_form1 [code] <div id="article"> <form action="admin.php?a=edituser" method="post"> <input type="hidden" name="process" value="yes" /> <table border="0"> <tr> <td>Username:</td> <td><select name="username" id="username">   <option>Choose one</option>   <?php $sql='SELECT * FROM mtl_users'; $req=mysql_query($sql) or die(query_error()); while($data = mysql_fetch_assoc($req)) {     echo '<option value="'.$data['username'].'">'.$data['username'].'</option>'; } ?> </select></td> </tr> </table> <br /> <input type="submit" value="Edit User" /> </form> </div>[/code] so when that form is submitted admin.php collects the username $username=$_POST['username']; but if I echo $username in edituser_form2 it won't display anything so I can't really query the db to fill up the input boxes... is there any way I can make this work without having to put the 2nd form in admin.php?? I prefer having the forms in seperate files just so that everything stays clean. Hope I made myself clear. would really appreciate any help I can get.
  19. [!--quoteo(post=378317:date=May 30 2006, 02:03 AM:name=T-B0N3)--][div class=\'quotetop\']QUOTE(T-B0N3 @ May 30 2006, 02:03 AM) [snapback]378317[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi there guys. I am having this php script that renders a web gallery (pretty basic I'd say). I would like to have a function on the photo so when I click on it I get redirected to a form where the filename is embbeded in the subject line. Is that possible and if yes how ? [/quote] well a quick solution would be to add something like this to your link yourform.php?file=filename and use $_GET to get the file name and store it in a variable
  20. I have a form that has text fields and file fields is there any way I can collect the info from both of them at the same time using this [code] $qtmp = array();             foreach($_POST as $k => $v)                 switch($k) {                     case 'club_name':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "club ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'event_name':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "name ='" . $v . "'";                     break;                     case 'dj':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "dj ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'performers':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "performers ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'promoter':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "promoter ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'dress':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "dress ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'notes':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "notes ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'buy':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "tickets ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'guestlist':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "guestlist ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;            }                      $query = "INSERT INTO ".$prefix."events set " . implode(', ',$qtmp);            $result = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error()); [/code] reason I want that is because the part that controls the file uploading stores the names of the files in an array array_push($names,$file_name); so that I can sttore those names in the db. got 4 file fields named file1 file2 file3 and file4 and the db row names are flyer1 flyer2 flyer3 and flyer4 any way I can make it work with the script I already have without having to add a 2nd query?
  21. alright finally fixed it!! was as series of addslashes, stripslashes and htmlentities here and there...
  22. [!--quoteo(post=378167:date=May 29 2006, 03:04 PM:name=homchz)--][div class=\'quotetop\']QUOTE(homchz @ May 29 2006, 03:04 PM) [snapback]378167[/snapback][/div][div class=\'quotemain\'][!--quotec--] I meant have you seen that what you are putting in the table is what is you put in the form. [/quote] well if I look at my table this is exacty what I see in the "name" field A-TRAK "SUNGLASSES ARE A MUST TOUR"
  23. [!--quoteo(post=378156:date=May 29 2006, 02:29 PM:name=homchz)--][div class=\'quotetop\']QUOTE(homchz @ May 29 2006, 02:29 PM) [snapback]378156[/snapback][/div][div class=\'quotemain\'][!--quotec--] Can you see how it is being put into the database, before you extract it? I still think it is a db issue and not PHP I do not have to add any special funtions to pull quotes or quoted phrases out of my db tables. [/quote] sure [code] $qtmp = array();             foreach($_POST as $k => $v)                 switch($k) {                     case 'club_name':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "club ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'event_name':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "name ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'dj':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "dj ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'performers':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "performers ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'promoter':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "promoter ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'dress':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "dress ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'notes':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "notes ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'buy':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "buy ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                     case 'guestlist':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "guestlist ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;                       case 'file1':                         if (trim(stripslashes($v)) != '')                             $qtmp[] = "flyer1 ='" . mysql_real_escape_string(trim(stripslashes($v))) . "'";                     break;            }      $query = "INSERT INTO ".$prefix."events set " . implode(', ',$qtmp);      $result = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());[/code] even tried doing case 'event_name': if (trim(stripslashes($v)) != '') $qtmp[] = "name ='" . $v . "'"; but still got the same thing
×
×
  • 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.