Jump to content

searls03

Members
  • Posts

    907
  • Joined

  • Last visited

Everything posted by searls03

  1. if you need to send it, you could post it in pieces or send a pm with it in pieces to me.
  2. what do you mean you have a class?
  3. thats probably it, I did, although why is the username in the email field? when there is actually a username field?
  4. well, I don't know where the problem would be at either. in the email piece of the form, it displays searls03 and in the password field it displays ******. I don't really know how to describe it better. i attached a picture of what it is doing. [attachment deleted by admin]
  5. is there a reason why this code is making my username.......searls03 and password as default value for the email and password fields? <?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['Submit'])){ $name = "{$_POST['fname']}{$_POST['last']}"; $fname = ereg_replace("[^A-Z a-z0-9]", "", $_POST['fname']); $lname = ereg_replace("[^A-Z a-z0-9]", "", $_POST['lname']); // 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 $accounttype = ereg_replace("[^A-Z a-z0-9]", "", $_POST['accounttype']); // filter everything but lowercase letters $email = stripslashes($_POST['email']); $email = strip_tags($email); $email = mysql_real_escape_string($email); $password = ereg_replace("[^A-Za-z0-9]", "", $_POST['password']); // filter everything but numbers and letters // Check to see if the user filled all fields with // the "Required"(*) symbol next to them in the join form // and print out to them what they have forgotten to put in if( (!$username) || (!$password)){ $errorMsg = "You did not submit the following required information!<br /><br />"; if(!$fname){ $errorMsg .= "--- Name"; } else if(!$username){ $errorMsg .= "--- Username"; } else if(!$Password){ $errorMsg .= "--- Password"; } } else { // Database duplicate Fields Check $sql_username_check = mysql_query("SELECT userid FROM members WHERE username='$username' LIMIT 1"); $username_check = mysql_num_rows($sql_username_check); if ($username_check > 0){ $errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another."; } else { // Add MD5 Hash to the password variable $hashedPass = md5($password); // Add user info into the database table, claim your fields then values $sql = "INSERT INTO members (First, Last, name, phone, username, address, city, state, zip, cell, email, accounttype, password, password2) VALUES('$fname', '$lname','$name','$phone','$username','$address','$city','$state','$zip','$cell','$email','$accounttype','$hashedPass', '$password')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); echo mysql_error(); $sql = "INSERT INTO sessions ( username, accounttype, password, password2 ) VALUES('$username','$accounttype','$hashedPass', '$password')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); echo mysql_error(); echo '<meta HTTP-EQUIV="REFRESH" content="0; url=success.php">'; 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 } ?> <!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>New Member---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" --> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" /> <!-- 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 } ?><?php if ($accounttype == "Scout Master") { ?> <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" --> <div id="TabbedPanels1" class="TabbedPanels"> <ul class="TabbedPanelsTabGroup"> <li class="TabbedPanelsTab" tabindex="0">My Info</li> <li class="TabbedPanelsTab" tabindex="0">Scout Info</li> </ul> <div class="TabbedPanelsContentGroup"> <div class="TabbedPanelsContent"><table width="600" align="center" cellpadding="4"> <tr> <td width="7%">Register new members here</td> </tr> </table> <table width="600" align="center" cellpadding="5"> <form action="join_form.php" method="post" enctype="multipart/form-data" > <tr> <td colspan="2"><font color="#FF0000"><?php echo "$errorMsg"; ?></font></td> </tr> <tr> <td width="163"><div align="right">First Name:</div></td> <td width="409"><div align="left"><input name="fname" type="text" /></div></td> </tr> <tr> <td width="163"><div align="right">Last Name:</div></td> <td width="409"><div align="left"><input name="lname" type="text" /></div></td> </tr> <tr> <td width="163"><div align="right">Phone:</div></td> <td width="409"><div align="left"><input name="phone" type="text" /></div></td> </tr> <tr> <td><div align="right">User Name: </div></td> <td><div align="left"><input name="username" type="text" /></div></td> </tr> <tr> <td><div align="right">Address: </div></td> <td> <div align="left"><input name="address" type="text" /></div> </td> </tr> <tr> <td><div align="right">City: </div></td> <td> <div align="left"> <input name="city" type="text" /></div> </td> </tr> <tr> <td><div align="right">State: </div></td> <td><div align="left"><input name="state" type="text" /></div></td> </tr> <tr> <td><div align="right">Zip Code: </div></td> <td><div align="left"><input name="zip" type="text" /></div></td> </tr> <tr> <td><div align="right">Cell Phone: </div></td> <td><div align="left"><input name="cell" type="text" /></div></td> </tr> <tr> <td><div align="right">Access Level: </div></td> <td><div align="left"><select name="accounttype" id="accounttype"> <option value="Scout" selected="selected">Scout</option> <option value="Scout Master">Scout Master</option> <option value="Admin">Admin</option> </select></div></td> </tr> </tr> <tr> <td><div align="right">Email Address: </div></td> <td><div align="left"><input name="email" type="text" /></div></td> </tr> <tr> <td><div align="right"> Password: </div></td> <td><div align="left"><input name="password" type="password" value="" /> </div> <font size="-2" color="#006600">(letters or numbers only, no spaces no symbols)</font></td> </tr> <tr> <td><div align="right"></div></td> <td><input type="submit" name="Submit" value="Submit Form" /></td> </tr> </form> </table></div> <div class="TabbedPanelsContent"> Please create member profile for Scout Info. </div> </div> </div> <script type="text/javascript"> var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1"); </script> <!-- 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>
  6. is there a way to make a php.ini file..........my webserver doesn't provide one for everyone to use....so I was wondering if there is a way to make one for just my site?
  7. one option you could try would be to have 3 input fields in the form.......one for the day of the month, one for the month, and one for the year. now you cant use the option for month name, but most people understand mm/dd/yyyy format. so you could have 3 rows in database month, day, year. each one submits to the correct field and then you can use the following to calculate the number of days to present day....... <?php $date1 = "$year-$month-$day"; //calculate years of age (input string: YYYY-MM-DD) function birthday ($birthday){ list($year,$month,$day) = explode("-",$date1); $year_diff = date("Y") - $year; $month_diff = date("m") - $month; $day_diff = date("d") - $day; if ($day_diff < 0 || $month_diff < 0) $year_diff--; return $year_diff; } echo birthday($date1). "years ago"; ?> my function was named birthday. Now you can edit this so that you could calculate days instead of years just return $day_diff. then to show the day they entered do this: <?php echo $month; ?>/<?php echo $day; ?>/<?php echo $year; ?> or something similar. make sense?
  8. yes, I know I could post 2 for sure, but I want something kindof like the file upload that is on this site when posting. I don't know if this is a form, but that was just how I know to add to the server. but if you could help me with how I make something similar to the upload that is on the posting pages on this site.
  9. how do I upload files so that the page doesn't refresh when the page submits, so that I can like add multiple files with one event so that I can info filled in but there are two forms, one with the documents, one with event info, but then the docs are linked to the event. does this make sense?
  10. I cant seem to get these two forms to basically work together.....I need this code(a form submit): <?php // Where the file is going to be placed $target_path = "uploads/public/uploads/admin/u1p2l3o4a5d6s789/98437e10ec5605a849c3bd9641494560_/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> with this code: <?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']; $shutoff = $_POST['shutoff']; if(!get_magic_quotes_gpc()) { $event = addslashes($event); $startdate = addslashes($startdate); $enddate = addslashes($enddate); $description = addslashes($description); $location = addslashes($location); $month = addslashes($month); $title1 = addslashes($title1); $title2 = addslashes($title2); $title3 = addslashes($title3); $title4 = addslashes($title4); $title5 = addslashes($title5); $title6 = addslashes($title6); $title7 = addslashes($title7); $title8 = addslashes($title8); $date1 = addslashes($date1); $date2 = addslashes($date2); $date3 = addslashes($date3); $date4 = addslashes($date4); $date5 = addslashes($date5); $date6 = addslashes($date6); $date7 = addslashes($date7); $date8 = addslashes($date8); $subevent1 = addslashes($subevent1); $subevent2 = addslashes($subevent2); $subevent3 = addslashes($subevent3); $subevent4 = addslashes($subevent4); $subevent5 = addslashes($subevent5); $subevent6 = addslashes($subevent6); $subevent7 = addslashes($subevent7); $subevent8 = addslashes($subevent8); $price1 = addslashes($price1); $price2 = addslashes($price2); $price3 = addslashes($price3); $price4 = addslashes($price4); $price5 = addslashes($price5); $price6 = addslashes($price6); $price7 = addslashes($price7); $price8 = addslashes($price8); $month2 = addslashes($month2); $month_num = addslashes($month_num); $year = addslashes($year); $day = addslashes($day); } include 'config.php'; include 'opendb.php'; $query = "INSERT INTO Registration (event, startdate, enddate, description, location, month, title1, title2, title3, title4, title5, title6, title7, title8, date1, date2, date3, date4, date5, date6, date7, date8, subevent1, subevent2, subevent3, subevent4, subevent5, subevent6, subevent7, subevent8, price1, price2, price3, price4, price5, price6, price7, price8, month2, shutoff) VALUES ('$event', '$startdate', '$enddate', '$description', '$location', '$month', '$title1', '$title2', '$title3', '$title4', '$title5', '$title6', '$title7', '$title8', '$date1', '$date2', '$date3', '$date4', '$date5', '$date6', '$date7', '$date8', '$subevent1', '$subevent2', '$subevent3', '$subevent4', '$subevent5', '$subevent6', '$subevent7', '$subevent8', '$price1', '$price2', '$price3', '$price4', '$price5', '$price6', '$price7', '$price8', '$month2', '$shutoff')"; mysql_query($query) or die('Error, query failed'); include 'closedb.php'; echo "<pre>".print_r($_POST, true)."</pre>"; } ?> I tried this: <?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']; $shutoff = $_POST['shutoff']; if(!get_magic_quotes_gpc()) { $event = addslashes($event); $startdate = addslashes($startdate); $enddate = addslashes($enddate); $description = addslashes($description); $location = addslashes($location); $month = addslashes($month); $title1 = addslashes($title1); $title2 = addslashes($title2); $title3 = addslashes($title3); $title4 = addslashes($title4); $title5 = addslashes($title5); $title6 = addslashes($title6); $title7 = addslashes($title7); $title8 = addslashes($title8); $date1 = addslashes($date1); $date2 = addslashes($date2); $date3 = addslashes($date3); $date4 = addslashes($date4); $date5 = addslashes($date5); $date6 = addslashes($date6); $date7 = addslashes($date7); $date8 = addslashes($date8); $subevent1 = addslashes($subevent1); $subevent2 = addslashes($subevent2); $subevent3 = addslashes($subevent3); $subevent4 = addslashes($subevent4); $subevent5 = addslashes($subevent5); $subevent6 = addslashes($subevent6); $subevent7 = addslashes($subevent7); $subevent8 = addslashes($subevent8); $price1 = addslashes($price1); $price2 = addslashes($price2); $price3 = addslashes($price3); $price4 = addslashes($price4); $price5 = addslashes($price5); $price6 = addslashes($price6); $price7 = addslashes($price7); $price8 = addslashes($price8); $month2 = addslashes($month2); $month_num = addslashes($month_num); $year = addslashes($year); $day = addslashes($day); } include 'config.php'; include 'opendb.php'; $query = "INSERT INTO Registration (event, startdate, enddate, description, location, month, title1, title2, title3, title4, title5, title6, title7, title8, date1, date2, date3, date4, date5, date6, date7, date8, subevent1, subevent2, subevent3, subevent4, subevent5, subevent6, subevent7, subevent8, price1, price2, price3, price4, price5, price6, price7, price8, month2, shutoff) VALUES ('$event', '$startdate', '$enddate', '$description', '$location', '$month', '$title1', '$title2', '$title3', '$title4', '$title5', '$title6', '$title7', '$title8', '$date1', '$date2', '$date3', '$date4', '$date5', '$date6', '$date7', '$date8', '$subevent1', '$subevent2', '$subevent3', '$subevent4', '$subevent5', '$subevent6', '$subevent7', '$subevent8', '$price1', '$price2', '$price3', '$price4', '$price5', '$price6', '$price7', '$price8', '$month2', '$shutoff')"; mysql_query($query) or die('Error, query failed'); include 'closedb.php'; echo "<pre>".print_r($_POST, true)."</pre>"; $target_path = "uploads/public/uploads/admin/u1p2l3o4a5d6s789/98437e10ec5605a849c3bd9641494560_/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } } ?> but it didn't work.....
  11. I found workaround as to what to do, I will make the email look like the doc, then it can just be printed.
  12. I tried that, but it doesnt pull $eventid(obviously since in an email). how could I make it so that it pulls it, or does the document need to be saved to the website first?
  13. I got it working now, thanks, I had the header in the wrong place.!!!!!!!!
  14. how do I make a link to the correct fpdf file that will be created.......I want to know how I can have an email sent, and then I put a link into the email which looks like: <a href="/ticket.php?eventid=' . $eventid . '">Ticket</a>. does this make sense? do I have to save the document on the server to do this?
  15. alright, here is it a bit more modified..... <?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']; $barcode = $row['barcode']; } $total = $price1 + $price2 + $price3 + $price4 +$price5 + $price6 + $price7 + $price8; require('fpdf.php'); class PDF extends FPDF { function Header() { global $name; global $total; global $title1; global $title2; global $title3; global $title4; global $title5; global $title6; global $title7; global $title8; global $price1; global $price2; global $price3; global $price4; global $price5; global $price6; global $price7; global $price8; global $barcode; function getBarcodeNumber($barcode){ $barcode = (int)$barcode; if(strlen($barcode) > 12) tigger_error('invalid barcode more that 12 digits supplied'); return str_pad($barcode , 12, "0", STR_PAD_LEFT); } 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 // get the variable $name1 into the scope of this function //Logo //Arial bold 15 $this->SetFont('Arial','B',15); //Move to the right $this->Cell(70); //Title $this->Cell(0,0,'Please bring this to the next Scout Meeting',0,0,C); //Line break $this->Ln(20); $this->Cell(0,0,'',1,0); $this->Ln(20); $this->cell(50,10, 'Registrant:', 1,0); $this->cell(50,10, 'Events:', 1,0); $this->cell(50,10, 'Price:', 1,0); $this->Ln(10); $this->cell(50,10,$name, 'L,R',0); if(!empty($title1)) { $this->cell(50,10, $title1, 'L',0); $this->cell(50,10, $price1, 'L,R',0); } if(!empty($title2)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title2, 'L',0); $this->cell(50,10, $price2, 'L,R',0); } if(!empty($title3)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title3, 'L',0); $this->cell(50,10, $price3, 'L,R',0); } if(!empty($title4)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title4, 'L',0); $this->cell(50,10, $price4, 'L,R',0); } if(!empty($title5)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title5, 'L',0); $this->cell(50,10, $price5, 'L,R',0); } if(!empty($title6)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title6, 'L',0); $this->cell(50,10, $price6, 'L,R',0); } if(!empty($title7)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title7, 'L',0); $this->cell(50,10, $price7, 'L,R',0); } if(!empty($title8)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title8, 'L',0); $this->cell(50,10, $price8, 'L,R',0); } $this->Ln(10); $this->cell(50,10,'','',0); $this->cell(50,10,'Total:','R', 'L',0); $this->cell(50,10, $total, 1,0); } //Page footer function Footer() { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial','B',; //Page number $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); } } //Instanciation of inherited class $pdf=new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->EAN13(10, 120, $barcode); $pdf->SetFont('Arial','B',12); $pdf->Output('ticket.pdf', 'I'); ?> ?> I am close to figuring it out, but now it cant find function EAN13
  16. here is the specific error.......finally....... Fatal error: Call to undefined function getbarcodenumber() in /home/a6254834/public_html/ticket.php on line 72
  17. I just need help as to where to put it in that code from before, I have this code, but I am pretty sure it isn't correct seeing as that I keep getting an error. I can't get the error, because the server is down right now, but I bet it is probably pretty clear as to what it is...... <?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 getBarcodeNumber($barcode){ $barcode = (int)$barcode; if(strlen($barcode) > 12) tigger_error('invalid barcode more that 12 digits supplied'); return str_pad($barcode , 12, "0", STR_PAD_LEFT); }} $assetNo = 123; $barcode = getBarcodeNumber($assetNo); $pdf->EAN13(10, 120, $barcode); //Page header require('fpdf.php'); class PDF extends FPDF{ function Header() { global $name; global $total; global $title1; global $title2; global $title3; global $title4; global $title5; global $title6; global $title7; global $title8; global $price1; global $price2; global $price3; global $price4; global $price5; global $price6; global $price7; global $price8; global $barcode; // get the variable $name1 into the scope of this function //Logo //Arial bold 15 $this->SetFont('Arial','B',15); //Move to the right $this->Cell(70); //Title $this->Cell(0,0,'Please bring this to the next Scout Meeting',0,0,C); //Line break $this->Ln(20); $this->Cell(0,0,'',1,0); $this->Ln(20); $this->cell(50,10, 'Registrant:', 1,0); $this->cell(50,10, 'Events:', 1,0); $this->cell(50,10, 'Price:', 1,0); $this->Ln(10); $this->cell(50,10,$name, 'L,R',0); if(!empty($title1)) { $this->cell(50,10, $title1, 'L',0); $this->cell(50,10, $price1, 'L,R',0); } if(!empty($title2)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title2, 'L',0); $this->cell(50,10, $price2, 'L,R',0); } if(!empty($title3)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title3, 'L',0); $this->cell(50,10, $price3, 'L,R',0); } if(!empty($title4)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title4, 'L',0); $this->cell(50,10, $price4, 'L,R',0); } if(!empty($title5)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title5, 'L',0); $this->cell(50,10, $price5, 'L,R',0); } if(!empty($title6)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title6, 'L',0); $this->cell(50,10, $price6, 'L,R',0); } if(!empty($title7)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title7, 'L',0); $this->cell(50,10, $price7, 'L,R',0); } if(!empty($title8)) { $this->Ln(10); $this->cell(50,10,'', 'L,R',0); $this->cell(50,10, $title8, 'L',0); $this->cell(50,10, $price8, 'L,R',0); } $this->Ln(10); $this->cell(50,10,'','',0); $this->cell(50,10,'Total:','R', 'L',0); $this->cell(50,10, $total, 1,0); } //Page footer function Footer() { //Position at 1.5 cm from bottom $this->SetY(-15); //Arial italic 8 $this->SetFont('Arial','B',; //Page number $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); } } //Instanciation of inherited class $pdf=new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $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>
  18. any help where to put it?
  19. where can I apply that into my code?
  20. ok, so basically I need to know how I can make it so that I can use a function to make 12 digits or 13 and then I need a code that will make the bars for it. easier?
  21. no, what I want is to beable to change the random digits I make for the $barcode(I know how to) and how to make it so that there are no other random digits........only the 12 I made.
  22. let me try to explain this better then. Basically, I need it just to be random digits, it isn't assigned to a product, it is going to be a piece in my database that will show up on a ticket, but right now, the last 4 numbers(besides for the extra) is being a random digit. but 8 of them are what are in database. I need to know how I can basically use a function that makes random numbers that I have print out all 12 digits(not the last) that can then use the barcode maker to make the bars. how do I do this. does this make more sense?
×
×
  • 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.