Jump to content

xXREDXIIIXx

Members
  • Posts

    54
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

xXREDXIIIXx's Achievements

Member

Member (2/5)

0

Reputation

  1. Exactly, but I already knew WHY I was getting the error message, I was asking if there was a way around it. Like I said it executes mid-page and possibly multiple times depending if there is more than 1 image. Not exactly sure what CURLOPT_RETURNTRANSFER. does but I added it. was working fine before without it.
  2. OK you fantastic PHPfreakers I'm not sure how to describe this so I hope you will understand.. I have a predicament where I set the header info to: header('Content-Type: text/html; charset=utf-8'); but later on I have a part of my site that requests an image from somewhere else using getImage() here I need to set header("Content-type: image/jpeg"); in order for the image to show correctly. but this conflicts with the previous page of headers already sent. so I was looking for a way around this OR maybe can I load them in after the page has loaded? I have tried using Jquery to post with ajax but I don't seem to get any response the alert does not trigger for any conversation with an image. I have tested all of this and it works as long as I don't put any OUTPUT before triggering the getImage() <script type='text/javascript'> $(document).ready(function(){ function loadImages(){ $.ajax({ type: "POST", url: "/admin/getImage.php", data: {token: '<?php echo $token; ?>', chatId: '<?php echo $chat; ?>', uId: '<?php echo $uId; ?>'}, success: function(data){ alert(data); $('#img').html(data); } }); return false; } }); </script> here is part of the messages page that would show the image. (just imagine there was more content etc..) <?php header('Content-Type: text/html; charset=utf-8'); ## OTHER GENERIC STUFF $parser = new Parser($v1, $v2); $convo = $parser->getConvo($token, $id); foreach($convo['messageGroups'] as $con) { $chat = $con['messageGroupId']; $uId = $con['latestMessage']['messageUid']; $key = $con['latestMessage']['messageKind']; if($key == '3'){ $image = $parser->getImage($token, $chat, $uId); echo $image; } } ?> here is the function for getImages() public function getImage($token, $chat, $uId){ $this->initCURL(); $chatter = str_replace("{{chat}}", $chat, $this->url['image']); $chatter = str_replace("{{uId}}", $uId, $chatter); $headerData = $this->defaultGETHeader($token); curl_setopt($this->curl, CURLOPT_URL, $chatter); curl_setopt($this->curl, CURLOPT_HTTPHEADER, $headerData); $output = curl_exec($this->curl); $this->closeCURL(); header("Content-type: image/jpeg"); return $output; }
  3. That's really down to you. you can do that or the way I said before. I personally split it up in the database.
  4. But this is a string when pulled from a database. $dob = $dob_day . '' . $dob_month . '' . $dob_year; you would need to break it down, before showing it literally your going to see for example: 2 MAY 1986 you would need to explode this $section = explode(" ", $dob); $day = $section[0]; // 2 $month = $section[1]; // May $year = $section[2]; // 1986 example of this in your script would be <option value=" January "<?php echo $section[1]; == Janurary ? ' selected="selected"' : ''; ?>>January</option> // This would be false <option value=" May "<?php echo $section[1]; == May ? ' selected="selected"' : ''; ?>>May</option> // This would be True as the month was may That being said I would still use my way $ms = array("Month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); <select name="b_month"> <?php foreach($ms as $m){ echo '<option value="'.$m.'"'.($section[1] == $m ? ' selected="selected"':'').'>'.$m.'</option>'; } ?> </select>
  5. I do a similar thing with my website, where I pull data from another source where some texts is in another language. You would just need to properly escape the apostrophes into your database. header('Content-Type: text/html; charset=utf-8'); mysqli_query($link, "SET NAMES 'UTF8'") or die("ERROR: ". mysqli_error($link));
  6. This is from a register form I created a long time ago I hope it will help you <?php // BIRTHDAY $ms = array("Month", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); $d = 1; ?> <select name="b_day"> <option value="Day">Day</option> <?php while ( $d <= 31 ) { echo '<option value="'.$d.'"'.($_POST['b_day'] == $d ? ' selected="selected"':'').'>'.$d.'</option>'; $d++; } ?> </select> <select name="b_month"> <?php foreach($ms as $m){ echo '<option value="'.$m.'"'.($_POST['b_month'] == $m ? ' selected="selected"':'').'>'.$m.'</option>'; $m++; } ?> </select> <select name="b_year"> <?php $end = date('Y'); // Current Year $start = ($end - 100); // Current Year - 100 $y = $start; ?> <option value="Year">Year</option> <? while( $y <= $end){ echo '<option value="'.$y.'"'.($_POST['b_year'] == $y ? ' selected="selected"':'').'>'.$y.'</option>'; $y++; }?> </select>
  7. if you don't want to go to a whole new page you could use JQuery to hide the previous form and then show the next one. Then just use Jquery to send all the vars of the forms filled out. JQuery $(document).ready(function(){ $("#submit_button").on("click", function(){ $("#form_2").show(); $("#form_1").hide(); }); }); HTML <div id="form_1"> <!-- Your Form 1 data here --> <div id="submit_button">Go to next form.</div> </div> <div id="form_2" style="display: none;"> <!-- Your Form 2 data here --> </div>
  8. So I have this script but apparently it is killing my shared hosting CPU usage. This is for Trophies for my own website. This foreach is repeated twice one is for Total number of trophies and the other is for the total number of platinum's. Basically I get the current total of Trophies / Platinum's Then I use the array to check if my total is higher than the current number in array if it is I then need to check if it is already in the database. then either ignore or insert it it. $gt_row is for me to pull the game_code and the xmb_order of the trophy so it can be accessed easier at a later time. If anyone can suggest a better way that be great. ## MILESTONES $tarray = array("1","100","250","500","1000","2000","3000","4000","5000","6000","7000","8000","9000","10000"); ## GET total Trophies and Platinums $row = mysqli_fetch_array(mysqli_query($link, "SELECT trophies_t,trophies_p FROM gamers_profiles WHERE gamer_id = 'xxredxiiixx'")); $count_trophies = $row['trophies_t']; $count_platinum = $row['trophies_p']; ## Check if total Trophies > then milestone foreach($tarray as $trophy){ if($count_trophies > $trophy){ ## Search milestones for existing $m_row = mysqli_fetch_array(mysqli_query($link, "SELECT COUNT(award) AS numrows FROM milestones WHERE award = '$trophy' && award_type = 'TROPHIES'")); if($m_row['numrows'] == 0){ ## Get Game Code and XMB $offset = ($trophy - 1); $gt_row = mysqli_fetch_array(mysqli_query($link, "SELECT * FROM gamers_trophies WHERE gamer_id = 'xxredxiiixx' ORDER BY date_earned ASC LIMIT $offset , 1")); $code = $gt_row['game_code']; $xmb = $gt_row['xmb_order']; $date = $gt_row['date_earned']; mysqli_query($link, "INSERT INTO milestones (game_code, xmb_order, date_earned, award_type, award) VALUES ('$code','$xmb','$date','TROPHIES','$trophy')"); } } }
  9. I have this code. its to get my stats from PSN it works on the persons website but I knt know how to use it I really only know some PHP so any help identifying and implimention would be amazing I can see some XML in there but thats about it :/ Link to the page there are 4 different code options SOAP 1.1 SOAP 1.2 HTTP POST HTTP GET I know PHP POST and GET but this looks different.. http://www.psnapi.com.ar/ps3/api/psn.asmx?op=getNumberListGames HTTP POST GET /ps3/api/psn.asmx/getNumberListGames? HTTP/1.1 Host: www.psnapi.com.ar HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <int xmlns="http://www.psnapi.com.ar/ps3/api">int</int>
  10. Maq, your a saint, SELECT * FROM t1 ORDER BY key_part1 DESC, key_part2 DESC; Works like a dream. Love you guys Bookmarked mysql.com
  11. to be honest with you I just don't know where to begin I'm actively googling now for hints etc
  12. basically i have a quiz leader board cols: username, time, correct I want to first order by correct answers DESC but also by fastest times DESC. example: (time / correct) 300 / 50 299 / 50 200 / 50 280 / 49 270 / 49 350 / 48 any help would be great.
  13. Ok so I have started to upgrade my site to HTML5 just having an issue with a validater This is the validation line basically i need to get it to submit the data without reloading the page $("#form").validator(); This is the code i currently have: the validater works but it wont posts and it refreshes / code all works prior to adding validater <form name="form" id="form" method="post" action=""> <input name="id" id="id" type="hidden" value="<? echo $gameid; ?>"> <input name="title" id="title" type="hidden" value="<? echo $ntitle; ?>"> <input type="url" required="required" pattern="^https?://(?:[a-z\-]+\.)+[a-z]{2,6}(?:/[^/#?]+)+\.(?:jpe?g|gif|png)$" name="iconurl" id="iconurl" class="form_field" style="width: 300px;" value="Icon URL" onFocus="if(value=='Icon URL')value=''" onBlur="if(value=='')value='Icon URL'; urlCheck(this.value);"> <input type="text" required="required" name="atitle" id="atitle" class="form_field" style="width: 300px;" value="Title" onFocus="if(value=='Title')value=''" onBlur="if(value=='')value='Title'"> <input type="textarea" required="required" name="adescription" id="adescription" class="form_field" style="width: 300px;" value="Description" onFocus="if(value=='Description')value=''" onBlur="if(value=='')value='Description'"> <button type="submit" class="form_field_btn" name="save" id="save">Save</button> </form> $.tools.validator.localize("fi", { '*' : 'Correct this value.', ':email' : 'Invalid E-mail.', ':number' : 'Numeric value only', ':url' : 'Invalid URL', '[max]' : 'Maximum value: $1', '[min]' : 'Minimum value: $l', '[required]' : 'This filed is required.' }); $("#form").validator(function(){ lang: 'fi'; $.post('http://www.domain.com/file.php', $("#form").serialize(), function(data){ $("#").slideToggle("slow"); $("#").slideToggle("fast"); $('#').html(data); }); });
  14. Does 2 * 3 + 4 = 2 * (3 + 4) ? 10 / 14 ?? so no...?
×
×
  • 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.