Jump to content

t.bo

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

t.bo's Achievements

Member

Member (2/5)

0

Reputation

  1. merylvingien, Maybe you are not a coder but your solution worked m8! Thanks a lot. I don't have clear explanation because I have always been told session stuff needs to be on top of the page: -) grtz
  2. This is very weird, as stated above, I changed the POST to GET for the username & password but not for the print_r. If I also change the print_r to GET, the array is empty again. So the code at this point (with a correct filled array) is <?php session_start(); include('dbconnect.php'); // $username = $_POST['username']; // $pw = $_POST['pw']; $username = isset($_GET['username']) ? $_GET['username'] : false; print_r($_POST); $pw = isset($_GET['pw']) ? $_GET['pw'] : false; $q="SELECT * FROM `users` WHERE ((username='$username') AND (pw='$pw'))"; $result= mysql_query($q) or die ("Could not execute query : $q." . mysql_error()); if (mysql_num_rows($result) == 0) { echo "<div align=center><b>Uw login en/of paswoord is verkeerd ingegeven, probeer opnieuw.</b></div>"; } else { $r=mysql_fetch_array($result); $login_username=$r["username"]; session_register("login_username"); Header("location: protected.php"); } ?>
  3. More info: I have changed the POST into GET in the login.php file. This returns the correct array as expected. But it does solve the problem however. Instead now the 'wrong password' error always shows...
  4. The array is empty (Array ( ) ) That is not what I expect. The text inputted is very basic so I don't think it falls under the magic quote criteria no?
  5. Hey all, Today I have received an error of one of my websites I created 2 years ago. The user cannot login anymore. He stays on the login screen and nothing happens. If he enters the wrong username & password he gets the correct error code. I use sessions and the user & pass are stored in the DB. I havent changed anything but the provider did some general updates. So can you guys check if any code is outdated? It seems like the session is not stored or the form does not send the user&pass. If I go directly to the login.php file I get the error: PHP Notice: Undefined index: username in D:\www\orangerie-krekelh.be\www\login.php on line 5 PHP Notice: Undefined index: pw in D:\www\orangerie-krekelh.be\www\login.php on line 6 The loginform <div id="content"> <h1>Login</h1> <form action="login.php" method="post"> <b>Username</b>:<input type="text" name="username" size="20"><br> <b>Password</b>:<input type="password" name="pw" size="20"><br> <input type="submit" value="Login"></form> </div> The login php file <?php session_start(); include('dbconnect.php'); print_r($_POST); $username = $_POST['username']; $pw = $_POST['pw']; $q="SELECT * FROM `users` WHERE ((username='$username') AND (pw='$pw'))"; $result= mysql_query($q) or die ("Could not execute query : $q." . mysql_error()); if (mysql_num_rows($result) == 0) { echo "<div align=center><b>Uw login en/of paswoord is verkeerd ingegeven, probeer opnieuw.</b></div>"; } else { $r=mysql_fetch_array($result); $login_username=$r["username"]; session_register("login_username"); Header("location: protected.php"); } ?> Thanks in advance for any kind of help! greetz
  6. Ok I have tried this. However now ofc there is no avatar field anymore in the slave table. I also cannot create a normal extra field 'Avatar'. That means the user cannot have an avatar in the slave site. So I guess if you create a view for one or more fields, that counts for the whole table... :-( Thanks tho for the help!
  7. Well I already created a view for the whole table like this CREATE VIEW lvn_users AS SELECT * FROM dbk_users In the lvn_users table there is a field called 'avatar'. So my question is how do I exclude this field from the current view? Do I just drop the field and recreate it or do I need to drop the whole table 'lvn_users' and do something else? greets
  8. That's great news. Thank you for your reply Mchl. Now, at the moment I did a CREATE VIEW for the whole table. If I delete and recreate the one 'avatar' field in the 'slave' table, will this work? I mean is this the correct way to exclude one field from the view? Kind regards, thibaut
  9. Hey all, Currently I have 3 different websites that are administrated for 90% on their own. The other 10% are the user tables. I wanted to make sure the user can register 1 time for 3 websites and have one profile for the 3 websites. So I created views for 2 websites user tables. These are now linked to the tables of the first website. This way al that I wanted works...except for one thing. In the user table there is one field called avatar. This field is responsible for the picture each user has. I want it to be possible to have all fields shared over the 3 websites except this field. This way the user can have different avatars for each website. So basically my question is: Can I create views for just one field? OR Can I create a view for a table and exclude 1 field from that table to function on it's own? Kind regards, Thibaut
  10. Hello everybody, Im making a website that has a menu that consists of several treatements when u click on one treatment a submenu appears that everytime has a "info" , "price", "pictures" button about that treatment. Now I was wondering what is the best way to solve this in php/mysql. My idea was to make one table for each treatment that consists of an idfield, an infofield, pricefield and picturefield. That way I can do a link like this index?content=botox&action=price where botox.php would be like this : <? include('dbconnect.php'); $action = $_GET[action]; if($action == "") { $action = "info"; } else { $sql = mysql_query("SELECT * FROM treatmenttable WHERE actionfield='$action'") or die(mysql_error()); $r=mysql_fetch_array($sql); $info = mysql_result($sql, 0 ,"info"); $price = mysql_result($sql, 0 ,"price"); $picture = mysql_result($sql, 0 ,"picture"); if($action = "info"){ echo "$info"; } if($action = "price"){ echo "$price": } } ?> Im having a little problem displaying the output (price, info or pictures) so im little stuck with the last lines. Can anyone help me out? Thanks in advance... ps : u can find an example of the layout here : http://euroclinix.site2start.be/euronew/
  11. If I use $today = mktime(0,0,0); instead of $today = time() then the result is empty... ?
  12. Hello everybody, I'm making a countdown timer that displays the days left to a certain event. When its the day of the event it should display 0 days left. The problem with my script is that it returns 1 day too short. I could just add "+ 1" to it but then it would never be 0 days left on the day of the event. <?php function CountDown($date) { // Timestamp the inputed date $countdown_date = strtotime($date); echo $date ."<br />"; // Get today's date $today = time(); $difference = $countdown_date - $today; if($difference <0) $difference = 0; $days_left = floor($difference/60/60/24); echo "Countdown date ".date("F j, Y, g:i a",$countdown_date)."<br/>"; if($days_left == 0) { return "Nog {$days_left} dagen te gaan!!!"; } } $date = "2007-09-08"; $result = CountDown($date); echo "{$result}"; ?> Hope someone helps me out. Thanks in advance grtz t.bo
  13. Thanks a lot guys. I deleted the spaces in the agenda and the problem is solved now. But how can I solve the problem if the user puts a space in again? If I convert datefield to int(10) only 2006 was left as the data for date. thanks in advance
  14. Maybe this helps also... The MySQL structure and inputted data : [code]-- phpMyAdmin SQL Dump -- CREATE TABLE `agenda` (   `idfield` int(11) NOT NULL auto_increment,   `eventfield` varchar(250) NOT NULL default '',   `urlfield` varchar(250) NOT NULL default '',   `monthfield` varchar(250) NOT NULL default '',   `date` varchar(250) NOT NULL default '',   PRIMARY KEY  (`idfield`) ) ENGINE=MyISAM AUTO_INCREMENT=81 DEFAULT CHARSET=latin1 AUTO_INCREMENT=81 ; -- -- -- INSERT INTO `agenda` VALUES (24, 'Resident  Club Outline', 'www.cluboutline.com', '', '2006-07-01'); INSERT INTO `agenda` VALUES (25, 'Resident  Club Outline', 'www.cluboutline.com', '', '2006-07-08'); INSERT INTO `agenda` VALUES (26, 'Resident  Club Outline', 'www.cluboutline.com', '', '2006-07-15'); INSERT INTO `agenda` VALUES (27, 'Resident  Club Outline', 'www.cluboutline.com', '', '2006-07-22'); INSERT INTO `agenda` VALUES (28, 'Resident  Club Outline', 'www.cluboutline.com', '', '2006-07-29'); INSERT INTO `agenda` VALUES (29, 'Cirque Cental  22u-2u', 'www.cirquecentral.be', '', '2006-07-07'); INSERT INTO `agenda` VALUES (30, 'Bar a Bar    3u-4u', 'www.barabar.be', '', '2006-07-07'); INSERT INTO `agenda` VALUES (31, 'La Rocca  Papaya  1.30u-3.30u', 'www.larocca.be', '', '2006-07-08'); INSERT INTO `agenda` VALUES (32, 'Groovy Tunes', 'www.groovy-tunes.be', '', '2006-07-14'); INSERT INTO `agenda` VALUES (33, 'Resident Club Industria \\"Closing Party\\"', 'www.clubindustria.be', '', '2006-07-20'); INSERT INTO `agenda` VALUES (34, 'La Gazz    \\"Dusart on fire\\"', 'www.lagazz.com', '', '2006-07-21'); INSERT INTO `agenda` VALUES (35, 'La Gazz  @  Beerschot', 'www.lagazz.com', '', '2006-07-22'); INSERT INTO `agenda` VALUES (36, 'La Gazz  @  The Century', 'www.lagazz.com', '', '2006-07-23'); INSERT INTO `agenda` VALUES (37, 'Summer Party  (Mielen Boven Aalst)', 'www.summerparty.be', '', '2006-07-29'); INSERT INTO `agenda` VALUES (38, 'Groovy Tunes', 'www.groovy-tunes.be', '', '2006-08-04'); INSERT INTO `agenda` VALUES (39, 'Groovalicious  (Hoeselt, Ter Komme)', 'www.groovalicious.be', '', '2006-08-05'); INSERT INTO `agenda` VALUES (40, 'Block Party  (Hosted by Cirque Central)', 'www.cirquecentral.be', '', '2006-08-11'); INSERT INTO `agenda` VALUES (41, 'Private Pool Party', '', '', '2006-08-11'); INSERT INTO `agenda` VALUES (42, 'Dance Parade ( Rotterdam NL)', '', '', '2006-08-12'); INSERT INTO `agenda` VALUES (43, 'Mac Billy\\''s  24u-1.30u', '', '', '2006-08-14'); INSERT INTO `agenda` VALUES (44, 'White Party  ( Herk de Stad)', 'www.indegloria.be', '', '2006-08-14'); INSERT INTO `agenda` VALUES (45, 'Bar a Bar meets Club Industria', 'www.barabar.be', '', '2006-08-19'); INSERT INTO `agenda` VALUES (46, 'La Gazz  Parkingconcerten Tielt', 'www.lagazz.com', '', '2006-08-24'); INSERT INTO `agenda` VALUES (47, 'Fabulous  (Genk)  21u-2u', '', '', '2006-08-26'); INSERT INTO `agenda` VALUES (48, 'Kim\\''s B-Day @ Bar a Bar  5u-7u', 'www.barabar.be', '', '2006-08-26'); INSERT INTO `agenda` VALUES (49, 'Resident Club Outline  8u-10u', 'www.cluboutline.com', '', '2006-08-26'); INSERT INTO `agenda` VALUES (50, 'Laundry Day', 'www.laundryday.be', '', '2006-09-02'); INSERT INTO `agenda` VALUES (51, 'Resident  Club Outline  5u-8u', 'www.cluboutline.com', '', '2006-08-05'); INSERT INTO `agenda` VALUES (52, 'Resident  Club Outline  5u-8u', 'www.cluboutline.com', '', '2006-08-12'); INSERT INTO `agenda` VALUES (53, 'Resident  Club Outline  5u-8u', 'www.cluboutline.com', '', '2006-08-19'); INSERT INTO `agenda` VALUES (54, 'Alden Biezen (Bilzen)  La Gazz', '', '', '2006-09-02'); INSERT INTO `agenda` VALUES (55, 'Laundry Night @ BONTHYS', 'www.bonthys.be', '', '2006-09-02'); INSERT INTO `agenda` VALUES (56, 'British American Tobacco (Nijvel)  La Gazz', 'www.lagazz.com', '', '2006-09-04'); INSERT INTO `agenda` VALUES (74, 'Kafka  Groovy Night  (Sint-truiden)    24u-2u', 'url', '', ' 2006-09-29'); INSERT INTO `agenda` VALUES (59, 'Levenslijn    Kattendijkdok Antwerpen  La Gazz  21u-22u', 'www.lagazz.com', '', '2006-09-08'); INSERT INTO `agenda` VALUES (60, 'Cirque Central  Dj Grammy ft Shitfiltr  23u-...', 'www.cirquecentral.be', '', '2006-09-08'); INSERT INTO `agenda` VALUES (61, 'Always Events  (Dendermonde)  La Gazz 19u-22.30u', 'www.lagazz.com', '', '2006-09-09'); INSERT INTO `agenda` VALUES (62, 'ROGER SANCHEZ @ Bonthys (Eilandje Antwerpen)', 'www.bonthys.be', '', '2006-09-09'); INSERT INTO `agenda` VALUES (63, 'GRAND OPENING  \\"BONTHYS\\"    ?u', 'www.bonthys.be', '', '2006-09-16'); INSERT INTO `agenda` VALUES (64, 'Club Outline  (Diest)  6u-8u', 'www.cluboutline.com', '', '2006-09-16'); INSERT INTO `agenda` VALUES (65, 'Groovy Tunes  Dj Grammy ft Sax, Percussie (La Gazz)  Hasselt  1u-3u', 'www.groovy-tunes.be', '', '2006-09-22'); INSERT INTO `agenda` VALUES (66, 'Bonthys  (Eilandje Antwerpen)  ?u', 'www.botnhys.be', '', '2006-09-23'); INSERT INTO `agenda` VALUES (67, 'Club Outline  (Diest)  6u-8u', 'www.cluboutline.com', '', '2006-09-23'); INSERT INTO `agenda` VALUES (72, 'Feestbureau    (Neerlanden)  La Gazz', 'www.lagazz.com', '', '2006-09-29'); INSERT INTO `agenda` VALUES (73, 'Club Outline    (Diest)  6u-8u', 'www.cluboutline.com', '', '2006-09-30'); INSERT INTO `agenda` VALUES (70, 'Merry Makers  (Zoo van Antwerpen)  La Gazz', 'www.lagazz.com', '', '2006-09-30'); INSERT INTO `agenda` VALUES (71, 'Bonthys  (Eilandje Antwerpen)  ?u', 'www.bonthys.be', '', '2006-09-30'); INSERT INTO `agenda` VALUES (75, 'Kafka  Groovy Night  (Sint-truiden)    24u-2u', 'url', '', ' 2006-10-13'); INSERT INTO `agenda` VALUES (76, 'Kafka  Groovy Night  (Sint-truiden)    24u-2u', 'url', '', ' 2006-11-10'); INSERT INTO `agenda` VALUES (77, 'Kafka  Groovy Night  (Sint-truiden)    24u-2u', 'url', '', ' 2006-12-08'); INSERT INTO `agenda` VALUES (78, 'MONTINI  Grand Opening      5.30u-8u', 'www.montini.cc', '', ' 2006-11-04'); INSERT INTO `agenda` VALUES (79, 'Montini    (Sint-truiden)    1.30u-4.30u', 'www.montini.cc', '', ' 2006-11-11'); INSERT INTO `agenda` VALUES (80, 'Montini    (Sint-truiden)    1.30u-4.30u', 'www.montini.cc', '', ' 2006-12-09'); [/code]
  15. Hi all, I've made an agenda that orders by date of the event. Almost every event is ordered correctly but now some events that are added later are not displayed correctly by date... you can see the problem at [url=http://www.djgrammy.be/index2.php?content=agenda]http://www.djgrammy.be/index2.php?content=agenda[/url] and [url=http://www.djgrammy.be/index2.php?content=agendajaar]http://www.djgrammy.be/index2.php?content=agendajaar[/url] And of course the code [code]<?php include('dbconnect.php'); $currentmonth = date("m"); $currentyear = date("Y"); $sql = mysql_query("select * from agenda order by date") or die(mysql_error()); $month = date("F"); $year = date("Y"); echo "<tr><td><h1>$month $year</h1></td></tr>"; while($row = mysql_fetch_array($sql)) { $event = stripslashes($row["eventfield"]); $id = $row["idfield"]; $url = $row["urlfield"]; $date = $row["date"]; $val = strtotime($date); $month2 = date("F", $val); $datecorrection = strtotime($date); $year = date("Y", $datecorrection); $day = date("l", $datecorrection); $numberday = date("dS", $datecorrection); $month3 = date("m", strtotime($date)); if($currentyear == $year) { // has category changed ? // if so, print it if($currentmonth == $month3) { echo  "<tr><td><b><a href=\"http://$url\">$event</a></b></td>"; echo  "<td>$day the $numberday<td></tr>"; } } } ?>[/code] Really hope that someone can help. I wonder if changing the field in the DB for the date will help? Thanks in advance...
×
×
  • 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.