Jump to content

brown2005

Members
  • Posts

    942
  • Joined

  • Last visited

Everything posted by brown2005

  1. function draw_calendar($month,$year) { $headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); $running_day = date('w',mktime(0,0,0,$month,1,$year)); $days_in_month = date('t',mktime(0,0,0,$month,1,$year)); $days_in_this_week = 1; $day_counter = 0; $dates_array = array(); $calendar = '<table cellpadding="0" cellspacing="0" class="calendar">'; $calendar.= '<tr class="calendar-row"><td class="calendar-day-head">'.implode('</td><td class="calendar-day-head">',$headings).'</td></tr>'; $calendar.= '<tr class="calendar-row">'; /* print "blank" days until the first of the current week */ for($x = 0; $x < $running_day; $x++): $calendar.= '<td class="calendar-day-np"> </td>'; $days_in_this_week++; endfor; /* keep going with days.... */ for($list_day = 1; $list_day <= $days_in_month; $list_day++): $calendar.= '<td class="calendar-day">'; /* add in the day number */ $calendar.= '<div class="day-number">'.$list_day.'</div>'; /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ $calendar.= str_repeat('<p> </p>',2); $calendar.= '</td>'; if($running_day == 6): $calendar.= '</tr>'; if(($day_counter+1) != $days_in_month): $calendar.= '<tr class="calendar-row">'; endif; $running_day = -1; $days_in_this_week = 0; endif; $days_in_this_week++; $running_day++; $day_counter++; endfor; /* finish the rest of the days in the week */ if($days_in_this_week < : for($x = 1; $x <= (8 - $days_in_this_week); $x++): $calendar.= '<td class="calendar-day-np"> </td>'; endfor; endif; /* final row */ $calendar.= '</tr>'; $calendar.= '</table>'; return $calendar; } how can i change the above code, so that the calendar starts on a monday instead of sunday. thanks in advance
  2. like this... { $entries = explode( "\n", $_POST[my_textarea]); $entries = str_replace(";", "\n", $entries); $x=0; foreach($entries AS $entry) { if($entry!=="") { $register_sql = "INSERT INTO emails(emails_email) VALUES ('$entry')"; $register_row = mysql_query($register_sql); echo "$entry added to database<br>"; $x++; } } }
  3. <?php session_start(); $database_host = "localhost"; $database_username = ""; $database_password = ""; $database_name = ""; $connection = mysql_connect($database_host, $database_username, $database_password) or die(mysql_error()); $db = mysql_select_db($database_name, $connection); if(!$_POST) { echo "<FORM METHOD=POST ACTION=$PHP_SELF>"; echo "<TEXTAREA NAME=my_textarea COLS=30 ROWS=5></TEXTAREA><BR>"; echo "<INPUT TYPE=SUBMIT VALUE=Submit>"; echo "</FORM>"; } else { $entries = explode( "\n", $_POST[my_textarea]); $x=0; foreach($entries AS $entry) { if($entry!=="") { $register_sql = "INSERT INTO emails(emails_email) VALUES ('$entry')"; $register_row = mysql_query($register_sql); echo "$entry added to database<br>"; $x++; } } } ?> i have the above code, where you enter emails in a textarea like email1@hotmail.com email2@hotmail.com and then it will put them into my database. right now what i want to do is adapt the above code to do the same when you put emails in the textarea like.. email1@hotmail.com; email2@hotmail.com thanks in advance
  4. lmao. my god im a plonker. cant believe i missed that. thanks
  5. $get_emails = mysql_query("SELECT * FROM emails"); while($row = mysql_fetch_assoc($get_emails)) { $curr_email = $row['emails_email']; $curr_id = $row['emails_id']; $email = strtolower($curr_email); $email = rtrim($email); $email = ltrim($email); $email = mysql_escape_string($email); $del = mysql_query("UPDATE emails SET emails_email=$email WHERE emails.emails_id=$curr_id LIMIT 1"); echo "$email added to database<br>"; } hi i have the above code to take emails from my database and string them to lower and remove any white space left on the left or right of the entry, but it is not working. any help please
  6. ok so leave the cookie on the computer. just update it all the time.. and when you log out just take the logout time from the table so it doesnt allow someone to log in, till they enter the username and password.
  7. so basically say add a member_login (datetime) in the table and then when they log out say delete this as well as the cookie..
  8. hi, thanks for the info, but say someone hacked my comp and read the cookie for the website, and then set the same cookie on there computer, would this not let them log on to the site with the id in the table.
  9. if(isset($_COOKIE['ID_my_site'])) { echo"yes there is a cookie"; }else{ $hour = time() + 3600; $username = "rberbe2002"; $password = "charliew"; setcookie(ID_my_site, $username, $hour); setcookie(Key_my_site, $password, $hour); } I am trying to create a loging script. I want this to be as secure as possible. I am trying to see if implementing cookies will work, but obviously the cookie set if someone could get this off my comp they could see my username and password. how can i make this more secure? and is there anyway to encrypt a cookie so it cant be read
  10. i have sorted it. i had #wrapper { width: 964px; margin: 0 auto; } so changed this to #wrapper { width: 974px; margin: 0 auto; } and it appears fine now..
  11. take a look at http://www.allinthissite.co.uk/ on the 6th image it is missing the right hand part of the image.
  12. yeah it should be the <li> as the last class is just ul#listings li.last { margin-right: 0; }
  13. hi mate changed that.. and still a problem
  14. $row_color = ($row_count % 6 != 0) ? $class1 : $class2; thats what I changed.. and still does not work take a look at http://www.allinthissite.co.uk/
  15. no that does not work.. you can see http://www.allinthissite.co.uk/ there.
  16. $class1 = ""; $class2 = "last"; $row_count = 0; for($i=1; $i<=49; $i++){ $row_color = ($row_count % 6) ? $class1 : $class2; echo"<li class='$row_color'><a href='' class='img'><img src='images/8.jpg' /></a><a href=''>Element Fusion</a></li>"; $row_count++; } this will print 6 images and then start a new line, but i want the 6th image to have the class last, so how can i change the code above to work. thanks
  17. Hi, I have a website where I have images stored in a file [images] what I want to do is take an image from the file and display this at 175 pixels by 175 pixles, but I want it to look as normal as it would have done. How would be the best way to do this?
  18. hi say i have the following... <div id="images" width="900"> <img src="" width="200> <img src="" width="200> <img src="" width="200> <img src="" width="200> </div> how can I space them, so that the first image is to the left.. the last image to the right. and the two in the middle evenly spread. but also taking into account if you add another image. this will start a new row. thanks
  19. <legend><span>Gender</span></legend><div><input type="radio" id="male" name="gender" value="male"><label for="male">Male</label></div><div><input type="radio" id="female" name="gender" value="female"> <label for="female">Female</label></div> <p class="error hidden" id="err_gender"></p> and how would I change this code below to work on the above if ( empty ( $_POST [ 'male' ] ) && empty ( $_POST [ 'female' ] ) ) { $errors [ 'gender' ] [] = "Please enter your gender\n"; }
  20. <form action="process.php" method="post" onsubmit="return false;" id="myid"> <button type="submit" id="submit-go" onclick="ajax_form('myid','validate.php','receiver');">Submit</button> when I click on the button it checks everything... if errors will show as red. if ok will show as green. what I want to know is once they are all green.. how do I make it submit to the process.php form... thanks
×
×
  • 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.