Jump to content

Presto-X

Members
  • Posts

    187
  • Joined

  • Last visited

Everything posted by Presto-X

  1. Thanks guys, I will give that a shot, thanks Jessica. TOA, yes, but it is less annoying to keep seeing the same image back to back
  2. Hey guys, I'm stumped, I'm trying to pull in a (as in 1) random image from a dir each time the page loads, I have that part down, but what I am having problems with is, if there are only 5 or so images in the folder, you have a 1 in 5 chance that the same image will get displayed twice. How can I keep this from happening? header("Content-type: image/jpeg"); $img = glob('images/*.{jpg,jpeg,png,gif}', GLOB_BRACE); $img = $img[array_rand($img)]; imagejpeg(imagecreatefromjpeg($img));
  3. So I just set the userid, seminarid, and action columns as primary keys, and changed my query to the following, still no go: INSERT INTO conferences_seminar_sessions (userid, eventid, theaterid, seminarid, action) VALUES ('816', '1', '1', '6', '1') ON DUPLICATE KEY UPDATE created=VALUES('2012-12-27 07:03:40')
  4. Hey guys, thanks for the replies. So here is my query SQL=INSERT INTO conferences_seminar_sessions (userid, eventid, theaterid, seminarid, action) VALUES ('816', '1', '1', '6', '1') ON DUPLICATE KEY UPDATE VALUES (userid='816', eventid='1', theaterid='1', seminarid='6', action='1'); What I need to do is make sure that the user has not already signed in to a seminar, if so do nothing or just update the current row with the current timestamp ether of these options work what ever is easier. So I'm guessing I need to check if the user has checked in to the seminar and if the action matches (1=checked in, 2=checked out). So check if userid, seminarid, and action match any other row. Should I be doing a query first to look if there are any matches if not add a new row, if so update the current row?
  5. So if I set the userid, eventid, theatherid, and seminarid as primary keys and remove the key and auto increment from the id column it seems to work, but I want auto increment on the id column :-\
  6. Or maybe I should be using REPLACE INTO or maybe even INSERT IGNORE INTO? heck I don't know lol
  7. Hello guys, I’m trying to build a query that adds a user’s check in / out date and time in to the database, basically I need to check if 5 columns match if so update the row, if not add a new row. I thought this was going to be easy but after a few hours of reading, I am still not able to get the query to work *sigh* This is how my table is built: CREATE TABLE `conferences_seminar_sessions` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userid` int(11) NOT NULL, `eventid` int(11) NOT NULL, `theaterid` int(11) NOT NULL, `seminarid` int(11) NOT NULL, `action` tinyint(1) NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; And this is my query: $query = " INSERT INTO cswconferences_seminar_sessions (userid, eventid, theaterid, seminarid, action) VALUES ('" . $userid . "', '" . $eventid . "', '" . $theaterid . "', '" . $seminarid . "', '" . $action . "') ON DUPLICATE KEY UPDATE userid=userid+'" . $userid . "' AND eventid=eventid+'" . $eventid . "' AND theaterid=theaterid+'" . $theaterid . "' AND seminarid=seminarid+'" . $seminarid . "' AND action=action+'" . $action . "' ;";
  8. Hello guys, I built this site atop Joomla 2.5 using Twitter bootstrap v2.0.3 at the start of the year and it has been running great, I tested it on all of the latest browsers, iPhone, and iPad all seem to be working great, however I have gotten reports that it does not load on android devices and I cannot find anything that would cause the site not to load. I downloaded the latest android sdk to use the browser emulator and it loaded the site just fine, I'm stumped, does anything in the code jump out at you that would cause the site from loading? http://www.shawnlindsay.org
  9. I completely agree with you guys, I think its a stupid idea, but my boss and all of his wisdom wants the users to use their real company email address. Gizmola, thanks I did not even think of that lol I will get it added.
  10. Hello guys, I'm trying to restrict free email providers domain's from our sign up form so they have to use their company's email address not their free spam email account. Below is the code I have written so far, it seems like it would work, and it seems to work most of the time, but from time to time one or two will slip in, how is that possible? $domains = array('gmail','msn','yahoo','hotmail','excite','lycos','aol','inbox','fastmail','mail','maricopa','care2','zenbe','gmx','gawab','goowy','hotpop','mybestmail','bigstring','live','comcast','cableone','qwest','earthlink','netzero','clearwire','mybluedish','wildblue','clear'); $emailDomain = explode('@',$_POST['email']); $emailDomain = explode('.',$emailDomain[1]); if(in_array($emailDomain[0],$domains)){ $error_msg = 'Sorry your email\'s domain is not allowed, please use your associated company email.'; }else{ // Add the user to the database. }
  11. Hey guys, I'm working on a Google map with multiple locations, it seems to be working fine, what I want to do is have an HTML list of the locations below the map (also working fine) with a view button, when you click that it will open the infowindow attached to the correct marker on the Google map. I really suck at JavaScript and have not been able to get this working, I'm a PHP guy lol Here is a link to what I have so far: http://jsfiddle.net/Presto/Ch3bz/ Please any suggestions would be greatly welcome, thanks everyone.
  12. Thanks for the replies, So with PHP would I do something like: function getTwitterStatus($userid){ set_time_limit(2); $url = 'https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=' . $userid . '&count=1'; $xml = simplexml_load_file($url) or die("could not connect"); foreach($xml->status as $status){ $tweet = array( 'created' => how_long_ago(strtotime($status->created_at)), 'text' => $status->text, 'username' => $status->user->screen_name); } return $tweet; }
  13. Hey guys, I'm working on a script that pulls my latest tweet from twitter, the script seems to work really well, the only problem that I found, is when twitter is overloaded the script times out, but you have to wait like 30 sec. for the page to load to tell you that. Is there away to set a timeout of like 2-3 sec. then if its not done kick out a nice error message, or better yet read from a local cache file? Here is my current script: function getTwitterStatus($userid){ $url = 'https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=' . $userid . '&count=1'; $xml = simplexml_load_file($url) or die("could not connect"); foreach($xml->status as $status){ $tweet = array( 'created' => how_long_ago(strtotime($status->created_at)), 'text' => $status->text, 'username' => $status->user->screen_name); } return $tweet; }
  14. Hello guys, I like serching for the answer before posting as most of our questions have already been asked before but when I try searching I get the following error: Is this an issue with my account or with the forum? Is anyone else having this problem? Thanks guys.
  15. Thanks for the reply Jay, I was able to get the script working, I used the developer tools within Chrome to help me bug test my script, it looked like some of the code was for MooTools. I looked up the correct functions for jQuery and was able to get the script rewritten, I also had the same function 5 times on the page for each of the types of fields that I was using, so I was also able to make just one function, but made it a bit more flexible so I only needed one function in place of 5 wahoo lol. Maybe this will help someone else down the road, here is my working jQuery Username / email availability checker function. $(document).ready(function() { // Check Value Availability, i.e. used for check for usernames, email addresses etc. function checkAvailability(field, div, type){ var message = $(div); var input = $(field); $(input).blur(function() { if ( $(input).val().length > 0 ){ var value = encodeURIComponent( $(input).val() ); var url = 'index.php?option=com_conferencesystem&format=raw&view=checkavailability&' + type + '=' + value; message.css('display','block'); message.html('Checking username availability...'); var req = new Request.JSON({ url:url, onComplete: function(response){ if(response.msg == "true"){ message.html('<span class="ajaxStatus_available">' + response.html + '</span>'); input.attr('class', 'inputbox textfieldValidState'); }else{ message.html('<span class="ajaxStatus_unavailable">' + response.html + '</span>'); input.attr('class', 'inputbox textfieldRequiredState'); } } }); req.get(); } }); } // Check for individual fields availability $('#username1').blur( checkAvailability('#username1', '#usernameStatus', 'username') ); });
  16. I'm using some jQuery to see if a username is already in used, it calls a php file. If no-conflict is disabled the script does not work, I will be the first to say it I have no clue what I'm doing lol my background is PHP, I just started learning jQuery, please take a look at my code and tell me what I'm doing wrong here, thanks guys. $(document).ready(function() { var box1 = $('usernameStatus'); var cun1 = document.getElementById('username1'); $(cun1).addEvent("blur",function(){ if ( $(cun1).value.length > 0 ){ var url1="index.php?option=com_conferencesystem&format=raw&view=checkavailability&username="+$(cun1).value; box1.style.display="block"; box1.set('html','Checking username availability...'); var a1 = new Request.JSON({ url:url1, onComplete: function(response){ if(response.msg == "true"){ box1.set('html', '<span class="ajaxStatus_available">' + response.html + '</span>'); cun1.setAttribute("class", "inputbox textfieldValidState"); }else{ box1.set('html', '<span class="ajaxStatus_unavailable">' + response.html + '</span>'); cun1.setAttribute("class", "inputbox textfieldRequiredState"); } } }); a1.get(); } }); });
  17. At last I was able to get the script working, hopefully someone else may find use for this down the road. http://jsfiddle.net/Presto/cFeF3/ <table class="table table-striped table-bordered table-condensed"> <tbody id="coauthors"> <tr id="row0"> <td> <div id="AddFormField" class="btn btn-warning"><i class="icon-plus-sign icon-white"></i> Add</div> <div class="remainingAuthorsWrapper"><span id="remainingAuthors">5</span> Authors Remaining</div> </td> </tr> </tbody> </table> $(document).ready(function() { var row = 1; $('div#AddFormField').live("click", function() { var remainingAuthors = parseInt($('#remainingAuthors').text()); var inputs = '<tr id="row' + row + '"><td><input type="text" name="first_name[]" id="first_name' + row + '" class="inputbox span2" style="margin-bottom:0;" value="Author\'s Name" onfocus="if(this.value==\'Author\\\'s Name\'){this.value=\'\'};" onblur="if(this.value==\'\'){this.value=\'Author\\\'s Name\'};" /> <input type="text" name="femail[]" id="femail' + row + '" class="inputbox span2" style="margin-bottom:0;" value="Author\'s Email" onfocus="if(this.value==\'Author\\\'s Email\'){this.value=\'\'};" onblur="if(this.value==\'\'){this.value=\'Author\\\'s Email\'};" /> <div class="RemoveFormField btn btn-mini btn-warning"><i class="icon-trash icon-white"></i></div></td></tr>'; if(remainingAuthors > 0){ $('#coauthors').append(inputs).remainingAuthors - 1; if(remainingAuthors == 1){$('div#AddFormField').addClass('disabled');} remainingAuthors--; $('#remainingAuthors').text(remainingAuthors); row++; }else{ return; } }); $('div.RemoveFormField').live("click", function() { var remainingAuthors = parseInt($('#remainingAuthors').text()); $(this).parent().parent().remove(); remainingAuthors++; $('#remainingAuthors').text(remainingAuthors); if(remainingAuthors < 5){ $('div#AddFormField').removeClass('disabled'); } }); });
  18. Hello everyone, I'm working on a set of dynamic form fields, I have the script adding the fields correctly, the script keeps track of how many fields there are so I can limit to a total of 5, I also have a message next to the add button that counts down with each form field added. What I need help with is how to remove one of the fields and add a number back to the amount of available fields, and re-enable the add button. I setup a jsFiddle script so you could see it in action: http://jsfiddle.net/Presto/KbNDR/ It seems like I almost have it working :-\ Here is my HTML <table class="table table-striped table-bordered table-condensed"><tbody id="coauthors"><tr id="row0"><td><div id="AddFormField" class="btn btn-warning" style="float:right;"><i class="icon-plus-sign icon-white"></i> Add</div><div id="remainingAuthors" style="padding:6px 8px 0 0; float:right; font-weight:bold;">5 Authors Remaining</div></td></tr></tbody></table>​ And here is my JavaScript $(document).ready(function() { var DefaultNumber = 1; $('div#AddFormField').live("click", function() { var inputs = '<tr id="row' + DefaultNumber + '"><td><input type="text" name="first_name[]" id="first_name' + DefaultNumber + '" class="inputbox span2" style="margin-bottom:0;" value="Author\'s Name" onfocus="if(this.value==\'Author\\\'s Name\'){this.value=\'\'};" onblur="if(this.value==\'\'){this.value=\'Author\\\'s Name\'};" /> <input type="text" name="femail[]" id="femail' + DefaultNumber + '" class="inputbox span2" style="margin-bottom:0;" value="Author\'s Email" onfocus="if(this.value==\'Author\\\'s Email\'){this.value=\'\'};" onblur="if(this.value==\'\'){this.value=\'Author\\\'s Email\'};" /> <div class="RemoveFormField btn btn-mini btn-warning"><i class="icon-trash icon-white"></i></div></td></tr>'; if(DefaultNumber <= 5){ $('#coauthors').append(inputs).DefaultNumber++; if(DefaultNumber == 5){ $('div#AddFormField').addClass('disabled'); } var remainingAuthors = 5 - DefaultNumber++; $('div#remainingAuthors').html(remainingAuthors + ' Authors Remaining'); }else{ return; } }); $('div.RemoveFormField').live("click", function() { $(this).parent().parent().remove().DefaultNumber++; $('div#remainingAuthors').html(DefaultNumber + ' Authors Remaining'); if(DefaultNumber <= 4){ $('div#AddFormField').removeClass('disabled'); } }); });​
  19. Thanks so much for the replys guys, Here is my current code, yes I replaced my X's with the correct key. <!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> <?PHP $client = new SoapClient("http://www.somedomain.com/cgi-bin/testimonials.DLL/SOAP"); echo '<pre>'; print_r($client->GetQuotes('{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}', 5)); echo '</pre>'; ?> </body> </html> I get the following error, this is the same error I was getting this morning, driving me crazy lol
  20. I am trying to connect to a list of customer testimonials via SOAP and I have never had to use SOAP before so I can no clue what I’m doing lol, I did some searching on Google, but I have not been able to get anything working. Once I get a response in XML I will be good to go, please please please if you can spare a few minutes to give a hand. The owner of the dataset had this to say “The call you want is GetQuotes. The first parameter for the call includes an ID (the value of which is {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}) and the number of quotes you want returned.” This is my code so far, from what I have found off of Google $client = new SoapClient("http://www.somedomain.com/cgi-bin/testimonials.DLL/SOAP"); echo '<pre>'; print_r($client->GetQuotes(array('id' => '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'))); echo '</pre>';
  21. So I updated my PHP date code that adds the order to the database, change the date format from "Y-m-d h:i:s" to "Y-m-d H:i:s", it's working now, thanks
  22. Sigh, you are correct, I'm having PHP create the date when the order is added to the database, I think the PHP time is set for 12 hours vs 24 hours. Because the last two orders 01:17:38 and 01:18:43 where placed in the afternoon so they should have been 13:17:38 and 13:18:43
  23. Hello everyone, I have a query that I'm trying to sort by date and time so the newest order should be at the top of the page, but it is not working correctly it's showing all of the orders from today, but it's not sorting the times correctly. The mySQL column type is datetime. Here is my query: SELECT * FROM orders ORDER BY created DESC What is get is this: What I want is this:
  24. Hello Scott, I do not have XP, but I did test it in IE9 then used IE9's browser mode feature to view it as IE7/IE8 but I dont think that's the same as using IE7 on XP?
×
×
  • 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.