Jump to content

searls03

Members
  • Posts

    907
  • Joined

  • Last visited

Everything posted by searls03

  1. the problem was that I was not submitting rank or badges, so I had to put them as not required.
  2. why does this code not update database.....any errors you see off the bat? none of the messages are displaying for whether it posts or not......so I think there is something wrong with posting or a loop or something. <?php session_start(); include "config2.php"; if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; ?> <?php //action: view users ----------------------------------------------------------------------------- if (isset($_GET['viewUsers'])) { //get all active users $query = "SELECT name, username, phone, address, city, state, zip, cell, email, accounttype, badges, password, rank, userid FROM members WHERE userid=userid"; $rs = mysql_query($query); ?> <table width="563" border='1'> <tr> <th width="54">Name</th><th width="84">Username</th><th width="47">Email</th> <th width="148">Access Level</th> <th width="105"> </th> <th width="85"> </th> </tr> <?php //show the users while ($row = mysql_fetch_assoc($rs)) { ?> <tr> <td><?php echo $row['name'];?></td> <td><?php echo $row['username'];?></td> <td><?php echo $row['email'];?></td> <td><?php echo $row['accounttype']?></td> <td> </td> <td><a href='admin.php?edit&id=<?php echo $row['userid'];?>'>Edit</a>, <a href='admin.php?delete&id=<?php echo $row['userid'];?>'>Delete</a></td> </tr> <?php } ?> </table> <?php } //action: edit user ----------------------------------------------------------------------------- if (isset($_GET['edit']) && isset($_GET['id'])) { $userid = (int) $_GET['id']; if ($userid == 0) { die("Invalid ID provided."); } //execution when completed the edit user form and pressed submit button --------------------- if (isset($_POST['editUser'])) { //validate data ------------------------------------------------------------------------ //check empty fields $notRequired = array("email","phone","address", "city", "state","zip","cell" ); //passwords won't be checked, as they are not required foreach ($_POST as $k=>$v) { if ($v == "" && !in_array($k,$notRequired)) { $error[$k] = "<strong>This field is empty</strong>"; } } //escape string $name = "mysql_real_escape_string{$_POST['fname']} {$_POST['last']}"; $phone = mysql_real_escape_string($_POST['phone']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $state = mysql_real_escape_string($_POST['state']); $zip = mysql_real_escape_string($_POST['zip']); $email = mysql_real_escape_string($_POST['email']); $cell = mysql_real_escape_string($_POST['cell']); $username = mysql_real_escape_string($_POST['username']); $last = mysql_real_escape_string($_POST['last']); $first = mysql_real_escape_string($_POST['fname']); //check email validation, the function is available at config.php //check username exists in database $res = mysql_query("SELECT username FROM members WHERE username='".$username."' AND username != '".$username."'"); if (mysql_num_rows($res) == 1) { $error['username'] .= " <strong>Username already existst in database!</strong>"; } //check both passwords are the same when password fields are not empty //end validate data --------------------------------------------------------------------- //save to database when no errors are detected ------------------------------------------ if (count($error) == 0) { $query = "UPDATE members SET username='$username', email='$email', name='".$name."', phone='".$phone."',address='".$address."', city='".$city."',state='".$state."', zip='".$zip."',cell='".$cell."',badges='".$badges."', rank='".$rank."', first='".$first."', last='".$last."' WHERE userid='".$_GET['userid']."'"; $query1 = "UPDATE sessions SET username='".$username."', email='".$email."',name='".$name."', phone='".$phone."',address='".$address."', city='".$city."',state='".$state."', zip='".$zip."',cell='".$cell."',badges='".$badges."', rank='".$rank."' WHERE id='".$userid."'"; //update username session if you edit yourself if ($userid == $_SESSION['auth_admin_userid']) { $_SESSION['auth_admin_username'] = $username; } if (mysql_query($query)|| mysql_query($query1)) { echo "<p><strong>User has been edited and saved to the database.</strong></p>"; } else { echo "<strong>User has NOT been edited and saved into the database. ".mysql_error()."</strong>"; } } } //get user from the database and put data into $_POST variables. $rs = mysql_query("SELECT first, last, username, phone, address, city, state, zip, cell, email, badges, rank, accounttype FROM members WHERE userid = ".$userid.""); if (mysql_num_rows($rs) == 0) { die("User does not exists!"); } $row = mysql_fetch_assoc($rs); $_POST['fname'] = $row['first']; $_POST['last'] = $row['last']; $_POST['username'] = $row['username']; $_POST['phone'] = $row['phone']; $_POST['address'] = $row['address']; $_POST['city'] = $row['city']; $_POST['state'] = $row['state']; $_POST['zip'] = $row['zip']; $_POST['cell'] = $row['cell']; $_POST['email'] = $row['email']; $_POST['badges'] = $row['badges']; $_POST['rank'] = $row['rank']; $_POST['accounttype'] = $row['accounttype']; //if is admin, then $_POST['admin'] exists ?> <form action="admin.php?edit&id=<?php echo $userid; ?>" method="post"> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" tabindex="0">My Info</li> <li class="TabbedPanelsTab" tabindex="0">Merit Badges</li> <li class="TabbedPanelsTab" tabindex="0">Scout Rank</li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"> <table align="center" cellpadding="8" cellspacing="8"> <tr> <td><div align="right">First Name:</div></td> <td> <input type="text" name="name" value='<?php echo $_POST['fname'];?>' /> <?php echo(isset($error['fname']))?$error['fname']:"";?></td> </tr> <tr> <td><div align="right">Last Name:</div></td> <td> <input type="text" name="name" value='<?php echo $_POST['last'];?>' /> <?php echo(isset($error['last']))?$error['last']:"";?></td> </tr> <tr> <td><div>Phone Number:</div></td> <td><input type="text" name="phone" value='<?php echo $_POST['phone'];?>' /> <?php echo(isset($error['phone']))?$error['phone']:"";?></td> </tr> <tr> <td><div align="right">Address:</div></td> <td><input type="text" name="address" value='<?php echo $_POST['address'];?>' /> <?php echo(isset($error['address']))?$error['address']:"";?></td> </tr> <tr> <td><div align="right">City:</div></td> <td><input type="text" name="city" value='<?php echo $_POST['city'];?>' /> <?php echo(isset($error['city']))?$error['city']:"";?></td> </tr> <tr> <td><div align="right">State:</div></td> <td><input type="text" name="state" value='<?php echo $_POST['state'];?>' /> <?php echo(isset($error['state']))?$error['state']:"";?></td> </tr> <tr> <td><div align="right">Zip Code:</div></td> <td><input type="text" name="zip" value='<?php echo $_POST['zip'];?>' /> <?php echo(isset($error['zip']))?$error['zip']:"";?></td> </tr> <tr> <td><div align="right">Email:</div></td> <td> <input type="text" name="email" value='<?php echo $_POST['email'];?>' /> <?php echo(isset($error['email']))?$error['email']:"";?></td> </tr> <tr> <td><div align="right">Cell Phone:</div></td> <td><input type="text" name="cell" value='<?php echo $_POST['cell'];?>' /> <?php echo(isset($error['cell']))?$error['cell']:"";?></td> </tr> <tr> <td class="aaaaaaa" align="right"><div>Username:</div></td> <td><label for="username"></label> <input type="text" name="username" value='<?php echo $_POST['username'];?>' /> <?php echo(isset($error['username']))?$error['username']:"";?> </td> </tr> <input name="userid" type="hidden" value="<?php echo $userid; ?>" /> </table> <p> </div> <div class="TabbedPanelsContent"> <label for="badges"></label> <input name="badges" type="text" id="badges" value='<?php echo $_POST['badges'];?>' /> <?php echo(isset($error['badges']))?$error['badges']:"";?> </div> <div class="TabbedPanelsContent"> <input name="rank" type="text" id="rank" value='<?php echo $_POST['rank'];?>' /> <?php echo(isset($error['rank']))?$error['rank']:"";?> </div> </div> </div> <input name="editUser" type="submit" value="Save" /> </form> <p> <script type="text/javascript"> var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); </script> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <?php } ?> <br /><br /> </div></div> <script type="text/javascript"> var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"}); </script>
  3. I found it, there was no closing ' after month.......
  4. searls03

    error

    can anyone help me find out what is wrong with this query? <?php if(isset($_POST['save'])) { $event = $_POST['event']; $startdate = $_POST['startdate']; $enddate = $_POST['enddate']; $description = $_POST['description']; $location = $_POST['location']; $month = $_POST['month']; $title1 = $_POST['title1']; $title2 = $_POST['title2']; $title3 = $_POST['title3']; $title4 = $_POST['title4']; $title5 = $_POST['title5']; $title6 = $_POST['title6']; $title7 = $_POST['title7']; $title8 = $_POST['title8']; $date1 = $_POST['date1']; $date2 = $_POST['date2']; $date3 = $_POST['date3']; $date4 = $_POST['date4']; $date5 = $_POST['date5']; $date6 = $_POST['date6']; $date7 = $_POST['date7']; $date8 = $_POST['date8']; $subevent1 = $_POST['subevent1']; $subevent2 = $_POST['subevent2']; $subevent3 = $_POST['subevent3']; $subevent4 = $_POST['subevent4']; $subevent5 = $_POST['subevent5']; $subevent6 = $_POST['subevent5']; $subevent7 = $_POST['subevent6']; $subevent8 = $_POST['subevent7']; $price1 = $_POST['price1']; $price2 = $_POST['price2']; $price3 = $_POST['price3']; $price4 = $_POST['price4']; $price5 = $_POST['price5']; $price6 = $_POST['price6']; $price7 = $_POST['price7']; $price8 = $_POST['price8']; $month2 = $_POST['month2']; $month_num = $_POST['month_num']; $day = $_POST['day']; $year = $_POST['year']; $q = "UPDATE Registration Set event='$event', startdate='$startdate', enddate='$enddate', description='$description', location='$location', month='$month, title1='$title1', title2='$title2', title3='$title3', title4='$title4', title5='$title5', title6='$title6', title7='$title7', title8='$title8', date1='$date1', date2='$date2', date3='$date3', date4='$date4', date5='$date5', date6='$date6', date7='$date7', date8='$date8', subevent1='$subevent1', subevent2='$subevent2', subevent3='$subevent3', subevent4='$subevent4', subevent5='$subevent5', subevent6='$subevent6', subevent7='$subevent7', subevent8='$subevent8', price1='$price1', price2='$price2', price3='$price3', price4='$price4', price5='$price5', price6='$price6', price7='$price7', price8='$price8', month2='$month2', shutoff='$shutoff', month_num='$month_num', day='$day', year='$year' Where eventid='eventid'"; $sql = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());} ?> errror is You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Campout', title2='', title3='', title4='', title5='', title6='', title7='', titl' at line 1
  5. ok, so I was trying this code and it said it was corrupt. I have no idea how this works. please help: <?php // Query Database $result=mysql_db_query($dbname,"select userid,name,email,phone,cell,address,city,state from members where userid='$userid'"); // Send Header header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download");; header("Content-Disposition: attachment;filename=report.xls "); // à¹à¸¥à¹‰à¸§à¸™à¸µà¹ˆà¸à¹‡à¸Šà¸·à¹ˆà¸­à¹"ฟล์ header("Content-Transfer-Encoding: binary "); // XLS Data Cell xlsBOF(); xlsWriteLabel(2,0,"Name : "); xlsWriteLabel(2,1,"$name"); xlsWriteLabel(3,0,"email : "); xlsWriteLabel(3,1,"$email"); xlsWriteLabel(4,0,"phone : "); xlsWriteLabel(4,1,"$phone"); $xlsRow = 7; while(list($name,$email,$phone)=mysql_fetch_row($result)) { ++$i; xlsWriteNumber($xlsRow,0,"$name"); xlsWriteNumber($xlsRow,1,"$email"); xlsWriteLabel($xlsRow,2,"$phone"); $xlsRow++; } xlsEOF(); exit(); ?>
  6. Ya sorry my code does get kinda messy. Where would be the regular place you could put it( head, body, etc.).
  7. oh yeah, I don't know whether I should have used $barcode or $barcode1 because I think the original code had $barcode in it, which might also mess it up....I don't know. Make sense?
  8. so I have this code that makes a barcode: <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row['name']; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; } $sql = mysql_query("SELECT * FROM Events WHERE userid='$userid' && eventid=".$_GET['eventid'].""); while($row = mysql_fetch_array($sql)){ $price1 = $row['price1']; $price2 = $row["price2"]; $price3 = $row["price3"]; $price4 = $row["price4"]; $price5 = $row["price5"]; $price6 = $row["price6"]; $price7 = $row["price7"]; $price8 = $row["price8"]; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $barcode1 = $row['barcode']; } $total = $price1 + $price2 + $price3 + $price4 +$price5 + $price6 + $price7 + $price8; require('fpdf.php'); class PDF extends FPDF { function EAN13($x=1, $y, $barcode, $h=16, $w=.35) { $this->Barcode(13,200,$barcode,$h,$w,13); } function UPC_A($x, $y, $barcode, $h=16, $w=.35) { $this->Barcode($x,$y,$barcode,$h,$w,12); } function GetCheckDigit($barcode) { //Compute the check digit $sum=0; for($i=1;$i<=11;$i+=2) $sum+=3*$barcode[$i]; for($i=0;$i<=10;$i+=2) $sum+=$barcode[$i]; $r=$sum%10; if($r>0) $r=10-$r; return $r; } function TestCheckDigit($barcode) { //Test validity of check digit $sum=0; for($i=1;$i<=11;$i+=2) $sum+=3*$barcode[$i]; for($i=0;$i<=10;$i+=2) $sum+=$barcode[$i]; return ($sum+$barcode[12])%10==0; } function Barcode($x, $y, $barcode, $h, $w, $len) { //Padding $barcode=str_pad($barcode,$len-1,'0',STR_PAD_LEFT); if($len==12) $barcode='0'.$barcode; //Add or control the check digit if(strlen($barcode)==12) $barcode.=$this->GetCheckDigit($barcode); elseif(!$this->TestCheckDigit($barcode)) $this->Error('Incorrect check digit'); //Convert digits to bars $codes=array( 'A'=>array( '0'=>'0001101','1'=>'0011001','2'=>'0010011','3'=>'0111101','4'=>'0100011', '5'=>'0110001','6'=>'0101111','7'=>'0111011','8'=>'0110111','9'=>'0001011'), 'B'=>array( '0'=>'0100111','1'=>'0110011','2'=>'0011011','3'=>'0100001','4'=>'0011101', '5'=>'0111001','6'=>'0000101','7'=>'0010001','8'=>'0001001','9'=>'0010111'), 'C'=>array( '0'=>'1110010','1'=>'1100110','2'=>'1101100','3'=>'1000010','4'=>'1011100', '5'=>'1001110','6'=>'1010000','7'=>'1000100','8'=>'1001000','9'=>'1110100') ); $parities=array( '0'=>array('A','A','A','A','A','A'), '1'=>array('A','A','B','A','B','B'), '2'=>array('A','A','B','B','A','B'), '3'=>array('A','A','B','B','B','A'), '4'=>array('A','B','A','A','B','B'), '5'=>array('A','B','B','A','A','B'), '6'=>array('A','B','B','B','A','A'), '7'=>array('A','B','A','B','A','B'), '8'=>array('A','B','A','B','B','A'), '9'=>array('A','B','B','A','B','A') ); $code='101'; $p=$parities[$barcode[0]]; for($i=1;$i<=6;$i++) $code.=$codes[$p[$i-1]][$barcode[$i]]; $code.='01010'; for($i=7;$i<=12;$i++) $code.=$codes['C'][$barcode[$i]]; $code.='101'; //Draw bars for($i=0;$i<strlen($code);$i++) { if($code[$i]=='1') $this->Rect($x+$i*$w,$y,$w,$h,'F'); } //Print text uder barcode $this->SetFont('Arial','B',12); $this->Text($x,$y+$h+11/$this->k,substr($barcode,-$len)); } //Instanciation of inherited class $pdf=new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); //* here is part of barcode $pdf->EAN13(10, 120, $barcode1); $pdf->SetFont('Arial','B',12); $pdf->Output('ticket.pdf', 'I'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> </body> </html> How do I make it so that the bars still draw correctly, but they don't draw from the code, they draw from $barcode. or how do I put the value of $barcode into there.........currently it has to be a 8 digit $barcode and I believe 4-5 random numbers either on front or back. I want to be able to make $barcode have the value of an ean 13 barcode(which is how many numbers? 13 right?) and so that that is the only thing dictating barcode(I do know how to make it more numbers, but I cant do that because of the 5 random ones). does this make sense?
  9. where could I put this on a page so that it checks it before the page even loads......here is a code: <?php session_start(); // Must start session first thing /* Created By Adam Khoury @ www.flashbuilding.com -----------------------June 20, 2008----------------------- */ // Here we run a login check if (!isset($_SESSION['id'])) { echo 'Please <a href="login.php">log in</a> to access your account'; exit(); } //Connect to the database through our include include_once "connect_to_mysql.php"; // Place Session variable 'id' into local variable $userid = $_SESSION['id']; // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $username = $row["username"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; $accounttype = $row["accounttype"]; $rank = $row["rank"]; $badges = $row["badges"]; } // Set error message as blank upon arrival to page $errorMsg = ""; // First we check to see if the form has been submitted if (isset($_POST['username'])){ $name = ereg_replace("[^A-Z a-z0-9]", "", $_POST['name']); // filter everything but numbers and letters $phone = ereg_replace("[^A-Z a-z0-9]", "", $_POST['phone']); // filter everything but spaces, numbers, and letters $username = ereg_replace("[^A-Z a-z0-9]", "", $_POST['username']); // filter everything but spaces, numbers, and letters $address = ereg_replace("[^A-Z a-z0-9]", "", $_POST['address']); // filter everything but spaces, numbers, and letters $city = ereg_replace("[^A-Za-z0-9]", "", $_POST['city']); // filter everything but lowercase letters $state = ereg_replace("[^A-Za-z0-9]", "", $_POST['state']); // filter everything but lowercase letters $zip = ereg_replace("[^A-Za-z0-9]", "", $_POST['zip']); // filter everything but lowercase letters $cell = ereg_replace("[^A-Za-z0-9]", "", $_POST['cell']); // filter everything but lowercase letters $email = stripslashes($_POST['email']); $email = strip_tags($email); $email = mysql_real_escape_string($email); if((!$email)){ $errorMsg = "You did not submit the following required information!<br /><br />"; if(!$email){ $errorMsg .= "--- Email Address"; } } else { $sql = mysql_query("INSERT INTO events (name, phone, username, address, city, state, zip, cell, email) VALUES('$name','$phone','$username','$address','$city','$state','$zip','$cell','$email") or die (mysql_error()); $to = "$email"; // Change this to your site admin email $from = "events@final.net46.net"; $subject = "Complete your registration"; //Begin HTML Email Message where you need to change the activation URL inside $message = '<html> <style type="text/css"> #apDiv1 { position:absolute; left:338px; top:278px; width:311px; height:129px; z-index:1; } #apDiv2 { position:absolute; left:50px; top:207px; width:181px; height:149px; z-index:2; } #apDiv2 { text-align: center; } </style> </head> <body><div id="apDiv1"> <table width="408" border="1" cellspacing="2" cellpadding="2"> <tr> <th width="90" scope="col">Event(s):</th> <th width="298" scope="col"> $sql = mysql_query("SELECT * FROM Registration WHERE eventid=".$_GET["eventid"]." LIMIT 1"); while($row = mysql_fetch_array($sql)){ $event = $row["event"]; $startdate = $row["startdate"]; $enddate = $row["enddate"]; $description = $row["description"]; $location = $row["location"]; $subevent1 = $row["subevent1"]; $subevent2 = $row["subevent2"]; $subevent3 = $row["subevent3"]; $subevent4 = $row["subevent4"]; $subevent5 = $row["subevent5"]; $subevent6 = $row["subevent6"]; $subevent7 = $row["subevent7"]; $subevent8 = $row["subevent8"]; //this will echo the contents of each db row as they are iterated in the loop ############################# if (!empty($title1)) { echo "<br/>$title1:"; } if (!empty($title2)) { echo "<br/>$title2:" ; } if (!empty($title3)) { echo "<br/>$title3:"; } if (!empty($title4)) { echo "<br/>$title4:"; } if (!empty($title5)) { echo "<br/>$title5:"; } if (!empty($title6)) { echo "<br/>$title6:"; } if (!empty($title7)) { echo "<br/>$title7:"; } if (!empty($title8)) { echo "<br/>$title8:"; } } //etc etc </th> </tr> <tr> <th>Price:</th> <th> $total = $price1 + $price2 + $price3 = $price4 + $price5 + $price6 + $price7 + $price8 ; echo $total; </th> </tr> <tr> <th>Registrant:</th> <th><?php echo $name; ?></th> </tr> </table> </div> <div id="apDiv2"><?php echo $name; ?> <p> </p> <p> </p> <p><a href="index.php" target="_new"><strong>Troop 78 Home</strong></a></p> <p> </p> <p> </p> <p><strong><a href="http://www.cornhuskercouncil.org">Cornhusker Council</a></strong></p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> <img name="boyscout" src="button/boyscout.jpg" width="1180" height="700" border="0" id="boyscout" alt="" /> </body> </html>'; // end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $to = "$to"; // Finally send the activation email to the member mail($to, $subject, $message, $headers); // Then print a message to the browser for the joiner print "<br /><br /><br /><h4>OK $firstname, one last step to verify your email identity:</h4><br /> We just sent an Activation link to: $email<br /><br /> <strong><font color=\"#990000\">Please check your email inbox in a moment</font></strong> to click on the Activation <br /> Link inside the message. After email activation you can log in."; $to = "searls03@gmail.com"; // Change this to your site admin email $from = "events@final.net46.net"; $subject = "New Registration for $event"; //Begin HTML Email Message where you need to change the activation URL inside $message = '<html> <body> Hello, Aaron $name has registered for $event. they will owe $total = $price1 + $price2 + $price3 = $price4 + $price5 + $price6 + $price7 + $price8 ; echo $total; </body> </html>'; // end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $to = "$to"; // Finally send the activation email to the member mail($to, $subject, $message, $headers); // Then print a message to the browser for the joiner print "<br /><br /><br /><h4>OK $firstname, one last step to verify your email identity:</h4><br /> We just sent an Activation link to: $email<br /><br /> <strong><font color=\"#990000\">Please check your email inbox in a moment</font></strong> to click on the Activation <br /> Link inside the message. After email activation you can log in."; exit(); // Exit so the form and page does not display, just this success message } // Close else after database duplicate field value checks } // Close else after missing vars check //Close if $_POST ?> <?php // if no id is specified, list the available articles if(!isset($_GET['eventid'])) { $self = $_SERVER['PHP_SELF']; $query = "SELECT eventid, event FROM Registration ORDER BY eventid"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // get the article info from database $query = "SELECT event, description, startdate, enddate, location FROM Registration WHERE eventid=".$_GET['eventid']; $result = mysql_query($query) or die('Error : ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $event = $row['event']; $description = $row['description']; $startdate = $row['startdate']; $enddate = $row['enddate']; $location = $row['location']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template2.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Register--Boy Scout Troop 78</title> <!-- InstanceEndEditable --> <style type="text/css"> body { background-image: url(button/boyscout1.png); background-repeat: no-repeat; position: relative; } #menu { position:relative; left:160px; top:0px; width:931px; height:59px; z-index:19; } #menu #MenuBar1 li a { color: #000; border-top-style: outset; border-right-style: outset; border-bottom-style: outset; border-left-style: outset; width: 100px; } #status { position:relative; left:16px; top:180px; width:124px; height:44px; z-index:14; } </style> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <script type="text/javascript"> function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } </script> <!-- InstanceBeginEditable name="head" --> <style type="text/css"> #apDiv6 #apdiv19 #form1 table tr td { text-align: right; } #apDiv6 #apdiv19 #form1 table tr td #event { text-align: right; } .help { text-align: right; } .help { text-align: right; } #editregion p strong { font-size: 36px; } </style> <style type="text/css"> a:link { color: #FFF; } a:visited { color: #FFF; } </style> <!-- InstanceEndEditable --> <!-- InstanceParam name="id" type="text" value="apDiv6" --> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <style type="text/css"> #logout { position:relative; left:0px; top:0pxpx; width:134px; height:38px; z-index:20; font-weight: bold; font-size: 24px; } #logout a { color: #000; } #status { text-align: center; } #logout1 { position:absolute; left:1071px; top:191px; width:224px; height:61px; z-index:2; } #menu2 { position:absolute; left:-1px; top:172px; width:497px; height:92px; z-index:20; } * { padding: 0; } html, body { height: 100%; } .wrapper { min-height: 100%; height: auto !important; height: 100%; padding: 0 auto -4em; } .footer, .push { height: 4em; clear: both; } </style> </head> <body> <div id="menu2"><div id="menu"> <ul id="MenuBar1" class="MenuBarHorizontal"> <li><a href="myprofile.php">My Profile</a> </li> <li><a href="register.php">Register</a></li> <li><a href="dashboard.php">Dashboard</a> </li> <li><a href="news.php">News</a></li> <?php if ($accounttype == "Admin") { ?> <li><a href="membermanager.php">Scout Manager</a></li> <li><a href="eventmanager.php">Event Manager</a></li> <li><a href="newsmanager.php">News Manager</a></li> </ul><?php } ?> </div></div> <div id="logout1"><div id="logout"><a href="logout.php">Logout</a></div></div> <div id="status"><?php echo "$accounttype"; ?> <br /><?php echo "$name"; ?> <p> </p> </div><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br /> <br /> <!-- InstanceBeginEditable name="EditRegion3" --> <p> <?php $sql = mysql_query("SELECT * FROM members WHERE userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $name = $row["name"]; $phone = $row["phone"]; $address = $row["address"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $cell = $row["cell"]; $email = $row["email"]; } ?> <strong>Events</strong> <?php //Search 'events' table for the username //I don't know where you're storing username, but I've assumed It's defined as $username $sql = mysql_query("SELECT * FROM Events WHERE eventid=".$_GET['eventid']." && userid='$userid' LIMIT 1"); while($row = mysql_fetch_array($sql)){ $title11 = $row['title1']; $title21 = $row['title2']; $title31 = $row['title3']; $title41 = $row['title4']; $title51 = $row['title5']; $title61 = $row['title6']; $title71 = $row['title7']; $title81 = $row['title8']; } ?> <?php $sql = mysql_query("SELECT * FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"); while($row = mysql_fetch_array($sql)){ $eventid = $row["eventid"]; $event = $row["event"]; $startdate = $row["startdate"]; $enddate = $row["enddate"]; $description = $row["description"]; $location = $row["location"]; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; //this will echo the contents of each db row as they are iterated in the loop ############################# echo "<form action ='eventreg.php' method='post'>"; echo "<center><table border='1' width='600'>"; // Example of testing title1 for the userid (already registered) ... if (!empty($title11)){ echo "<tr><td width='300'> <strong><font color='red'> You have already registered for this event</font></strong><input type='hidden' name='title1' value='$title1'><input type='hidden' name='price1' value='$price1'></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1 </tr></td> "; } else{ if (!empty($title1)) { echo "<tr><td width='300'> <input type='checkbox' name='title1' value='$title1'/></td><td width='500'><strong>$title1 </strong><br /> $date1 <br />$ $price1<input type='hidden' name='price1' value='$price1'> </tr></td> "; } } if (!empty($title21)){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong><input type='hidden' value='$title2' name='title2'><input type='hidden' name='price2' value='$price2'></td><td width='500'><strong>$title2 </strong><br /> $date2 <br />$ $price2 </tr></td> ";} else if (!empty($title2)) { echo "<br/><tr><td> <input type='checkbox' name='title2' value='$title2' /></td><td><strong>$title2 </strong><br /> $date2 <br />$ $price2<input type='hidden' name='price2' value='$price2'> </tr></td>" ; } if (!empty($title31)){echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong><input type='hidden' value='$title3' name='title3'><input type='hidden' name='price3' value='$price3'></td><td width='500'><strong>$title3 </strong><br /> $date3 <br />$ $price3 </tr></td> ";} else if (!empty($title3)) { echo "<br/><tr><td><input type='checkbox' name='title3' value='$title3' /></td><td><strong>$title3</strong> <br /> $date3 <br />$ $price3<input type='hidden' name='price3' value='$price3'></tr></td>"; } if (!empty($title41)){ echo "<tr><td width='100'><strong><font color='red'> You have already registered for this event</font></strong><input type='hidden' value='$title4' name='title4'><input type='hidden' name='price4' value='$price4'></td><td width='500'><strong>$title4 </strong><br /> $date4 <br />$ $price4 </tr></td> ";} else if (!empty($title4)) { echo "<br/><tr><td><input type='checkbox' name='title4' value='$title4' /></td><td><strong>$title4</strong> <br /> $date4 <br />$ $price4<input type='hidden' name='price4' value='$price4'></tr></td>"; } if (!empty($title51)){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong><input type='hidden' value='$title5' name='title5'><input type='hidden' name='price5' value='$price5'></td><td width='500'><strong>$title5 </strong><br /> $date5 <br />$ $price5 </tr></td> ";} else if (!empty($title5)) { echo "<br/><tr><td><input type='checkbox' name='title5' value='$title5' /></td><td><strong>$title5</strong> <br /> $date5 <br />$ $price5<input type='hidden' name='price5' value='$price5'></tr>"; } if (!empty($title61)){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong><input type='hidden' value='$title6' name='title6'><input type='hidden' name='price6' value='$price6'></td><td width='500'><strong>$title6 </strong><br /> $date6 <br />$ $price6 </tr></td> ";} else if (!empty($title6)) { echo "<br/><tr><td> <input type='checkbox' name='title6' value='$title6' /></td><td><strong>$title6 </strong><br /> $date6 <br />$ $price6<input type='hidden' name='price6' value='$price6'></tr></td>"; } if (!empty($title71)){echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong><input type='hidden' value='$title7' name='title7'><input type='hidden' name='price7' value='$price7'></td><td width='500'><strong>$title7 </strong><br /> $date7 <br />$ $price7 </tr></td> ";} else if (!empty($title7)) { echo "<br/><tr><td> <input type='checkbox' name='title7' value='$title7' /></td><td><strong>$title7</strong> <br /> $date7 <br />$ $price7<input type='hidden' name='price7' value='$price7'></tr></td>"; } if (!empty($title81)){ echo "<tr><td width='100'> <strong><font color='red'> You have already registered for this event</font></strong><input type='hidden' value='$title8' name='title8'><input type='hidden' name='price8' value='$price8'> </td><td width='500'><strong>$title8 </strong><br /> $date8 <br />$ $price8 </tr></td> ";} else if (!empty($title8)) { echo "<br/><tr><td> <input type='checkbox' name='title8' value='$title8' /></td><td><strong>$title8</strong> <br /> $date8 <br />$ $price8<input type='hidden' name='price8' value='$price8'></tr></td>"; } echo "</table>"; echo "<input name='userid' type=\"hidden\" value=\"$userid\" />"; echo "<input name='eventid' type=\"hidden\" value=\"$eventid\" />"; echo "<input name='email' type=\"text\" value=\"$email\" />"; echo "<input name='event' type=\"hidden\" value=\"$event\" />"; echo "<input name='name' type=\"hidden\" value=\"$name\" />"; echo "<input name=\"save\" type=\"submit\" value=\"Register Now!\" />"; echo "<input name='id' type=\"hidden\" value=\"$userid, $eventid \" />"; function genRandomString($length = { $characters = '0123456789'; $string =''; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters))]; } return $string; } $bar = genRandomString(); echo "<input name='barcode' type=\"hidden\" value=\"$bar\" />"; echo "</center></form>"; } //etc etc //If it finds a match, output an error message ?> <br /> <!-- InstanceEndEditable --> <div class="push"></div></div> <div class="footer"><?php if($accounttype == "Admin"){include_once "footer-ad.php";}else if($accounttype == "Scout Master"){ include_once "footer-ad.php";} else if($accounttype == "Scout") { include_once "footer-sc.php"; } ?> </div> <script type="text/javascript"> var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"}); </script> </body> <!-- InstanceEnd --></html>
  10. Parse error: syntax error, unexpected '}', expecting ',' or ';' in /home/a6254834/public_html/viewevent.php on line 313
  11. there is also an error where I put the comment......
  12. but && means it has to have both correct? I need it to be either one or the other or both....make sense?
  13. how do I make this so that it is more of an & type of thing: if (isset($bs)){ echo $bs;} if(isset($ad)){ echo $ad; } else {echo "no events scheduled.";} I don't want it to check if there are any events scheduled with $bs, then it checks with $ad......and I don't want it to be an else if.....I need it to be more of check $ad and $bs, and if no results are returned for either it will display no events scheduled.....does that make sense?
  14. what is wrong with this snippet: <?php if (isset($_GET['eventid'])) { include('connect1.php'); $sql = "SELECT eventid FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"; $result = mysqli_query($dbcon, $sql) or die('error getting data'); echo "<table>"; $row = mysqli_fetch_array($result, MYSQLI_ASSOC); echo "<tr><td>"; echo "<form action='registration.php' method='get'><input type='hidden' name='eventid' value='{$row['eventid']}'>"; //* right here if (strtotime($row['shutoff']) <= time()){ echo 'No longer accepting registrations.'} else {echo "<INPUT TYPE='submit' name='submit' VALUE='Register'>"}; echo "</form>\n"; echo "</td></tr>"; echo "</table>"; } ?> and is that the way I would want to do it?
  15. Ok, so I have a field in database called shutoff( a date when registrations will no longer be accepted for an event). How can I make it so that on the specified date, the register button will change to "no longer accepting Registrations". here is the form: <?php // when displaying an article show a link // to see the article list if(isset($_GET['eventid'])) { ?> <div id="info " > <p>Date(s): <?php echo $startdate; ?><span class="klgjsa"> -</span> <?php echo $enddate; ?><br /> <span class="fgsdfg">Location:</span> <?php echo $location; ?><br /> <span class="adfasdf">Description</span><span class="adfdas">: </span><?php echo $description; ?> </p> <p> </p> <center> <table width="577" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="565" bgcolor="#C5C0B7" class="hjkh" scope="col"><?php echo $event; ?><font color='#C5C0B7'>...........................</font> <font size='-1'> <?php if ($accounttype =='Admin'){ echo "<a href='cofirmation.php'>Confirm Registrations </a><font color='#C5C0B7'>...</font><a href='quickregister.php?eventid=".$_GET['eventid']."'>Quick Registration</a><font color='#C5C0B7'>...</font><a href='viewregistered.php?eventid=".$_GET['eventid']."'>View Registrations</a>"; } ?></font></td> </tr> <tr> <td bgcolor="#999999" class="hjkh" scope="col"><table width="576" border="1" cellspacing="0" cellpadding="1"> <tr> <td width="91" bgcolor="#FFFFFF" scope="col"><?php $sql = mysql_query("SELECT * FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"); while($row = mysql_fetch_array($sql)){ $event= $row["event"]; $subevent1 = $row['subevent1']; $subevent2 = $row['subevent2']; $subevent3 = $row['subevent3']; $subevent4 = $row['subevent4']; $subevent5 = $row['subevent5']; $subevent6 = $row['subevent6']; $subevent7 = $row['subevent7']; $subevent8 = $row['subevent8']; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; //this will echo the contents of each db row as they are iterated in the loop ############################# if (!empty($title1)) { echo "<br/><strong>$title1</strong><br />$date1<br />$ $price1<br /><br />"; } if (!empty($title2)) { echo "<br/><strong>$title2</strong><br />$date2<br />$ $price2<br /><br />"; } if (!empty($title3)) { echo "<br/><strong>$title3</strong><br />$date3<br />$ $price3<br /><br />"; } if (!empty($title4)) { echo "<br/><strong>$title4</strong><br />$date4<br />$ $price4<br /><br />"; } if (!empty($title5)) { echo "<br/><strong>$title5</strong><br />$date5<br />$ $price5<br /><br />"; } if (!empty($title6)) { echo "<br/><strong>$title6</strong><br />$date6<br />$ $price6<br /><br />"; } if (!empty($title7)) { echo "<br/><strong>$title7</strong><br />$date7<br />$ $price7<br /><br />"; } if (!empty($title8)) { echo "<br/><strong>$title8</strong><br />$date8<br />$ $price8"; } } //etc etc ?></td> <td width="475" bgcolor="#FFFFFF" scope="col"><?php echo $description; ?></td> </tr> </table></td> </tr> </table> <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="31" scope="col"><?php if (isset($_GET['eventid'])) { include('connect1.php'); $sql = "SELECT eventid FROM Registration WHERE eventid=".$_GET['eventid']." LIMIT 1"; $result = mysqli_query($dbcon, $sql) or die('error getting data'); echo "<table>"; $row = mysqli_fetch_array($result, MYSQLI_ASSOC); echo "<tr><td>"; echo "<form action='registration.php' method='get'><input type='hidden' name='eventid' value='{$row['eventid']}'><INPUT TYPE='submit' name='submit' VALUE='Register'></form>\n"; echo "</td></tr>"; echo "</table>"; } ?></td> </tr> </table></center> <p> </p> <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col"> </th> </tr> </table> <p><?php } ?> and here is where data is pulled: $query = "SELECT event, description, startdate, enddate, location, subevent1, subevent2, subevent3, subevent4, subevent5, subevent6, subevent7, subevent8, price1, price2, price3, price4, price5, price6, price7, price8, shutoff FROM Registration WHERE eventid=".$_GET['eventid']; $result = mysql_query($query) or die('Error : ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $startdate = $row['startdate']; $enddate = $row['enddate']; $location = $row['location']; $description = $row['description']; $event= $row["event"]; $subevent1 = $row['subevent1']; $subevent2 = $row['subevent2']; $subevent3 = $row['subevent3']; $subevent4 = $row['subevent4']; $subevent5 = $row['subevent5']; $subevent6 = $row['subevent6']; $subevent7 = $row['subevent7']; $subevent8 = $row['subevent8']; $title1 = $row['title1']; $title2 = $row['title2']; $title3 = $row['title3']; $title4 = $row['title4']; $title5 = $row['title5']; $title6 = $row['title6']; $title7 = $row['title7']; $title8 = $row['title8']; $price1 = $row['price1']; $price2 = $row['price2']; $price3 = $row['price3']; $price4 = $row['price4']; $price5 = $row['price5']; $price6 = $row['price6']; $price7 = $row['price7']; $price8 = $row['price8']; $date1 = $row['date1']; $date2 = $row['date2']; $date3 = $row['date3']; $date4 = $row['date4']; $date5 = $row['date5']; $date6 = $row['date6']; $date7 = $row['date7']; $date8 = $row['date8']; $shutoff = $row['shutoff']; does this make sense? it is in yyyy-mm-dd format(I believe that is correct......
  16. that the form names, but the field in database will be called shutoffdate.........so I need those three pieces to submit to one field.
  17. How can I make it so that $year-$month-$day is the value of $shutoff. So when it posts to database, it will be in date format..........so something like $shutoff = $_POST['$year-$month-$day'] or [year-month-day]. Those are dashes not minuses.........is that correct format also? How do I do something like this?
  18. That is how they currently work. That's not how it is on mine. Mine just randomly logs out in the middle of doing something. Even when there is Activity. By the way, my php.ini file is not accessible. On my host it is a server file that would affect all websites that use their server.
  19. is there a way to set sessions to expire after a time of inactivity, not activity?
  20. I kinda moved to a second topic, didn't I, Sorry about that. It started out as php though
×
×
  • 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.