rubing
-
Posts
366 -
Joined
-
Last visited
Never
Posts posted by rubing
-
-
Post your new code
-
try:
ini_set ( "date.timezone" , "Asia/Manila" )
-
you don't need the ini file, just call the function at the top of your script.
-
<?php
ob_start();
//insert code
//call this wherever the program exits
ob_end_flush();
?>
-
This is not really a php question. You just need to figure out how other sites are doing this. Go to their page and look at their html code.
-
OOP is just a bunch of methods (functions) and variables put in a single place. Think about it like an fishtank or ecosystem of php code.
So do whatever you want with it.... drain the tank and put a TV inside if it makes you happy. Once in a while its good to read a book or tutorial to get ideas and appreciate other intellects, but you really just need to get in there and tinker. Having some kind of mission you want to accomplish always helps of course. Good luck!
-
If you know php you may want to check out one of the php/ajax frameworks
-
Show us all your code. it's hard to say anything without seeing the different queries and where you put them.
-
it looks silly. all i need is highlighting and ftp.
-
php is on the server. so you would need to use POST or GET methods of communicating them to the server. so, you probably want to use ajax
-
use single quotes in your html instead.
-
yeah i did that initially...turns out it was something else that's probably debian/ubuntu specific. there's a directory: /etc/php5/apache2/conf.d
and inside there was a file xdebug.ini that specified the loaction of the extension.
all i did was remove it and the problem was solved!
-
whenever i type a pear command i get the following error:
Failed loading /usr/lib/php5/20060613/xdebug.so: /usr/lib/php5/20060613/xdebug.so: cannot open shared object file: No such file or directory
This started happening after I uninstalled the extension. I uninstalled it b/c I realized that I had already had it installed via ubuntu. Now, I just keep getting that error. I guess I could install it again with pear, but rather just get rid of the error. thanks!
-
Thanks for the fast response...it works great. I thought had tried that originally...guess not.
Anyways, of course i have a where clause in the real query, but GOOD CATCH!!
thanks!
-
I am running a current mysql 5 version on ubuntu using default myisam storage engine. I am logging page views for a file by querying for the number of times it has been already viewed, then adding one with php before updating. Is it ok to do it this way?
$query="SELECT num_views FROM table1"; $result = $conn->query($query); if (($row = $result->fetch_assoc()) !== NULL) { $new_num_views=$row['num_views'] + 1; $query="UPDATE table1 SET num_views = $new_num_views"; $result=$conn->query($query); }
Will this give me problems if two users request a page simultaneously? Will one of the views not be recorded??
-
I have just launched my web application and am afraid of not being able to handle my traffic, b/c I have a potentially big client . My application is a flash mp3 player. Basically I query mysql with php for the mp3 file and then play it using the flash mp3 player. I may have thousands of people listening to these mp3s and am afraid that apache/mysql will be overburdened.
Is streaming an mp3 file like this a huge burden on apache? I am going to start reading a book on apache, but may not get to know enough in time. What do you reccomend doing if I need to scale up fast. I was thinking of buying more ram and hiring a freelancer to optimize apache & mysql. Any other hints?? suggestions?? ideas? insults??
Thanks!!!
-
I started trying to read Javascript the Good Parts last night. The guy who wrote it seems to have an incredibly deep understanding of the subject material. Unfortunately, it is written in a heavily jargonized fashion and is sparing with examples. Another thing I didn't like was the author's use of railroad tracks in order to explain legal syntax. Of course, I'm the least visual person in the world. If you're an engineer who likes looking at circuit boards, then this book is probably great for you. If you like lots of concrete examples and to be frequently reminded of stuff...then def not! There's a copy online here: https://www.hasustorm.com/books/English/OReilly.JavaScript.The.Good.Parts.May.2008.chm
-
I found a useful javascript for unobtrusively opening popup windows. However my scriptaculous function is still inline . I would like to move this scriptaculous function to the head section preferably as part of the popup function. Here is my included javascript file for opening popups:
window.onload = initPage; // Make sure that no other javscripts assign a fuction to window.onload // There can be only one window.onload at a time function initPage() { initPopupLinks(); // place here any other code you wish to run when the page loads. } function initPopupLinks() { if (!document.getElementsByTagName) return true; var pageLinks = document.getElementsByTagName("a"); for (var i = 0; i < pageLinks.length; i++) { if (((pageLinks[i].className != null) && (pageLinks[i].className != "")) || ((pageLinks[i].parentNode.className != null) && (pageLinks[i].parentNode.className != ""))) { var linkClass = " " + pageLinks[i].className + " "; if ((linkClass == " ") && (pageLinks[i].parentNode.className != "")) { linkClass = " " + pageLinks[i].parentNode.className + " "; } for (var theKey in popupLinkConfig) { if (linkClass.indexOf(" " + theKey + " ") > -1) { if ((pageLinks[i].target == "") || (pageLinks[i].target == null)) { pageLinks[i].target = (popupLinkConfig[theKey][0] != "") ? popupLinkConfig[theKey][0] : theKey; } pageLinks[i].settings = popupLinkConfig[theKey][1]; pageLinks[i].onclick = popUp; } } } } return true; } function popUp() { newWin = window.open(this.href, this.target, this.settings); newWin.focus(); return false; } var popupLinkConfig = new Array; // Delete/copy/modify the following lines to configure your popup windows. popupLinkConfig["popup"] = new Array ( "", "width=350,height=450,scrollbar=yes,menubar=yes"); popupLinkConfig["glossary"] = new Array ( "help", "width=550,height=350,resizable=no,scrollbars=no");
Now, here is the relevant html:
<a class="popup" href="http://www.google.com"><img onClick="Effect.Pulsate('player8man')" id="player8man" src='playsmall.png' alt='play' /></a>
Any advise? Thanks!!
-
I am trying to write some unobtrusive javascript using the prototype, scriptaculous, and lowpro libraries which will make an image pulsate and then open a new window. I was doing this before in the html fine just using an onclick function. I'm not having too much luck doing this unobtrusively.
Here is the relevant html code (full page is at bookmarkmarket.com)
Call to javascript in head section:
<script src="js/scriptac/lib/prototype.js" type="text/javascript"></script> <script src="js/scriptac/src/scriptaculous.js" type="text/javascript"></script> <script src="js/lowpro.js type="text/javascript"></script> <script src="js/sm.js type="text/javascript"></script> </head> Code in Body: <tr class='odd'><td class='ven'>Bar Tuti</td><td class='ban'>Bisc</td><td class ='play' align='center'><div><img src='playsmall.png' class='pulsate_demo' alt='play' /></div></td> <td class='cat'>Hip Hop</td></tr> contents of sm.js: Event.addBehavior({ 'img.pulsate_demo:click' :function() {alert('ya just clicked');} });
-
Evening Folks,
I have a web application that I'd like to allow my users to skin. I am thinking about letting the user specify their own style sheet. The url of their style sheet would be stored in my database. So, when they request a page I'll fetch the css url from my database and include it in the headers. Am I exposing myself to any potential dangers with this setup??? I can't think of any.
-
It still does not work, but at least now we can debut it! Looks like the extension is not being picked out ???
Here is my new code:
$_FILES['uploadedfile']['name']=trim($_FILES['uploadedfile']['name']); $_FILES['uploadedfile']['name']=ereg_replace("[^A-Za-z0-9.]", "", $_FILES['uploadedfile']['name']); $allowed = array('.mp3','.MP3'); $ext = strrchr('.', $_FILES['uploadedfile']['name']); if (!in_array($ext, $allowed)) { echo "Bad file ext...<br />"; echo "ext:"; echo $ext; echo "<br />"; print_r($_FILES); exit(1); }
And here is the response:
Bad file ext...ext:
Array ( [uploadedfile] => Array ( [name] => 05madlibthebeatkonductagambleonyaboyfeat.defari.mp3 [type] => audio/mpeg [tmp_name] => /tmp/php1CtZ2n [error] => 0 => 5242805 ) )
-
I am trying to allow mp3 uploading with the following code:
$blacklist = array('.mp3'); foreach($blacklist as $item) { if(!preg_match('/$item\$/i',$_FILES['uploadedfile']['name'])) { echo "Sorry unsupported file type...mp3's only\n"; echo "<br />"; print_r($_FILES); exit; } }
Now, when I attempt to upload an mp3 file this is the response I am getting:
Sorry unsupported file type...mp3's onlyArray ( [uploadedfile] => Array ( [name] => 07-madlib_the_beat_konducta-all_virtue.mp3 [type] => audio/mpeg [tmp_name] => /tmp/phpA74Crx [error] => 0 => 2408445 ) )
-
oooops, that was dumb of me!
-
My php code seems to be executing prematurely. I am trying to download a file and then delete it if it is too small as follows:
//this just tells curl to save a file ($file) and print info about the transfer $grab->get_file($url,$conn,$proxy); if (filesize($file)>60000) { echo "file was too small"; unlink($file); }
Now, the file i am downloading is big enough and curl reports that back to me, but php is detecting as too small and deleting it:
Array ( => http://www.stinkyrhthm.com/colors.mp3 [content_type] => audio/mpeg [http_code] => 206 [header_size] => 777 [request_size] => 1226 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 1 [total_time] => 177.030566 [namelookup_time] => 0.168462 [connect_time] => 0.193816 [pretransfer_time] => 0.193823 [size_upload] => 0 [size_download] => 3000001 [speed_download] => 16946 [speed_upload] => 0 [download_content_length] => 3000001 [upload_content_length] => 0 [starttransfer_time] => 0.283526 [redirect_time] => 2.976578 )
//this just tells curl to save a file ($file) and print info about the transfer $grab->get_file($url,$conn,$proxy); if (filesize($file)>30000) { echo "file was too small"; unlink($file); }
Trying to get to the bottom of a paging problem
in PHP Coding Help
Posted
Why don't you try debugging it as follows:
Now you can figure out which of those values is being set incorrectly!