Jump to content

perryratcliff

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

perryratcliff's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Yeah, sorry. I was asking if there was a more 'normal' way of doing this. The one problem I see is I won't be able to say in which order they completed a task. So maybe I need to rethink it...
  2. Not sure if I can post this here, or if I should go to a mySQL forum but... I'm trying to keep track of my user's "score". Each time they do a certain thing they get a preset amount of points, depending on what they did. The way I see it would be having a table that is joined to the user's ID, and have a column for each task. Then when they do a task the number in that column will go up. Then I will multiply that number by amount the task is worth. I can't just adjust there score because they need to be able to see what they did. So I hope that made sense. And if you know a better way to deal with this please let me know!
  3. That was it! But new error <?php /* draws a calendar */ function draw_calendar($month,$year){ /* draw table */ $calendar = '<table cellpadding="0" cellspacing="0" class="calendar">'; /* table headings */ $headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); $calendar.= '<tr class="calendar-row"><td class="calendar-day-head">'.implode('</td><td class="calendar-day-head">',$headings).'</td></tr>'; /* days and weeks vars now ... */ $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(); /* row for week one */ $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>'; require_once('../appvars.php'); require_once('../connectvars.php'); /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $query = "SELECT * FROM calendar WHERE startmonth='$month' and startyear='$year' and startday='$list_day'"; $results = mysqli_query($dbc, $query) or die (mysql_error()); if (mysql_num_rows($results) > ’0') { while($row = mysql_fetch_array($results)){ extract($row); $calendar.= ‘‘.$event.’‘; //end while } //end num_row if } else { $calendar.= ‘ ’;} Also add the following css: div.calendar-text { color:#111; } div.calendar-text a { color: #111; text-decoration: none; } div.calendar-text a:hover { color: #333; text-decoration: underline; } $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>'; /* end the table */ $calendar.= '</table>'; /* all done, return result */ return $calendar; } /* sample usages */ echo '<h2>July 2009</h2>'; echo draw_calendar(7,2009); echo '<h2>August 2009</h2>'; echo draw_calendar(8,2009); ?> I'm getting "Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/51/7219751/html/calendar/calendar.php on line 95" Line 95 is $calendar.= str_repeat('<p> </p>',2); Any idea?
  4. <?php /* draws a calendar */ function draw_calendar($month,$year){ /* draw table */ $calendar = '<table cellpadding="0" cellspacing="0" class="calendar">'; /* table headings */ $headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); $calendar.= '<tr class="calendar-row"><td class="calendar-day-head">'.implode('</td><td class="calendar-day-head">',$headings).'</td></tr>'; /* days and weeks vars now ... */ $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(); /* row for week one */ $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>'; require_once('../appvars.php'); require_once('../connectvars.php'); /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $query = “SELECT * FROM calendar WHERE startmonth='$month' andstartyear='$year' and startday='$list_day'”; $results = mysqli_query($dbc, $query) or die (mysql_error()); if (mysql_num_rows($results) > ’0') { while($row = mysql_fetch_array($results)){ extract($row); .... I keep getting Parse error: syntax error, unexpected T_STRING in /home/content/51/7219751/html/calendar/calendar.php on line 69 I'm trying to build a calendar. line 69 is the $query line.
  5. Thanks! I just added a second if if($count==0){ $testactive="SELECT * FROM $tbl_name WHERE username='$myusername' and password = md5('$mypassword')"; $activer=mysql_query($testactive); if (mysql_num_rows($activer) == 1) { $data = mysql_fetch_assoc($activer); $active = $data['active']; if($actve==0){ echo 'Please check your email and confirm your account'; } } if (mysql_num_rows($activer) == 0) { echo 'Wrong Username or Password'; } } ?> Works great!
  6. $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password = md5('$mypassword')"; $result=mysql_query($sql); So the user logging in should be stored in $result. The $tbl_name has a column called 'active'. How would I go about checking if $result's active was == to 1 Basically something like if $result 'active' == 1 { Thanks for the help!
  7. So I switched to Linux server and still no luck
  8. I'm using windows...should I switch to Linux?
  9. http://perryratcliff.com/test.php I guess I am in CGI/Fast CGI? How do I run as an Apache module?
  10. <?php // User name and password for authentication $username = 'username'; $password = 'password'; if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || ($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)) { // The user name/password are incorrect so send the authentication headers header('HTTP/1.1 401 Unauthorized'); header('WWW-Authenticate: Basic realm="Gator Boats"'); exit('<h2>Gator Boats</h2>Sorry, you must enter a valid user name and password to access this page.'); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Add a Picture of Your Boat</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <link rel="stylesheet" href="../css/style.css" type="text/css" /> <link rel="shortcut icon" href="http://rarg.co/favicon.ico"> </head> <body> <div class="allcontent"> <!--LOGO --> <?php require_once('appvars.php'); require_once('connectvar.php'); // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); //Retrieve picture data from MySQL $query = "SELECT * FROM gbdb ORDER BY id DESC"; $data = mysqli_query($dbc, $query); // Loop through all the pics and displaying them as HTML echo '<table>'; while ($row = mysqli_fetch_array($data)) { // Display the pics for each returned array echo '<tr class="picrow"><td><strong>' . $row['name'] . '</strong></td>'; echo '<td>' . $row['boat'] . '</td>'; echo '<td><a href="removepicture.php?id=' . $row['id'] . '&name=' . $row['name'] . '&boat=' . $row['boat'] . '&picture=' . $row['picture'] . '">Remove</a></td></tr>'; } echo '</table>'; mysqli_close($dbc); ?> <!--Footer --> <div class="footer"> <p> <a href="http://www.perryratcliff.com/contact.html">Contact</a> | <a href="gatorboats/privacy.html">Privacy</a> | <a href="gatorboats/career.html">Career</a> | <a href="gatorboats/affiliate.html">Affiliate</a> </p> </div> </div> </body> </html> The website is located at http://www.perryratcliff.com/phpgator/admin.php if you want to see it in action.
  11. <?php //user name and Password for authentication $username = 'username'; $password = 'password'; if(!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || ($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)) { //The username/password are incorrect or haven't been entered so send the authentication headers header ('HTTP/1.1 401 Unauthorized'); header ('WWW-Authenticate: Basic realm= "Gator Boats" '); exit ('<h2>Gator Boats Admin</h2> Sorry, You ust enter a valid username and password ' . 'access this page.'); } ?> Every time I enter the User Name: username and Password: password it just resends the headers. Can you see what I am doing wrong?
×
×
  • 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.