Jump to content

digitalgod

Members
  • Posts

    374
  • Joined

  • Last visited

    Never

Everything posted by digitalgod

  1. well $member would contain the username if I do it like that and if they're not logged in $member would be '' so I guess when I need to check if a person is logged in or not I can do if ($member != '')
  2. see that's why I needed your opinion :P thanks again ryanlwh
  3. hehe np, but google is your friend ;)
  4. oh got another question, my index.php is for members and non members, to access some of the pages you need to be a member so I did this [code] <?php if (isset($_COOKIE['remember']) || isset($_SESSION['remember'])) { //takes you to the page } else { //takes you to the login page } ?> [/code] my question is, is there a better way of doing this, like just checking at the begining of the page, like checking if the session exists, if it does the username is stored in a variable and if it doesn't exist 'guest' is stored in that variable. I think I answered my own question but I want to see if there's another way of doing it
  5. http://www.sitepoint.com/article/watermark-images-php
  6. ryanlwh, yup that worked perfectly ( I think )
  7. I don't think that's the problem because it worked perfectly before I added an index.php. I just has login.php which had the login form and then would get processed by login2.php and then redirect the user to members.php if the he got approved.
  8. Hey guys, I'm getting header problems with my script but I can't seem to find the problem... I've read the F.A.Q about headers but it didn't really help me. I've got index.php that has a login form that's how I load the pages [code] <?php include("includes/cachecontrol.php"); $tmpl=new Template; $tmpl->errors=0; $tmpl->cur_page_name="index.php"; include("includes/config.php"); //$tmpl->add_template("top"); include("includes/connect.php"); if ($_COOKIE['remember'] == "" && $_SESSION['remember'] == "") { block_check("",$_SERVER['REMOTE_ADDR'],"index.php",$prefix);     $a = (isset($_GET['a']) ? $_GET['a'] : 'default');     switch ($a) { //.... ?> //in cachecontrol.php <?php header("Content-Type: text/html; charset=ISO-8859-1"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // // Start the session // session_start(); // // Build the template class // class Template { var $errors; var $cur_page_name; //..... ?> [/code] login2.php  (the part that processes the form) [code] <?php ob_start(); include("includes/config.php"); include("includes/connect.php"); $uname=$_POST['uname']; $pword=$_POST['pword']; $remember=$_POST['remember']; $result=mysql_query("SELECT * FROM ".$prefix."users WHERE username='$uname'") or die(query_error()); $result=mysql_fetch_array($result); $result=$result['password']; if ($result == "") { header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("Location: error.php?e=1"); } else { $active=mysql_query("SELECT * FROM ".$prefix."users WHERE username='$uname'") or die(query_error()); $active=mysql_fetch_array($active); $active=$active['active'];   if ($active == "yes") {     if (md5($pword) == $result) {     $logged=date('Y-m-d H:i:s'); $insert = mysql_query("UPDATE ".$prefix."users SET last_login='$logged' WHERE username='$uname'") or die(query_error()); header("Cache-Control: no-store, no-cache, must-revalidate");     header("Cache-Control: post-check=0, pre-check=0", false);     header("Pragma: no-cache");     session_start();       if ($remember == "yes") {       $_SESSION['remember']=$uname;   setcookie("remember",$uname,time()+31449600,"/",$site_address);       }       else {       $_SESSION['remember']=$uname;       }     header("Location: members.php");     }     else {     header("Cache-Control: no-store, no-cache, must-revalidate");     header("Cache-Control: post-check=0, pre-check=0", false);     header("Pragma: no-cache");     header("Location: error.php?e=2");     }   }   else {   header("Cache-Control: no-store, no-cache, must-revalidate");   header("Cache-Control: post-check=0, pre-check=0", false);   header("Pragma: no-cache");   header("Location: error.php?e=3");   } } ?> [/code] I used ob_start() as a temp solution but I was wondering if there was a better solution
  9. yeah I know what you mean, and this was just for testing purposes so I might end up doing it your way. I was just wondering how would the 2nd query look like, since the first query only gets the the club types, should it be stored in an array and then use that array in the 2nd query? thanks guys, toplay, sorry about that, getting very tired and I guess I need some fresh air hehe
  10. I still need it to be sorted alphabeticaly though.. like type: nightclub A B C type superclub A B C etc
  11. just wondering if there's a way for a script to check incoming mail and collecting data from it, like storing the sender's info in a variable and storing the content of the email (text) in a variable as well so that it can be used for a query
  12. ok tried Barand's way and it didn't work at all... here's my query [code] <?php $_SESSION['display_clubs'] = mysql_query("SELECT * FROM ".$prefix."clubs ORDER BY name, CASE     WHEN type='nightclub' THEN 0                  WHEN type='superclub' THEN 1     WHEN type='after-hours' THEN 2                  WHEN type='lounge' THEN 3                  WHEN type='dayclub' THEN 4 END") or die(query_error()); //other page $display_result = $_SESSION['display_clubs']; while ($clubs_allrow = mysql_fetch_array($display_result)) { echo '<div style="margin-left:10px; margin-top:10px "><img src="images/square1.jpg" align="absmiddle" style="margin-right:5px "><strong class="light_gray">'.$clubs_allrow['name'].'</strong></div> <div style="margin-left:9px; margin-top:7px; width:354px "><img src="../img/clubs/'.$clubs_allrow['name'].'/thumbnails/'.$clubs_allrow['logo'].'" align="left" style="margin-right:13px "> <div>Type: '.$clubs_allrow['type'].'</div> <div style="margin-top:7px " align="right"></div> </div> <div style="margin-left:8px; margin-top:10px; margin-right:8px; height:1px; background-image:url(images/dot.jpg) "><img src="images/spacer.gif"></div>'; } ?> [/code] and it still shows me the clubs by alphabetical order... any ideas why?
  13. thanks guys, toplay, wouldn't I have to add a second query to pull out the club names in the order of the club_types? Which way takes less ressources, having a switch/case statement in the query or having 2 tables with 2 queries?
  14. Hey guys, was just wondering how can I query a database and order by 'type' but I don't want it to be alphabetical, I want to have them ordered in this order clubs superclubs afterhours lounges dayclubs any ideas how I can do that?
  15. ahhh didn't know t was military time, thanks!
  16. thanks nogray but for some reason it keeps giving me the countdown for the day after, like right now it's almost 4pm and it tells me that there's 17 hours left before 9pm... I can't seem to find what to change though... any clues?
  17. hey guys, I've been trying to make a countdown timer to a specific time for everyday but so far I've been unsucessful, all I was able to accomplish is making a normal timer. I need a script that can count down how much time there's left before it's 9pm and as soon as it's done it start all over again...
  18. well in my editor everything is tabbed correctly but when I copy paste it into here the tabs aren't the same for some reason.
  19. thanks guys but I already knew that, was just hoping that there was a cleaner way to do this. [code] $events_allrow = mysql_fetch_array($display_result); echo '<div style="margin-left:10px; margin-top:10px "><img src="images/square1.jpg" align="absmiddle" style="margin-right:5px "><strong class="light_gray">'.$events_allrow['name'].'</strong></div> <div style="margin-left:9px; margin-top:7px; width:354px "><div style="position:relative; left:0; top:0; "><img src="../img/events/'.$events_allrow['name'].'/thumbnails/'.$events_allrow['flyer1'].'" align="left" style="margin-right:13px "></div> <div>Where: <strong>'.$events_allrow['club'].'<br /></strong> When: <strong>'.$events_allrow['date'].'<br /></strong></div> Time: <strong>'.$events_allrow['time'].'<br /></strong></div>'; if ($events_allrow['performers'] != '') {     echo 'Performers: <strong>'.$events_allrow['performers'].'<br /></strong></div>'; } if ($events_allrow['djs'] != '') {   echo 'DJ: <strong>'.$events_allrow['dj'].'<br /></strong></div>'; } if ($events_allrow['promoter'] != '') {     echo 'Promoter: <strong>'.$events_allrow['promoter'].'<br /></strong></div>'; } if ($events_allrow['music'] != '') {     echo 'Music: <strong>'.$events_allrow['music'].'<br /></strong></div>'; } if ($events_allrow['cover'] != '') {     echo 'Cover Price: <strong>$'.$events_allrow['cover'].'<br /></strong></div>'; } if ($events_allrow['dress'] != '') {     echo 'Dress code: <strong>'.$events_allrow['dress'].'<br /></strong></div>'; } if ($events_allrow['notes'] != '') {     echo 'Notes: <strong>'.$events_allrow['notes'].'<br /></strong></div>'; } if ($events_allrow['tickets'] != '') {     echo 'Tickets: <strong>'.$events_allrow['tickets'].'<br /></strong></div>'; } if ($events_allrow['guestlist'] != '') {     echo 'Guestlist: <strong>'.$events_allrow['guestlist'].'</strong></div>'; } echo '<div style="margin-top:7px " align="right"></div> </div> <div style="margin-top:7px " align="right"><a href="index.php?a=events&id=all" class="light_gray" style="text-decoration:none "><strong>view all</strong></a></div> </div> <div style="margin-left:8px; margin-top:10px; margin-right:8px; height:1px; background-image:url(images/dot.jpg) "><img src="images/spacer.gif"></div>'; [/code] btw for those lines to work it has to be != '' and not !=0
  20. hey guys, I have a page that displays events that are stored in the db but sometimes some of the fields are empty and when that happens I don't want it to display that line. this is what I mean [code] $events_allrow = mysql_fetch_array($display_result); echo '<div style="margin-left:10px; margin-top:10px "><img src="images/square1.jpg" align="absmiddle" style="margin-right:5px "><strong class="light_gray">'.$events_allrow['name'].'</strong></div> <div style="margin-left:9px; margin-top:7px; width:354px "><div style="position:relative; left:0; top:0; "><img src="../img/events/'.$events_allrow['name'].'/thumbnails/'.$events_allrow['flyer1'].'" align="left" style="margin-right:13px "></div> <div>Where: <strong>'.$events_allrow['club'].'<br /></strong> When: <strong>'.$events_allrow['date'].'<br /></strong></div> Time: <strong>'.$events_allrow['time'].'<br /></strong></div> Performers: <strong>'.$events_allrow['performers'].'<br /></strong></div> DJ: <strong>'.$events_allrow['dj'].'<br /></strong></div> Promoter: <strong>'.$events_allrow['promoter'].'<br /></strong></div> Music: <strong>'.$events_allrow['music'].'<br /></strong></div> Cover Price: <strong>$'.$events_allrow['cover'].'<br /></strong></div> Dress code: <strong>'.$events_allrow['dress'].'<br /></strong></div> Notes: <strong>'.$events_allrow['notes'].'<br /></strong></div> Tickets: <strong>'.$events_allrow['tickets'].'<br /></strong></div> Guestlist: <strong>'.$events_allrow['guestlist'].'</strong></div> <div style="margin-top:7px " align="right"></div> </div> <div style="margin-top:7px " align="right"><a href="index.php?a=events&id=all" class="light_gray" style="text-decoration:none "><strong>view all</strong></a></div> </div> <div style="margin-left:8px; margin-top:10px; margin-right:8px; height:1px; background-image:url(images/dot.jpg) "><img src="images/spacer.gif"></div>'; [/code] so for a specific event the 'performersr' field is empty what would be the easiest way to not make it display Performers: and that applies to most of the fields
  21. try to echo $id just before the sql statement and make sure that id exists
  22. hey guys, why is this giving me February when it's supposed to give me March.... and is there a workaround? [code] <?php $bList = explode ('-',$row['date_birth']); echo $bList[1]; //outputs 03 $birth_date = date('F', mktime(0, 0, 0, $bList[1], 0, 0)); echo $birth_date; // outputs February.... not March??? ?>[/code]
×
×
  • 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.