Jump to content

trinaryoc

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Everything posted by trinaryoc

  1. //if there is, it logs you in and directes you to the members page $_POST['username'] = $_SESSION['username']; $_POST['password'] = $_SESSION['password']; $_SESSION['username'] = $username; $_SESSION['password'] = $password; I'm not following your logic here (top of your script)... after checking ISSET $_SESSION variable you set you $_POST variables to the $_SESSION variables.... ok, weird but ok... then you clear them by equating the $_SESSION to the undefined variables $password and $username? This right here might be your problem, your script would allow the user through to index.php but would have cleared out your $_SESSION variables. Looks like you have the same issue later on in your script as well. Also you only need the one session_start(); at the beginning...
  2. Do a search for Dynamic Dropdown. What you're looking for is JS. There are ways to achieve this with a server-side scripting language like PHP, but honestly it's qmoother and quicker with JS. Then just concat the variables and drop them into your textbox with document.form.variable.value=
  3. Do you really need the "On" and "Off" flag? seems redundant. If they have entered times shouldn't they be considered "On" already? unless you want to add someone on the schedule with zero hours. Seems to me that a the table should only require Entry Id (instead if a single column Primary Key, you could also do a combination of User and Date to create a unique primary key), User, Date, Time In, Time Out, (breaks???). One thing you need to consider when you design your table is to think of growth. While you might just need a set Sun-Sat calendar at this moment, what happens of you need to change in the future? And if you do change the schedule, wouldn't it be nice to be able to see what the user had as an old schedule? As to the PHP script... Entry from HTML Forms into SQL is very simple to accomplish, W3schools should have everything you need to create that script. You're looking at maybe a dozen lines of code to be off and running. Start writing it up and post to us what you come up with and we'll guild you in the right direction.
  4. The error code is caused because you're missing a '=' before the <<<EOD.
  5. hey change your button type to "type='submit'" and that should fix your issue... Edit: Yeah just tested it... change your button type.... But now after the submit you're getting :
  6. There's a sticky about Headers... but basically... you cant have any output to the user populate before altering a header because once you echo anything a header is automatically generated. you can buffer your output if you'd like but that's kinda dirty....
  7. Thats exactly what i was thinking. But to be honest... why dont you just create a button looking [a] in CSS... obviousily you're only doing this to get the button look.... you could also just create a button and add an onClick() to it. That would be my first choice. ether way you dont need to create a FORM. echo "<input type=button onClick=\"location.href='editevent.php?eventid=".$row['eventid']."'\" value='Edit'>";
  8. <?php $check = tep_db_query("SELECT t.userid AS 'userid', count(t.ticket) AS 'tick_qty', u.username AS 'username' FROM tickets AS 't' JOIN users AS 'u' ON t.userid = u.userid GROUP BY userid"); while ($ticket = tep_db_fetch_array($check)) { ?> <div><?php echo $ticket['userid']; ?></div> <div><?php echo $ticket['username']; ?></div> <div><?php echo $ticket['tick_qty'];?></div> <?php } ?> I'm worried that my syntax might be off... i dont know TEP databases at all. But that should work.
  9. Try this out: SELECT CAST(CONCAT_WS("-", year, day, month) AS DATE) as 'ymd' FROM calendar_event GROUP BY ymd ORDER BY ymd ASC will give you a date output as a data type DATE and that's easy enough to ORDER BY. there's other ways to do it but that's a quick and dirty one. persionaly if you cant adjust the table, I'd create a VIEW and with the CASTed CONCAT instead of the year, month, day, so you dont have to run the CAST and CONCAT everytime time you need to sort by dates
  10. Hey all. Kinda new to PHP. Better versed in SQL, Perl, and C++. But started dabling in PHP when my boss tossed a project my way that was already started in PHP. been crawling these forums for the past few months, figured i'd join up.
  11. Not to hijack the thread, but could clatify that a little, you've peeked my curiosity.
  12. Because it's a single line of very simple code. simpler then singling out each $_POST variable that need filtering. you can design the function however you wish. a simple filter finction for this application could be something like this: function filter($data) { $data = trim(htmlentities(strip_tags($data))); if (get_magic_quotes_gpc()) $data = stripslashes($data); $data = mysql_real_escape_string($data); return $data; } Pre PHP 5.2 you would have had to have installed PECL extention. Post 5.2 it was included within PHP. mysql_real_escape_string only alters for escape charactors, doesnt touch any code that might have been inserted in the text area. and i didnt say not to use it, i daid not ONLY use it. This was for diagnostics... OP thought he was having issues on his INSERTS
  13. Try this: <?php $check = tep_db_query("SELECT userid, count(ticket) AS 'tick_qty' FROM tickets GROUP BY userid); while ($ticket = tep_db_fetch_array($check)) { ?> <div><?php echo $ticket['userid']; ?></div> <div><?php echo $ticket['tick_qty'];?></div> <?php } ?> if you're running MySQL replace tep_db_ with mysql_
  14. This might work for you but your folder permissions need to be set to 755. <?php $tmp1 = array(); $tmp = array(); $AccountNumber = "00040"; $myFile = "yourfile.xml" $fh = fopen($myFile, 'a') or die("can't open file"); if ($AccountNumber == 00040) { $tmp1[] = "<ACCOUNT_NO>"; $tmp1[] = "Account Number is 00040"; $tmp1[] = "</ACCOUNT_NO>\r\n"; } else { $tmp1[] = "<ACCOUNT_NO>"; $tmp1[] = "Account Number is not 00040"; $tmp1[] = "</ACCOUNT_NO>\r\n"; } $tmp = array(); $AccountName = "Microsoft"; if ($AccountName == "Microsoft") { $tmp[] = "<ACCOUNT_NAME>"; $tmp[] = "Account Name is Microsoft"; $tmp[] = "</ACCOUNT_NAME>\r\n"; } else { $tmp[] = "<ACCOUNT_NAME>"; $tmp[] = "Account Name is not Microsoft"; $tmp[] = "</ACCOUNT_NAME>\r\n"; } fwrite($fh, $tmp1); fwrite($fh, $tmp); fclose($fh); ?> you also didnt define your second array. using "\r\n" will create your line breaks for ya. Questions Do you need arrays to hold your strings? Are you really appending or over-writing your file each time?
  15. two things... one, for your own safty filter your user input: foreach($_POST as $key => $value) {$data[$key] = filter($value);} most every hosting service has a filter installed. dont just use mysql_real_escape_string two: add a die() at the end of your input statements just to make sure that they are working correctly. not knowing how you have your DB_ setup, cant really tell if they're working correctly. mysql_query(" -- insert query here--") or die(mysql_error());
×
×
  • 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.