Jump to content

JJohnsenDK

Members
  • Posts

    400
  • Joined

  • Last visited

    Never

Everything posted by JJohnsenDK

  1. i see where are going with this, but its not the problem, because i declare ohter sessions with there are no problem with. Im gonna post the code: $_SESSION['area'] echos just fine when i click first 'submit_area' button, but when i click 'submit_aktivitet' button i cant echo anymore, but then i can echo $_SESSION['aktivitet']. And again if i click the last submit (which brings me to a new page) i cant echo $_SESSION['aktivetet'] nor $_SESSION['area'] ?? <?php if(isset($_GET['y'])){ $year = $_GET['y']; }else{ $year = date('Y'); } if(isset($_GET['m'])){ $month = $_GET['m']; }else{ $month = date('n'); } if(isset($_GET['d'])){ $day = $_GET['d']; }else{ $day = date('j'); } if(isset($_POST['submit_area'])){ $_SESSION['area'] = $_POST['area']; } if(isset($_POST['submit_aktivitet'])){ $_SESSION['aktivitet'] = $_POST['aktivitet']; } echo "area: ".$_SESSION['area']."<br />".$_SESSION['aktivitet']; // Sessions $_SESSION['day'] = $day; $_SESSION['month'] = $month; $_SESSION['year'] = $year; // Date variables $today = date('j'); $daysInMonth = date("t",mktime(0,0,0,$month,1,$year)); $firstDay = date("w", mktime(0,0,0,$month,1,$year)); $dayOfWeek = date("N", mktime(0,0,0,$month,$day,$year)); $weeksInMonth = 6; echo $day."/".$month."-".$year." - ".$daysInMonth." - ".$firstDay." - ".$weeksInMonth." - ".$dayOfWeek; echo "<div style=' margin-left: 20px;color: white'>"; echo "<div style='width: 400px; margin-top: 30px;'>"; if(isset($_SESSION['area'])){ echo " <div style='float:right; width: 200px;'> <form method='post'> <select name='aktivitet'> <option value=0>Valg af aktivitet</option>"; $aktivitetQuery = dbquery("SELECT name, id FROM aktiviteter_kategori WHERE areas_id = '".$_SESSION['area']."'"); while($aktivitetData = dbarray($aktivitetQuery)){ echo "<option value=".$aktivitetData['id'].">".$aktivitetData['name']."</option>"; } echo " </select> <input type='submit' name='submit_aktivitet' value='Vælg' /> </form> </div>"; } echo " <div style='width: 200px;'> <form method='post'> <select name='area'> <option value=0>Valg af område</option>"; $areaQuery = dbquery("SELECT name, id FROM areas"); while($areaData = dbarray($areaQuery)){ echo "<option value=".$areaData['id'].">".$areaData['name']."</option>"; } echo " </select> <input type='submit' name='submit_area' value='Vælg' /> </form> </div>"; echo "</div>"; if(isset($_SESSION['aktivitet'])){ echo "<div style='width: 350px; margin-top: 30px;'>"; echo " <div style='float:right; width: 150px;'> <form method='post' action='index.php?site=booking_informationer'> <span style='font-weight: bold;'>Antal person:</span> <input type='text' name='persons' style='width: 30px' /> </div>"; echo " <div width: 150px;'> <select name='disciplin'> <option value='0' selected=\"selected\">Valg af disciplin</option>"; $disciplinsQuery = dbquery("SELECT name, id FROM disciplins WHERE aktiviteter_kategori_id = '".$_SESSION['aktivitet']."'"); while($disciplinsData = dbarray($disciplinsQuery)){ echo "<option value=".$disciplinsData['id'].">".$disciplinsData['name']."</option>"; } echo " </select> </div>"; echo "</div>"; echo "<div style='margin-top: 40px;'>"; if(isset($_GET['show'])){ echo "<div style='float: right; width: 450px; border: 1px solid white;'>"; echo getBookings($day, $month, $year); echo "</div>"; } echo "<div>"; echo "<table style='background-color: #5B5A56; color: black;'>"; echo "<tr><td colspan='8'><table style='background-color:#6F6F6F; color: white;'>"; echo "<tr style='font-size: 12px; font-weight: bold; text-align:center;'><td colspan='8'>".monthToString($month)." ".$year."</td></tr>"; echo "<tr><td>Uge</td><td>Man</td><td>Tirs</td><td>Ons</td><td>Tors</td><td>Fre</td><td>Lør</td><td>Søn</td></tr>"; echo "</table></td></tr>"; $calendar[][] = null; $days = 1; for($i=1; $i<$weeksInMonth; $i++){ // Skiftende række farve if($i % 2 == 0){ echo "<tr style='background-color: #EDEDED'>"; }else{ echo "<tr style='background-color: #FFFFFF'>"; } // Ugedage echo "<td style='background-color: white; color: #CBAD3D; border: 1px solid #6F6F6F; width: 20px; height: 20px;'>$i</td>"; for($d=1; $d<8; $d++){ if($days <= $daysInMonth){ if($days < $today){ echo "<td class='bookingBookedTD'>$days</td>"; }else{ if($i == 1 && $d < $firstDay){ echo "<td style='border: 1px solid #EDEDED; width: 20px; height: 20px;'></td>"; }else{ // Dato booket if(checkBookingDate($days, $month, $year)){ echo "<td class='bookingBookedTD'><a href='index.php?site=booking&d=".$days."&m=".$month."&y=".$year."&show=1'>$days</a></td>"; }else{ echo "<td class='bookingTD'><a href='index.php?site=booking&d=".$days."&m=".$month."&y=".$year."&show=1'>$days</a></td>"; } } } $days++; } } echo "</tr>"; } if($month == 12){ $nMonth = 1; $nYear = $year + 1; }else{ $nMonth = $month +1; $nYear = $year; } if($month == 1){ $pMonth = 12; $pYear = $year - 1; }else{ $pMonth = $month -1; $pYear = $year; } echo "<tr><td colspan='8'><table style='background-color:#6F6F6F; color: white;'>"; echo "<tr style='font-size: 12px; font-weight: bold; text-align:center; width: 100%;'><td style='width: 33%;'><a href='index.php?site=booking&m=".$pMonth."&y=".$pYear."'>Forrige</a></td><td style='width: 33%;'>Luk</td><td style='width: 33%;'><a href='index.php?site=booking&m=".$nMonth."&y=".$nYear."'>Næste</a></td></tr>"; echo "</table></td></tr>"; echo "</table>"; echo "</div>"; echo "<div>"; echo "<select name='hour'>"; for($i=getOpeningHours($dayOfWeek); $i <= getClosingHours($dayOfWeek); $i++){ if(checkBookingHour($i, $day, $month, $year, $_SESSION['aktivitet'])){ }else{ echo "<option value='$i'>$i</option>"; } } echo "</select>"; echo "<input type='submit' name='submit_booking' value='Næste' />"; echo "</form>"; echo "</div>"; echo "</div>"; } echo "</div>"; ?>
  2. How do i do that? Because i cant see what should make what i have made here, a more simple session page
  3. Hey When i make a $_SESSION['test']; should it "be alive" until i kill it with unset()? Because my code doesnt act that way. I have multiple form submits on my page and to remember the data from every form i use sessions. But the session only "survives" doing the one form submit. Here is some of the code: if(isset($_POST['submit_area'])){ $_SESSION['area'] = $_POST['area']; } if(isset($_POST['submit_aktivitet'])){ $_SESSION['aktivitet'] = $_POST['aktivitet']; } Here $_SESSION['area'] only lives when i have click the submit_area button. I have set session_start(); i top of the code. Whats wrong?
  4. Hey Im trying to check if a "(" char is in a string, but i get this error: Warning: preg_match() [function.preg-match]: No ending matching delimiter ')' found in C:\wamp\www\katrinelund\maincore.php on line 1218 What am i doing wrong? <?php if(preg_match("(", $str)){ do something }else do something else } ?>
  5. Hey Why doesnt this function return the result in $returnstr? I can echo the result inside the if statement, as you can see in the code. So where is the error? <?php function f($str){ $returnstr = "Resultat: "; if(findLastCharInString($str) == "("){ $returnstr .= substr($str, 0, -1); echo $returnstr."<br>"; }else{ echo $str."<br>"; f(substr($str, 0, -1)); } return $returnstr."222"; } $test = f("Mohair sokker sort (Large)"); echo "test: ".$test; ?>
  6. Hey Im having some problems with sending mails via my mailserver, or atleast i think it is my mail server that is the problem. I made this script: <?php $to = "test@mail.dk"; $subject = "Test af mail sendning"; $message = "Jaaah, dette er så en test."; $headers = "From: info@mail.dk"; echo "<h2>This sends mail to ".$to."</h2>"; if(mail($to, $subject, $message, $headers)){ echo "Send!"; }else{ echo "Could'nt send the mail "; } It returns Send! so the mail() function does its work, right? But i dont get any mail and i have also chekced my junk mail. I tried 3 different mail accounts, but notthing. What is wrong? Is it the mailserver which doesnt send the mail or?
  7. how do i check if one of those are installed? the webserver is running on a Zend Core installation.
  8. Im having problems sending mails from my webserver. I have tried to make a small php script which sends a simple mail: <?php $to = "test@msn.com"; $subject = "Test af mail sendning"; $message = "Jaaah, dette er så en test."; $headers = "From: test@toyou.com"; echo "<h2>This sends mail to ".$to."</h2>"; if(mail($to, $subject, $message, $headers)){ echo "Send!"; }else{ echo "Could'nt send the mail "; } ?> And it unfortunally shows: "Couldnt send the mail ". What could be wrong? Can i in any way test my webserver?
  9. also works for me... thanks alot mate!
  10. sry for late reply... preg_replace doesnt help me much here? how should this be better than str_replace?
  11. Hey How do i change letters in a string. And not just one letter. For example this string "Småbørn". Here are to none english letters which i want to change to english letters so i get: "Smaborn". How do i do this? $name = "Småbørn"; $len = strlen($name); $returnName = ""; for($i=0;$i<$len;$i++){ $letter = substr($name, $i, 1); echo "d"; if(strpos($letter, "å")){ $returnName .= str_replace("å", "a", $letter); }elseif(strpos($letter, "ø")){ $returnName .= str_replace("ø", "o", $letter); }elseif(strpos($letter, "å")){ $returnName .= str_replace("å", "a", $letter); }else{ $returnName .= $letter; } } echo $returnName; but it sucks. It doesnt work. Any ideas?
  12. aaah.... now i understand what you mean... its doesnt demand all that math, i might do with this solution, eventho i have to create alot of <div> manually... thanks to both of you
  13. duclet... plx explain more, dont quite understand what you mean... nikefido... i understand your point and will try that
  14. well yes the it takes alot of math. Your suggention wont work because it only stores the percis coords and the next could position just 1px away from that. Any math genius here?
  15. Hey Im trying to make a notice_board where all notes are placed randomly. The code works fine, exept that the notes is laying over each ohter, because they are just giving a random absolute position and they dont care if there is allready a note in that position. Is it possible to code in PHP that a note can not position is self at a position where there allready are an ohter note? Here is the code: <?php $sql = dbquery("SELECT text, date, title FROM ".DB_PREFIX."notice_board"); $notices = array(); while($data = dbarray($sql)){ extract($data); $notices[] = array('title'=>$title, 'text'=>$text, 'date'=>$date); } class NoticeBoard{ var $date; var $html; var $notices; function NoticeBoard($array){ $this->notices = $array; $this->createHeader(); $this->createNoticeBoardNote(); $this->createFooter(); } function createHeader(){ $this->html = "<div id='notice_board_content'>"; } function createNoticeBoardNote(){ foreach($this->notices as $val){ $randomLeft = rand(430, 1045); $randomTop = rand(270, 800); $this->html .= "<div style='position: absolute; left: ".$randomLeft."; top: ".$randomTop.";'><div id='note_content'><div id='note_title'>".$val['title']."</div><div id='note_text'>".$val['text']."</div><div id='note_date'>".$val['date']."</div></div></div>"; } } function createFooter(){ $this->html .= "</div>"; } function render(){ echo $this->html; } } $notice_board = &new NoticeBoard($notices); echo "<div>"; $notice_board->render(); echo "</div>"; ?> Stylesheet is not included. I can post if you think it is nessysary.
  16. Hey How do i get get_browser() to check if the user is using IE or FF? I also tried this: $_SERVER['HTTP_USER_AGENT']; but it gives me this when im using Internet Explorer 7.0: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0) ???
  17. plz explain yourself a bit better... i dont understand what you want to do?
  18. Hey This is popperly HTML and CSS, but i dont know. How do i make a gradient background? You where the top is one color and then changes into anohter further down the page. Thanks
  19. without that page loading? well thats not possible with php, you will have to use AJAX for that. If you want to solved this you should send the data with a form to deletefriend page and then in deletefriend page redirect the user to displayfriends, when its done deleting. The user will never notice that he/she is forwarded to deletefriend. But again, use AJAX if you dont want the site to refresh.
  20. hmm... how do you get the username and password, from a mysql database? if yes, then you open a connection to the database and check if the username exists, if it does you check if the password is equal to that users password in the database. If you just want it simpel it aint that hard to code.
  21. you cant run this from a cd, because you need to have apache, php and mysql install on the machine you are trying the site on... Upload it at a free webhotel.
  22. thanks gingerrobot... will have a go with this...
×
×
  • 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.