Jump to content

johnnyboy16

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Everything posted by johnnyboy16

  1. 1. My post was moved here by an administrator. 2. Will fix this, thank you.
  2. Howdy! I've built a calendar and have included some of the script below with some a screen shots. Basically, the issue I am having is with trying to center the cal_mnth class. In other words, centering the month with the width of the entire calendar. I am unable to figure out the best way to do this and have tried wrapping the calendar in a div and using text-align: center, but it didn't help. BTW, I'm a pretty unexperienced developer and this is my first attempt at a calendar. Hope this post makes sense... Thanks everyone. if(mktime(0, 0, 0, $cmonth, 1, $year)>mktime(0, 0, 0, date('m'), 1, date('Y'))) echo '<a href="'.$prevUrl.'" /><img src="image/leftarrow.png" class="l_arrow" alt="Previous Month"/>'; else echo ''; echo '<span class="cal_mnth">'.$mnthTxt.'</span>'; echo '<a href="'.$nextUrl.'" /><img src="image/rightarrow.png" class="r_arrow" border="0" alt="Next Month"/></a>'; echo '<table cellspacing="1px" cellpadding="0" width="'.$width.'" id="mycalendar" border="0" style="margin-top:5px;background-color:#CACACA;">'; echo '<tr> <th class="td1" onmouseover="cngBg(this, \'#9D9E9B\', \'#FFFFFF\',\'\')" onmouseout="cngBg(this, \'#EEEFEB\', \'#717070\',\'\')" onclick="selectWeek(7)">S</th> <th class="td1" onmouseover="cngBg(this, \'#9D9E9B\', \'#FFFFFF\',\'\')" onmouseout="cngBg(this, \'#EEEFEB\', \'#717070\',\'\')" onclick="selectWeek(1)">M</th> <th class="td1" onmouseover="cngBg(this, \'#9D9E9B\', \'#FFFFFF\',\'\')" onmouseout="cngBg(this, \'#EEEFEB\', \'#717070\',\'\')" onclick="selectWeek(2)">T</th> <th class="td1" onmouseover="cngBg(this, \'#9D9E9B\', \'#FFFFFF\',\'\')" onmouseout="cngBg(this, \'#EEEFEB\', \'#717070\',\'\')" onclick="selectWeek(3)">W</th> <th class="td1" onclick="selectWeek(4)">T</th> <th class="td1" onclick="selectWeek(5)">F</th> <th class="td1" onclick="selectWeek(6)">S</th> </tr>'; echo '<tr>'; $firstrow = true; $cntr = 0; $arrCnt = count($dateArr); $idCntr = 0; foreach($dateArr as $dt) { list($day, $weekdayNo, $weekday, $month, $year) = explode('~', $dt); $day = (int) $day; if($firstrow) { $firstrow = false; if($weekdayNo<7) { for($cnt=1;$cnt<=$weekdayNo;$cnt++) { echo '<td class="td2"> </td>'; $cntr++; } } } $currday = 0; $styleColor = ''; $markidforcurrday = ''; if(mktime(0,0,0, $day, $month, $year) == mktime(0,0,0, date('d'), date('m'), date('Y')) ) { $styleColor = ' style="color:blue;font-weight:400;" '; $currday = 1; $markidforcurrday='_1'; } echo '<td align="center" class="td2" id="dt_'.$weekdayNo.'_'.$idCntr.$markidforcurrday.'" '.$styleColor.' onmouseover="cngBg(this, \'#B6B7B4\', \'#FFFFFF\','.$day.','.$currday.')" onmouseout="cngBg(this, \'#FFFFFF\', \'#696969\','.$day.','.$currday.')" onClick="selectDay(this, '.$day.', 1,'.$currday.');">'.$day.'</td>'; $cntr++; if($cntr==7) { echo '</tr>'; if($day<$arrCnt) echo '<tr>'; $cntr=0; $idCntr++; } } if($cntr>0) { while($cntr<7) { echo '<td class="td2"> </td>'; $cntr++; } } echo '</table>'; [attachment deleted by admin]
  3. Howdy! I ran a test with Yslow, and received a report about my files needing Expires Headers. I came up with the following for a solution: # Turn on the Expires engine ExpiresActive On # Expires after a month client accesses the file ExpiresByType image/jpeg A2592000 ExpiresByType image/jpg A2592000 ExpiresByType image/gif A2592000 ExpiresByType image/png A2592000 ExpiresByType image/x-icon A2592000 ExpiresByType text/plain A2592000 # Good for one week ExpiresByType application/x-javascript M604800 ExpiresByType text/css M604800 ExpiresByType text/javascript M604800 ExpiresByType text/html M604800 But, I am now receiving the report below. here are 9 static components without a far-future expiration date. * (2010/9/28) http://xyxy.com/css/bbbb.css * (2010/9/28) http://xyxy.com/css/cal.css * (2010/9/27) http://xyxy.com/css/dddd.css * (no expires) http://xyxy.com/cal.css * (2010/9/29) http://www.google-analytics.com/ga.js * (2010/9/27) http://xyxy.com/js/ssss.css * (2010/9/27) http://xyxy.com/js/bbbb.css * (2010/9/27) http://xyxy.com/js/cal.js * (no expires) http://xyxy.com/image/favicon.ico Can anyone offer me any advice, I am not sure what to do next?
  4. Hi everyone, I'm new to developing and was curious about Email marketing platforms such as Aweber or MailChimp. I understand the marketing benefits and the analytical data they can provide for say a newsletter or a new product launch... But, if for example, I have a social networking site. Would I want to use MailChimp to send User Signup confirmation Emalls / Password reset Emails / General contact emails...etc...? Hopefully someone can point me in the right direction. Thank you.
  5. Howdy, I have a page on my site that displays events I have uploaded. Below is the code that displays the event title. I want to know if there is a simple way to limit the characters of the title that a view will see. For example, limiting the title to 10 characters. So, if I had an event titled "My awesome new event". You would see "My awesome..." Hope this makes sense. I'm not sure if you will need to see more of the code to help me, thank you! <a href ="event-description.php?eid=<?php echo $data->EventId?>"<span class="events-title"><?php echo $data->EventTitle ?>
  6. Yeah, it was nothing special... $userObj->_userId = $_SESSION['G_userId'.CONFIG_SITE_NAME]; $userObj->getUserDetails(); echo '<span class="searchtxt"><span style="color:#3CA3E9;"><a href="settings.php" style="color:#3CA3E9;">'.$userObj->_name.'</a></span> / <a href="logout.php" >Logout </a></span>'; }
  7. Sorry again.... echo '<span class="searchtxt"><span style="color:#3CA3E9;">'.$userObj->_name.'</span> / <a href="logout.php" >Logout </a></span>';
  8. Sorry. Ok What I'm trying to do is make the the echoed statement that I highlighted in Red, a link. The page I want to link to is the <a href> highlight in green --> "Settings.php"
  9. Thanks, but I'm not sure that is what I'm looking for. Any other suggestions?
  10. Hi guys, I'm trying to add this link <a href="<?php CONFIG_SITE_PATH ?>/settings.php"> to somewhere in the red text below. Can someone please show me how/where I would do this. $userObj->_userId = $_SESSION['G_userId'.CONFIG_SITE_NAME]; $userObj->getUserDetails(); echo '.$userObj->_name.'</span> / <a href="logout.php" >Logout</a></span>';
  11. Hey Everyone, I need some help with a search bar I'm working on. I am trying to make it so it will highlight the entire field, essentially looking like the first image attached. But, after working on it for a while, I can't figure out another solution besides the one below, which looks like my second image attached. <form name="searchFrm" method="get" style="margin:0px" action="search.php"> <!-- search form start --> <div class="search-bgimg" id="search-bgimg"> <div class="searchboxinput"> <input type="text" name="search" id="searchtext" class="inputsearchbox" value="search..." onfocus="if(this.value =='search...'){this.value='';};chbgimg(1);" onblur="if(this.value=='')this.value='search...';chbgimg(0);"> </div> </div> </form> <!-- end of search form --> .search { width:220px; float:right; margin-right:0px; } .searchtxt { padding:7px 0px 0px 0px; float:right; font-size:14px; font-weight: 400; color:#717070; } .searchtxt a:hover { text-decoration: underline; } .search-bgimg { background-image: url('../image/searchbox-bgimg.png'); margin-top:10px; padding:3px 3px 0 0px; float:right; width:216px; height:25px; } .searchboximg { margin: 0px 0px 0px 1px; height:19px; width:28px; float:left; padding-top:1px; padding-left:3px } .searchboxinput { position:absolute; margin: 2px 0px 0px 25px; } .inputsearchbox { height:15px; width:186px; font-size:14px; font-weight: 300; border: 0px solid #717070; } [attachment deleted by admin]
  12. Howdy everyone. I'm looking to find a developer to build a coupon / reward script that will allow businesses on my site to create coupons that their customers can be print / download. I was wondering if anyone out there has built a similar application before and has any advice before I take a stab at this. Any advice is appreciated, Thanks.
  13. <?php $error = ''; $name = ''; $organizaton = ''; $email = ''; $subject = ''; $comments = ''; $verify = ''; if(isset($_POST['contactus'])) { $name = $_POST['name']; $oranization = $_POST['organiation']; $email = $_POST['email']; $subject = $_POST['subject']; $comments = $_POST['comments']; $verify = $_POST['verify']; if(trim($name) == '') { $error = '<div class="error_message">You must enter your name.</div>'; } else if(trim($email) == '') { $error = '<div class="error_message">Attention! Please enter a valid email address.</div>'; } else if(!isEmail($email)) { $error = '<div class="error_message">Attention! You have enter an invalid e-mail address, try again.</div>'; } else if(trim($subject) == '') { $error = '<div class="error_message">Attention! Please enter a subject.</div>'; } else if(trim($comments) == '') { $error = '<div class="error_message">Attention! Please enter your message.</div>'; } else if(trim($verify) == '') { $error = '<div class="error_message">Attention! Please enter the verification number.</div>'; } else if(trim($verify) != $_SESSION['UserData']['Math'][0]+$_SESSION['UserData']['Math'][1]){ $error = '<div class="error_message">Attention! The verification number you entered is incorrect.</div>'; } if($error == '') { if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); } $address = "john@aol.com"; $e_subject = 'You\'ve been contacted by ' . $name . '.'; $e_body = "You have been contacted by $name with regards to $subject, their additional message is as follows.\r\n\n"; $e_content = "\"$comments\"\r\n\n"; $e_reply = "You can contact $organzation, $name via email, $email"; $msg = $e_body . $e_content . $e_reply; mail($address, $e_subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n"); // Email has sent successfully, success page. echo "<div id='succsess_page'>"; echo "<h1>Email Sent Successfully.</h1>"; echo "</div>"; } } if(!isset($_POST['contactus']) || $error != '') { ?> <fieldset> <legend>Contact Form</legend> <? echo $error; ?> <form method="post" action=""> <label for=name accesskey=U><span class="required">*</span>Name</label> <input name="name" type="text" id="name" size="35" value="<?=$name;?>" /> <br /> <label for=name accesskey=U>Organization</label> <input name="organization" type="text" id="organization" size="35" value="<?=$organization;?>" /> <br /> <label for=email accesskey=E><span class="required">*</span>Email</label> <input name="email" type="text" id="email" size="35" value="<?=$email;?>" /> <br /> <label for=subject accesskey=S><span class="required">*</span>Subject</label> <select name="subject" class="gray" type="text" id="subject"> <option value="Support">Support</option> <option value="Other">Other</option> </select> <br /> <label for=comments accesskey=C><span class="required">*</span>Comments</label> <textarea name="comments" cols="40" rows="3" id="comments"><?=$comments;?></textarea> <br /> <?php $_SESSION['UserData']['Math'][0] = rand(1,5); $_SESSION['UserData']['Math'][1] = rand(1,5); ?> <?php echo "<span class='label'><span class='required'>*</span>What is ".$_SESSION['UserData']['Math'][0]." + ".$_SESSION['UserData']['Math'][1]."?</span> "; ?> <input name="verify" type="text" id="verify" size="3" value="<?=$verify;?>" /><br /><br /> <input name="contactus" type="submit" class="submit" id="contactus" value="send it" /> </form> </fieldset> <? } function isEmail($email) { // Email address verification, do not edit. return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email)); } ?>
  14. The code generates a random addition problem.
  15. The code is being used on my contact form. Right now I receive the error message even when I input the correct value.
  16. Hi guys. I'm using php to randomly generate a simple math verification question. But, I'm having a hard time validating the input. Can someone please tell me what I'm doing wrong? Thank you } else if(trim($verify) != $_SESSION['UserData']['Math'][0]+$_SESSION['UserData']['Math'][1]){ $error = '<div class="error_message">Attention! The verification number you entered is incorrect.</div>'; } <?php echo "<span class='label'><span class='required'>*</span>What is ".$_SESSION['UserData']['Math'][0]." + ".$_SESSION['UserData']['Math'][1]."?</span> "; ?> <input name="verify" type="text" id="verify" size="3" value="<?=$verify;?>" /><br /><br />
  17. Hi guys. I need some help here with a some javascript tabs. I'd like to modify this script so that I can have 3 tabs with different widths. Right now the script requires me to use the same width on each tab. Here is the tab script I am using. Thanks in advance for helping me. <!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" xml:lang="en" lang="en"> <head> <title>tabs</title> <style type="text/css"> body { margin: 10px; font-family: Arial; font-size: 12px; } .updBtn_Container { width: 400px; height:275px; margin-bottom: 10px; float: left;} .updBtn_Bar { clear: both; width: 397px; height: 27px; border-bottom: 1px solid #cde6fe; padding-left: 5px; } .updBtn_ContentPanel { clear: both; width: 400px; height: 240px; border: 1px solid #afcfee; border-top: 0px; background-color: #ffffff; } .updBtn_Content { clear: both; width: 380px; height: 240px; padding: 10px;} .updBtn { float: left; width: 80px; background: url(images/updBtn.jpg) repeat-x #F7F7F7; border: 1px solid #afcfee; border-bottom: 0px; height: 16px; padding: 5px; text-align: center; margin-right: 3px; color: #333333; cursor: pointer;} .updBtn_Highlight { float: left; width: 80px; background: url(images/updBtn_h.jpg) repeat-x #F7F7F7; border: 1px solid #afcfee; border-bottom: 0px; height: 16px; padding: 5px; text-align: center; margin-right: 3px; color: #000000; cursor: pointer;} .updBtn_Selected { float: left; width: 80px; background-color: #ffffff; border: 1px solid #afcfee; border-bottom: 1px solid #ffffff; color: #52738f; height: 16px; padding: 5px; text-align: center; margin-right: 3px; cursor: pointer;} </style> <script language="javascript" type="text/javascript"> function updButton(obj) { var cls = obj.className; if(cls!='updBtn_Selected') { if(cls=='updBtn') { cls = 'updBtn_Highlight'; } else { cls = 'updBtn'; } } obj.className = cls; } function selectUpd(obj) { for (var x = 1; x <= 3; x++) { document.getElementById("updButton"+x).className = 'updBtn'; document.getElementById("updContent"+x).style.display = 'none'; } obj.className='updBtn_Selected'; var tmp = obj.id; var num = tmp.substr(tmp.length-1); document.getElementById("updContent"+num).style.display = 'block'; } </script> </head> <body> <div class="updBtn_Bar"> <div id="updButton1" onclick="javascript: selectUpd(this);" class="updBtn_Selected" onmouseover="javascript: updButton(this);" onmouseout="javascript: updButton(this);">LINK 1</div> <div id="updButton2" onclick="javascript: selectUpd(this);" class="updBtn" onmouseover="javascript: updButton(this);" onmouseout="javascript: updButton(this);">LINK 2</div> <div id="updButton3" onclick="javascript: selectUpd(this);" class="updBtn" onmouseover="javascript: updButton(this);" onmouseout="javascript: updButton(this);">LINK 3</div> </div> <div class="updBtn_ContentPanel"> <div id="updContent1" class="updBtn_Content">Content Of Link 1</div> <div id="updContent2" class="updBtn_Content" style="display: none;">Content Of Link 2</div> <div id="updContent3" class="updBtn_Content" style="display: none;">Content Of Link 3</div> </div> </body> </html>
  18. Hey guys. Jusy starting to learn how to program. I have a comments thread on my website. I'm trying to write a basic script that will allow users to 'report comments for moderation' Everything seems to be working except that when i send a report the emails that i receive don't include the subject or comment of the form. Also, I receive the email multiple times. Any help would be greatly appreciated. Here's my script so far... <?php if(empty($errors)){ $subject = "Comment Report"; $headers = "From: support@".EMAIL_DOMAIN." <support@".EMAIL_DOMAIN.">\\r\\n"; $headers .= "Reply-To: support@".EMALI_DOMAIN."\\r\\n"; $headers .= "Return-Path: support@".EMAIL_DOMAIN."\\r\\n"; $headers .= "X-Mailer: PHP/".phpversion()."\\r\\n"; $message = "Subject: ".$inputs['subject']." Comments: ".$inputs['comment']; mail("support@mysite.com",$subject,$message,$headers); $sent = 1; } $subjects = array("Comment posted on wrong profile.","Inappropriate or offensive language.","Violation of Terms of Service."); ?> <div class="bg_wide"> <p style='font-size: 17px; font-weight: bold; color: #B2FF24; text-align: left; padding-left: 15px; padding-top: 15px;'> Report a comment </p> <p style='font-size: 13px; font-weight: normal; color: #fff; text-align: left; line-height: 14pt; padding-top: 10px; padding-left: 16px; width: 94%;'> In order to report this comment to our attention please select a reason below. If necessary, feel free to include more details in the text field. Thank you for keeping a lookout! </p> <br /> <form action="report.php" method="post"> <table class="f_input"> <tr> <td> <?php echo "<select name='subject' style='width: 235px; margin-bottom: 5px; padding: 2px; margin-left: 13px;'>"; foreach($subjects as $v){ echo "<option value='".$v."' "; if($_POST['subject'] == $v){ echo "selected='selected'"; } echo ">".$v."</option>"; } echo "</select>"; ?> </td> </tr> <tr> <td> <textarea name='comment' rows='10' cols='20' style='width: 385px; height: 65px; font-size: 14px; padding-left: 2px; margin-left: 13px;>'><?php echo $inputs['comment'];?></textarea> </td> </tr> </table> <table> <tr style='height: 33px;'> <td style="width: 150px;"></td> <td style='padding-left: 112px; padding-top: 10px;'> <input type="submit" class="send_button" value="" /> </td> </tr> </table> </div> </form> Thank you for the help!
  19. Hey guys. I'm pretty new to programming, so please bare with me...I'm stuck right now.... I have a function that allows users to select images from a drop down. If the user wants to upload a new photo they can select that option from the drop down as well. The issue I'm having is that the portion of the script for the new image does not seem to work. (meaning it will not show up when you select "new image") I can't figure out, it was working for a little while earlier. Please help!!!! GET FUNCTION <table class="f_input"> <tr> <td class='f_label' style='width: 122px;'> My photo </td> <td> <?php $q = "Select ImageID, Name, Ext from `".IMAGES_TABLE."` Where UserID = '".$this->userid."' ORDER BY Name"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); echo "<select name='imageid' style=' width: 150px; padding: 2px; onchange='e_add_image();'"; if(!empty($this->inputs_errors['venue'])){echo "style='border: 1px solid #cc3300;'";} echo "/>"; echo "<option value='default'>--John's Default--</option>"; echo "<option value='new'>--New Image--</option>"; if(mysql_num_rows($r) >0){ while($row = mysql_fetch_assoc($r)){ echo "<option value='".$row['ImageID']."' "; if($this->inputs['imageid'] == $row['ImageID']){ echo "selected='selected' "; } echo ">".$row['Name']."</option>\\n"; $images[$row['ImageID']] = $row['Ext']; } echo "<script type='text/javascript'>"; echo "var images=new Array();"; foreach($images as $key=>$value){ echo "images[".$key."] = '".$value."';"; } echo "</script>"; } ?> </td> </tr> </table> <table class='f_input' id='a_e_newimage' style='display:none;'> <tr> <td class='f_label' style='width: 150px;'> New image name </td> <td> <input style='width: 190px; height: 18px;' type='text' name='new_image_name' value=""/> </td> </tr> <tr> <td class='f_label' style='width: 150px;'> Upload new photo </td> <td> <input type='file' name='image' style='height: 25px; border: none;' /> </td> </tr> </table> POST FUNCTON if($inputs['imageid'] == "new"){ $q = "Select ImageID from `".IMAGES_TABLE."` Where Name = '".$inputs['new_image_name']."' and UserID = '".$this->userid."'"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); if(mysql_num_rows($r) >0){ $errors['new_image_name'] = "You have already uploaded an image with this name."; } else{ $update = 1; if($_FILES['image']['error'] != '0'){ $errors['image'] = "An unknown error occurred while your image was uploaded"; $update = 0; } if($_FILES['image']['size'] > MAX_IMAGE_SIZE){ $errors['image'] = "The image file that you uploaded was too large."; $update = 0; } $i_dat = getimagesize($_FILES['image']['tmp_name']); $i_types = array("image/jpeg","image/png","image/gif"); if(!in_array($i_dat['mime'],$i_types)){ $errors['image'] = "The image must be a jpeg, gif or png."; $update = 0; } if($update == 1){ $q = "INSERT INTO `".IMAGES_TABLE."` (UserID, Name) VALUES('".$this->userid."', '".$inputs['new_image_name']."')"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); $imgid = mysql_insert_id(); $inputs['imageid'] = $imgid; $width = $i_dat[0]; $width_max = 250; $height = $i_dat[1]; $height_max = 250; $tmp_name = $this->userid."_".date("U").".txt"; $tmp_pos = UPLOADS.$tmp_name; move_uploaded_file($_FILES['image']['tmp_name'],$tmp_pos); image_upload($tmp_name,$imgid); } } } else{ $q = "Select ImageID from `".IMAGES_TABLE."` Where UserID = '".$this->userid."' and ImageID = '".$inputs['imageid']."' LIMIT 1"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); if(mysql_num_rows($r) >0){ } else{ $q = "Select ImageID from `".EVENTS_CAT_TABLE."` Where ECatID = '".input_clean($inputs['cat'])."'"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); $row = mysql_fetch_assoc($r); $inputs['imageid'] = $row['ImageID']; } } Thank you in advance
  20. Hey guys. I'm pretty new to programming, so please bare with me...I'm stuck right now.... I have a function that allows users to select images from a drop down. If the user wants to upload a new photo they can select that option from the drop down as well. The issue I'm having is that the portion of the script for the new image does not seem to work. (meaning it will not show up when you select "new image") I can't figure out, it was working for a little while earlier. Please help!!!! GET FUNCTION <table class="f_input"> <tr> <td class='f_label' style='width: 122px;'> My photo </td> <td> <?php $q = "Select ImageID, Name, Ext from `".IMAGES_TABLE."` Where UserID = '".$this->userid."' ORDER BY Name"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); echo "<select name='imageid' style=' width: 150px; padding: 2px; onchange='e_add_image();'"; if(!empty($this->inputs_errors['venue'])){echo "style='border: 1px solid #cc3300;'";} echo "/>"; echo "<option value='default'>--John's Default--</option>"; echo "<option value='new'>--New Image--</option>"; if(mysql_num_rows($r) >0){ while($row = mysql_fetch_assoc($r)){ echo "<option value='".$row['ImageID']."' "; if($this->inputs['imageid'] == $row['ImageID']){ echo "selected='selected' "; } echo ">".$row['Name']."</option>\\n"; $images[$row['ImageID']] = $row['Ext']; } echo "<script type='text/javascript'>"; echo "var images=new Array();"; foreach($images as $key=>$value){ echo "images[".$key."] = '".$value."';"; } echo "</script>"; } ?> </td> </tr> </table> <table class='f_input' id='a_e_newimage' style='display:none;'> <tr> <td class='f_label' style='width: 150px;'> New image name </td> <td> <input style='width: 190px; height: 18px;' type='text' name='new_image_name' value=""/> </td> </tr> <tr> <td class='f_label' style='width: 150px;'> Upload new photo </td> <td> <input type='file' name='image' style='height: 25px; border: none;' /> </td> </tr> </table> POST FUNCTON if($inputs['imageid'] == "new"){ $q = "Select ImageID from `".IMAGES_TABLE."` Where Name = '".$inputs['new_image_name']."' and UserID = '".$this->userid."'"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); if(mysql_num_rows($r) >0){ $errors['new_image_name'] = "You have already uploaded an image with this name."; } else{ $update = 1; if($_FILES['image']['error'] != '0'){ $errors['image'] = "An unknown error occurred while your image was uploaded"; $update = 0; } if($_FILES['image']['size'] > MAX_IMAGE_SIZE){ $errors['image'] = "The image file that you uploaded was too large."; $update = 0; } $i_dat = getimagesize($_FILES['image']['tmp_name']); $i_types = array("image/jpeg","image/png","image/gif"); if(!in_array($i_dat['mime'],$i_types)){ $errors['image'] = "The image must be a jpeg, gif or png."; $update = 0; } if($update == 1){ $q = "INSERT INTO `".IMAGES_TABLE."` (UserID, Name) VALUES('".$this->userid."', '".$inputs['new_image_name']."')"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); $imgid = mysql_insert_id(); $inputs['imageid'] = $imgid; $width = $i_dat[0]; $width_max = 250; $height = $i_dat[1]; $height_max = 250; $tmp_name = $this->userid."_".date("U").".txt"; $tmp_pos = UPLOADS.$tmp_name; move_uploaded_file($_FILES['image']['tmp_name'],$tmp_pos); image_upload($tmp_name,$imgid); } } } else{ $q = "Select ImageID from `".IMAGES_TABLE."` Where UserID = '".$this->userid."' and ImageID = '".$inputs['imageid']."' LIMIT 1"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); if(mysql_num_rows($r) >0){ } else{ $q = "Select ImageID from `".EVENTS_CAT_TABLE."` Where ECatID = '".input_clean($inputs['cat'])."'"; $r = mysql_query($q) or die(mysql_error()."<br /><br />".$q); $row = mysql_fetch_assoc($r); $inputs['imageid'] = $row['ImageID']; } } Thank you in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.