oni-kun
Members-
Posts
1,984 -
Joined
-
Last visited
-
Days Won
1
Everything posted by oni-kun
-
Having problems with file manipulation which involves chinese named files
oni-kun replied to joe25's topic in PHP Coding Help
You have to have an utf8_encode() function within your fwrite command.. Example: //Convert the hex to chinese characters $work = html_entity_decode($xslt_result, ENT_NOQUOTES,'UTF-8'); //$work = utf8_encode($work); print $work.".html should be the resulting file"; rename("work.html", utf8_encode($work).".html",$context); Try and see if that works.. fwrite and rename seem to default to ISO-latin1.. -
Yes, this is an old post. Note that combining the files just wasted internal resources, and your processor will have a double footprint per user. Most browsers slipstream your JS files per each requests, smaller separate files are in most cases faster for client loading purposes.
-
You're welcome! Remember to hit 'Topic Solved' in the bottom left corner if we answered your question.
-
somedomain.com/idevaffiliate/sale.php?profile=1111&idev_saleamt=1&idev_ordernum=1&idev_option_1=name&[email protected]& $profile = $_GET['profile']; $idev_saleamt = $_GET['idev_saleamt']; $idev_ordernum = $_GET['idev_ordernum']; $idev_option_2 = $_GET['idev_option_2']; if isset(.....)//check for all of them { mail('[email protected]', 'Affiliate sale', "$profile bought $ordernum"); //Won't work.. but use mail() function } Simple and without any security really.. but it'll work if you go to the url..
-
Everything in the function stays in the function's private scope. $total is something that the function returns, the total of $a and $b. Also, 'return $total' can be substituted for 'echo $total', they're just different structures. <?php $a=5; //Public variable, can be accessed here or in a function $b=8; function add($a,$b) { $total=($a+$b); //Private, not public scope return $total; } echo "$a + $b = " . add($a,$b) . "<br />"; ?>
-
[SOLVED] If statement - display nothing if field is blank or zero
oni-kun replied to twilitegxa's topic in PHP Coding Help
OMG, I said == "" and not ="" ....... fixed up there..I'm so tired..Rofl. -
[SOLVED] If statement - display nothing if field is blank or zero
oni-kun replied to twilitegxa's topic in PHP Coding Help
Just try my code above I edited.. it should work .. it won't display a 0 since the code implicity implies it to not display a 0.. I don't think it's in your tables.. -
[SOLVED] If statement - display nothing if field is blank or zero
oni-kun replied to twilitegxa's topic in PHP Coding Help
Wow, I guess this is just to show if it looks easy it won't work, I hadn't a clue PHP wouldn't support something structured like that. if($health == 0 || $health == '0' || $health == null){$GLOBALS['health'] = "";} if($energy == 0 || $energy== '0' || $energy == null){$GLOBALS['energy'] = "";} if($acv1 == 0 || $acv1 == '0' || $acv1 == null){$GLOBALS['acv1'] = "";} if($acv2 == 0 || $acv2 == '0' || $acv2 == null){$GLOBALS['acv2'] = "";} if($dcv1 == 0 || $dcv1 == '0' || $dcv1 == null){$GLOBALS['dcv1'] = "";} if($dcv2 == 0 || $dcv2 == '0' || $dcv2 == null){$GLOBALS['dcv2'] = "";} if($total_cp == 0 || $total_cp == '0' || $total_cp== null){$GLOBALS['total_cp'] = "";} Bleh. -
I was gonna write something like that, I started to understand what you meant. Glad I could help!
-
[SOLVED] If statement - display nothing if field is blank or zero
oni-kun replied to twilitegxa's topic in PHP Coding Help
foreach( $derived_info as $key => $value){ if ($value == '0' || $value == null || !isset($value)) { $GLOBALS['derived_info['.$key.']'] == ""; } } Blah, didn't know php was so picky about those things.. -
if (ob_get_level() == 0) ob_start();//place this at top of page for ($i = 1; $i <= 100; $i++) { echo "$i<br/>\n"; echo str_pad('',4096)."\n"; ob_flush(); flush(); sleep(1); } ob_end_flush(); Try this Doesn't require any changing of php.ini settings.
-
[SOLVED] If statement - display nothing if field is blank or zero
oni-kun replied to twilitegxa's topic in PHP Coding Help
This should work.. $health = $derived_info['health']; $energy = $derived_info['energy']; $acv1 = $derived_info['acv1']; $acv2 = $derived_info['acv2']; $dcv1 = $derived_info['dcv1']; $dcv2 = $derived_info['dcv2']; $total_cp = $derived_info['total_cp']; foreach( $derived_info as $key => $value){ if ($value == 0 || $value == null || !isset($value) { $GLOBALS['derived_info[$key]'] == ""; } } [/code] -
Like this then? reset($menuCreation); while (list($key,$value) = each($menuCreation)) { if(!is_numeric($key)){ //! means not, no need for extra else. if (is_array($value)){ //insert it back into the array $value = implode($value); //Yeah! echo $x; } } } //test function print_r ($menuCreation);
-
[SOLVED] If statement - display nothing if field is blank or zero
oni-kun replied to twilitegxa's topic in PHP Coding Help
Your code: if ($acv2 == '0') { echo ''; } else { echo $acv2; } That will quite simply echo '' before the tables are even written! You may want to check if it is null with isset() or use a global scope: if ($acv2 == false || $acv2 == null { $GLOBALS['acv2'] == ""; } That'll check if $acv2 is 0 or null, and if it is it'll REWRITE $acv2 as nothing, so in the table it will not display a 0. -
Do you mean place $x, the implosion of $value into an array? then something such as this.. reset($menuCreation); while (list($key,$value) = each($menuCreation)) { if(!is_numeric($key)){ //! means not, no need for extra else. if (is_array($value)){ //insert it back into the array $x = implode($value); $menuCreation[1][0] = $x; //second [] is array within array. echo $x; } } } //test function print_r ($menuCreation); You'd just need to modify which arrays you had([1][0] in my example). It can be set within a function like yours..
-
Fixed it, try it again and see if it works.
-
Here try this, fixed shorthands and rewrote your while loop.. might be worth a try. <?php $con = mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("database", $con) or die(mysql_error()); if ($_POST['newurl'] != '') { $url = $_POST['url']; mysql_query("INSERT INTO urls (url) VALUES ('$url')"); $new_url = true; } else if ($_GET['delete'] != "") { $del = $_GET['delete']; mysql_query("DELETE FROM urls WHERE id='$del'"); $url_delete = true; } ?> <html> <head> <link rel="stylesheet" type="text/css" media="all" href="../main.css" /> <title>Lockerz Invites - Admin Panel</title> </head> <body> <center> <?php if ($add_new) { echo '<div class="success"><center>New URL added successfully!</center></div>'; } ?> <?php if ($url_delete) { echo '<div class="success"><center>URL Deleted successfully!</center></div>'; } ?> <form name="addurl" action="" method="post"> <input type="hidden" name="newurl" value="1"> <table class='alternate'> <tr bgcolor="b96e00"> <td><font color="ffffff"><center>URL</center></font></td><td></td> </tr> <tr bgcolor="555555"> <td><center><input type="text" name="url" value="" maxlength="1024" size="90%"></center></td> <td><center><input type="submit" value="Add"></center></td> </tr> </table> </form> <br> <table class='alternate'> <tr bgcolor="b96e00"> <td><font color="ffffff"><center>URL List</center></font></td><td></td> </tr> <?php $searchresult = mysql_query("SELECT * FROM urls"); while($row = mysql_fetch_array($searchresult)); { echo '<tr bgcolor="555555">'; echo '<td><center><input type="text" name="url" value=" ' . $row['url'] . ' " readonly></center></td>'; echo '<td><center><input type="button" value="Delete" onclick="window.location.href=\"index.php?delete=' . $row['id'].'\" "alt="Delete"></center></td></tr>'; } ?> </table> </center> </body> </html> Edit: And a string escape misplaced
-
You're asking the script to execute infinite times.. for ($i = 1; $i <= 100; $i++) { echo "$i<br/>\n"; sleep(1); } Note you will have to use output buffering and flush() if you wish the echo to actually echo each sleep, and not wait 100 seconds before displaying it all.
-
PHP uses output buffering and the script would complete before it'd be displayed after writing the file.... I'd recommend using ob_start, flush and sleep() to halt execution of the re-read, I'm not quite in tune with how you coded that.. I can't rewrite it to work for you.
-
I've looked for 20 minutes and can't find line 93. Regardless, switch all your <? shorthands to <?php. Many servers I've come across don't read them and don't parse the code, throwing it away.
-
PHP and apache are untouchable and installed already I assume on your host, 99% of hosts will have everything you need already.. If you upload via FTP or an online manager, your index.php/or website in full to your /www/ or /public_http/ folder, you'll notice on your domain the php file will work off the bat, hosts are simple enough..... wrong forums though.
-
Well you can use something such as AJAX to call 'getvideo.php?vid=this' which would handle the video embed codes, simply echoing them. Then your 'mus' form, could be replaced with the video using JS/AJAX combination which should not be hard at all, and best, you will not even need to have the page to be refreshed to load it up. This isn't a PHP question though, prolly why it was deleted /moved before. ... If you don't want to use AJAX, then do this. <?php if (isset($_GET['vid'])) { $vid = $_GET['vid']; if($vid = 'foo') { echo "<embed wmpclass bla stream=mss://foo/blaa>";} if($vid = 'dog') { echo "<embed wmpclass bla stream=mss://dog/blaaaa>"; } } ?> Lazy example, but works for what you want it.. all on one page.. defined by.. getvideo.php?vid=xxx..
-
A button is clientside, PHP is a serverside language. You'd need to use a form like this.. <form action="whatever.php" method="post"> <input type="button" value="click me to calculate!"/> </form And it'll POST and inputs etc. to whatever.php. If you use a text input for example like you'd see in normal forms.. if an input was named 'name="ID" ' you could see it in PHP as.. $_POST['ID'].. Edit: You may want to use JS to insert a random number into the box. You can do buttons like this.. <button onClick="document.getelementbyID('rand1').value = 4">Button</button>
-
You sure you have SWFobject? The code does not look invalid but I would not recommend using it if you run into problems like this. Use the above example with your .$build. variable inserted.. You can do paramaters the same as the rest, just don't mess with CLSID's.
-
My code works fine, I tested it myself! Go to these urls.. $keyword = WHATEVER $rssFeeds[0] = 'http://blogsearch.google.com/blogsearch_feeds?hl=en&q='.urencode($keyword).'&ie=utf-8&num=10&output=rss'; http://blogsearch.google.com/blogsearch_feeds?hl=en&q=dog&ie=utf-8&num=10&output=rss http://blogsearch.google.com/blogsearch_feeds?hl=en&q=foo&ie=utf-8&num=10&output=rss http://blogsearch.google.com/blogsearch_feeds?hl=en&q=wow&ie=utf-8&num=10&output=rss They all work as rss, your parsing is done wrong then? What queries ARE returning something?