Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About SkyRanger

  • Rank
    Prolific Member

Contact Methods

  • MSN

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

2,113 profile views
  1. Found the issue. Part of a table name was missing, thanks all.
  2. Not sure what I am missing. When submitted gives white page with no submission. Error check is not showing anything. global $userdata, $current_user; $tablename=kudos_table_name(); // Functions to filter user inputs function filterkudoagent($field){ // Sanitize user name $field = filter_var(trim($field), FILTER_SANITIZE_STRING); // Validate user name if(filter_var($field, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>"/^[a-zA-Z-\s]+$/")))){ return $field; } else { return FALSE; } } function filterkudocust($field){ // Sanitize user name $field = filter_var(trim($field), FILTER_SANITIZE_STRING); // Validate user name if(filter_var($field, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>"/^[a-zA-Z-\s]+$/")))){ return $field; } else { return FALSE; } } function filterString($field){ // Sanitize string $field = filter_var(trim($field), FILTER_SANITIZE_STRING); if(!empty($field)){ return $field; } else{ return FALSE; } } $kudoagentErr = $agentlocErr = $kudoclientErr = $kudocustErr = $kudomsgErr = $kudoadnErr = ""; $kudoagent = $agentloc = $kudoclient = $kudocust = $kudomsg = $kudoadn = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if(empty($_POST["kudoagent"])){ $kudoagentErr = "Please enter agent name."; } else{ $kudoagent = filterkudoagent($_POST["kudoagent"]); if($kudoagent == FALSE){ $kudoagentErr = "Please enter a valid agent name."; } } if(empty($_POST['agentloc'])){ $agentlocErr = "You must select a location"; } if(empty($_POST['kudoclient'])){ $kudoclientErr = "You must select a queue"; } if(empty($_POST["kudocust"])){ $kudocustErr = "Please enter customer name."; } else{ $kudocust = filterkudocust($_POST["kudocust"]); if($kudocust == FALSE){ $kudocustErr = "Please enter a valid customer name."; } } if(empty($_POST["kudomsg"])){ $kudomsgErr = "Please enter the kudos."; } else{ $kudomsg = filterString($_POST["kudomsg"]); if($kudomsg == FALSE){ $kudomsgErr = "Please enter a valid kudos."; } } if(empty($_POST["kudoadminname"])){ $kudoadnErr = "Please enter the posters name."; } else{ $kudoadn = filterkudocust($_POST["kudoadminname"]); if($kudoadn == FALSE){ $kudoadnErr = "Please enter a valid posters name."; } } if (isset($_POST['kudoagentid']) && trim($_POST['kudoagentid']) != '') { $kudoagidErr = "Enter Agent ID or leave blank"; } else { $kudoacctErr = ""; } if (isset($_POST['kudoacct']) && trim($_POST['kudoacct']) != '' && !ctype_digit($_POST['kudoacct'])) { $kudoacctErr = "Only numbers are permitted or leave blank"; } else { $kudoacctErr = ""; } if(empty($kudoagentErr) && empty($kudocustErr) && empty($kudomsgErr) && empty($agentlocErr) && empty($kudoclientErr) && empty($kudoadnErr)){ global $wpdb; $table = $tablename; $kudokey = randkey(); $kudoposted = date("Y-m-d H:i:s"); $data = array( 'kudoid' => '', 'kudomsg' => $_POST['kudomsg'], 'kudoagent' => $_POST['kudoagent'], 'kudoagentid' => $_POST['kudoagentid'], 'kudocust' => $_POST['kudocust'], 'kudoacct' => $_POST['kudoacct'], 'kudoclient' => $_POST['kudoclient'], 'kudoloc' => $_POST['agentloc'], 'kudoentry' => $kudoposted, 'kudoadmin' => $_POST['kudoadminname'], 'kudopic' => $_POST['kudobanner'], 'kudostatus' => '1', 'kudokey' => $kudokey, ); $format = array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ); $success=$wpdb->insert( $table, $data, $format ); if($success){ echo "<blockquote class=\"otro-blockquote\">"; echo nl2br($_POST['kudomsg']); echo "<span>"; echo "<b>Kudos for:</b> " .$_POST['kudoagent']. " " .$_POST['kudoagentid']. ", ".$_POST['agentloc']; echo "<br>By: ".$_POST['kudocust']. ", " . date("F j, Y g:i a", strtotime($kudoposted)); echo "<br/>" .$_POST['kudoacct']; echo "<br/> Submitted By: " .$_POST['kudoadminname']; echo "</span></blockquote>"; $urlparts = parse_url(home_url()); $kudourl = $urlparts['host']; echo "<div class='success_msg'>Kudos Submitted</div>"; } } } else { ?> <h3>Add Kudos - No Notification Sent</h3> <b>* states required</b> <form name="kudos_form" id="submitkudos" method="post" action="" enctype="multipart/form-data"> <table class="addkudotable"> <tr> <td>Agent Name *</td> <td> </td> <td><input name="kudoagent" type="text" value="<?php echo $_POST['kudoagent']; ?>"/> <?php echo "<div class='note'>".$kudoagentErr."<br/>";?> </td> </tr> <tr> <td>Agent ID</td> <td></td> <td><input name="kudoagentid" type="text" value="<?php echo $_POST['kudoagentid']; ?>" /> <?php echo "<div class='note'> </div>";?> </td> </tr> <tr> <td>Agent Location *</td> <td></td> <td><select name="agentloc" size="1"> <option value="<?php echo $_POST['agentloc']; ?>"><?php echo $_POST['agentloc']; ?></option> <option></option> <option value="Amherst Center">Amherst Center</option> <option value="Charlottetown Center">Charlottetown Center</option> <option value="Kingston Center">Kingston Center</option> </select> <?php echo "<div class='note'>".$agentlocErr."</div>";?> </td> </tr> <tr> <td>Agent Queue *</td> <td></td> <td><select name="kudoclient" size="1"> <option value="<?php echo $_POST['kudoclient']; ?>"><?php echo $_POST['kudoclient']; ?></option> <option value=""></option> <option value="AR">AR</option> <option value="Eastlink Tech Support">Eastlink Tech Support</option> <option value="PNI">PNI</option> </select> <?php echo "<div class='note'>".$kudoclientErr."</div>";?> </td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td>Customer Name *</td> <td></td> <td><input name="kudocust" type="text" value="<?php echo $_POST['kudocust']; ?>"/> <?php echo "<div class='note'>".$kudocustErr."</div>";?> </td> </tr> <tr> <td>Customer Account #</td> <td></td> <td><input name="kudoacct" type="text" value="<?php echo $_POST['kudoacct']; ?>" /> <?php echo "<div class='note'>".$kudoacctErr."</div>";?> </td> </tr> <tr> <td>Kudos *</td> <td></td> <td><textarea cols="50" name="kudomsg" rows="5"><?php echo $_POST['kudomsg']; ?></textarea> <?php echo "<div class='note'>".$kudomsgErr."</div>";?> </td> </tr> <tr> <td></td> <td></td> <td></td> </tr> <tr> <td>Choose Image</td> <td></td> <td><select onchange="$('#imageToSwap').attr('src', this.options[this.selectedIndex].value);" name="kudobanner"> <option value="<?php echo plugins_url(); ?>/img/kudos/1.jpeg" selected>Kudos 1</option> <option value="<?php echo plugins_url(); ?>/kudos/img/kudos/2.jpg">Kudos 2</option> <option value="<?php echo plugins_url(); ?>/kudos/img/kudos/3.png">Kudos 3</option> <option value="<?php echo plugins_url(); ?>/kudos/img/kudos/4.png">Kudos 4</option> <option value="<?php echo plugins_url(); ?>/kudos/img/kudos/5.png">Kudos 5</option> <option value="<?php echo plugins_url(); ?>/kudos/img/kudos/6.jpg">Kudos 6</option> <option value="<?php echo plugins_url(); ?>/kudos/img/kudos/7.jpg">Kudos 7</option> <option value="<?php echo plugins_url(); ?>/kudos/img/kudos/8.jpg">Kudos 8</option> <option value="<?php echo plugins_url(); ?>/kudos/img/kudos/9.png">Kudos 9</option> </select></td> </tr> <tr> <td>Agent submitting Kudos</td> <td></td> <td><input name="kudoadminname" type="text" value="<?php echo $_POST['kudoadminname']; ?>"> <?php echo "<div class='note'>".$kudoadnErr."</div>";?></td> </tr> <tr> <td> </td> <td><input type="hidden" name="action" value=""/></td> <td></td> </tr> <tr> <td><button type="submit" value="submit" class="aciformbutton" name="submit" />Submit Kudos</button> <td></td> <td><button type="reset" value="reset" class="aciformbutton">Start Over</button></td> </tr> </table> <input type="hidden" value="" name="kudoentry"> </form> <script> </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <?php echo "<img id=\"imageToSwap\" class=\"profile\" src=" . plugins_url() . "/kudos/img/kudos/1.jpeg>"; }
  3. lol, thanks Barand. I was able to test it and it worked. So now it is bilingual but not Multi at this time. Maybe down the road.
  4. Adding this should work should it not? À-ÿ regexp"=>"/^[a-zA-ZÀ-ÿ-\s]+$/
  5. Then I am in trouble because it never crossed my mind until you brought it up.
  6. Figured it out. Was putting the - in the wrong spot: options"=>array("regexp"=>"/^[a-zA-Z-\s]+$/")))){
  7. Having a validation issue when a person enters a - in there name it is kicking it back as invalid. For axample: Mary-Ann Invalid Mary Ann Valid Tried including the - but causing myself a lot of grief. function filterkudoagent($field){ // Sanitize user name $field = filter_var(trim($field), FILTER_SANITIZE_STRING); // Validate user name if(filter_var($field, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>"/^[a-zA-Z\s]+$/")))){ return $field; } else { return FALSE; } }
  8. Awesome Barand thank you. I also see what I can start it on any day. Again thank you. Much easier than what I was attempting to do and PS: This link in your signature. Still reading it over. Thank you
  9. I am currently working on a date range script and wondering if anybody think of an easier way to do this, doing up to next 8 weeks? This one starts on a Sunday. I also need to do one starting on a Monday (will figure that one later) $thisweek = date("Y-m-d"); $week = date('w', strtotime($thisweek)); $date = new DateTime($thisweek); $firstWeek = $date->modify("-".$week." day")->format("M d"); $endWeek = $date->modify("+6 day")->format("M d"); echo $firstWeek." - "; echo $endWeek; $nextweek = date(("Y-m-d"), strtotime("+7 Days")); $week1 = date('w', strtotime($nextweek)); $date1 = new DateTime($nextweek); $firstWeek1 = $date1->modify("-".$week1." day")->format("M d"); $endWeek1 = $date1->modify("+6 day")->format("M d"); echo $firstWeek1." - "; echo $endWeek1;
  10. Thank you to the both of you. I am almost 50, doing this late in life and self teaching with the help of great people like you. Thank you again.
  11. It does Barand. Thank you. Shows how much I know about sql. Did not know you could use a select within a select. Learning something new every day.
  12. Thanks Barand, I actually got it to work perfectly from the Sept 9th post you helped me with but been away for a bit and first time back to comment on benanamen post and try to solve another problem I posted in a different through with pulling random posts that I know I have done dozens of times but having a brain meltdown...lol
  13. Right now I have a little over 400 entries but I am trying to figure out how to only pull 1 entry from the last 10 inserted. Currently I have: SELECT * FROM $tablename ORDER BY RAND() LIMIT 1 I do know I need to do order by kuid asc but not sure how to pull 1 out of the last 10 inserted randomly on page refresh.
  • 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.