taith
Members-
Posts
1,514 -
Joined
-
Last visited
Everything posted by taith
-
or just str_replace('.','-t.',$url);
-
just a quick part of it... $q=mysql_query("SELECT * FROM `accounts` WHERE `online`='1'"); $r=mysql_fetch_assoc($q); $numberofitems=200;#pull number from the db $itemsperuser=round($numberofitems/mysql_num_rows($q)); that'd show you how many items each user can see... you'd have to set a self updating "auto_increasing" number on the accounts table, of the order of login... to get where they stand in the list... $order=$r[2];#pulled from db $start=($itemsperuser*$order)-$itemsperuser;# $start=(100*2)-100; starts at 100, if 4 online, start would be 50, etc... $q=mysql_query("SELECT * FROM `` LIMIT $start, $itemsperuser"); something to that effect... sorta like pagination... but the "page" number comes from the order # set in the database, not in the url...
-
yes, you'd want to set a cron job to run a script every hour...
-
Would the connection remain open in this case?
taith replied to adrianTNT's topic in PHP Coding Help
i would guess yes... if your exit;ing before the connection is closed... i could only assume that the pconnect would stay connected... just a guess... logical but still could be wrong... -
javascript... parent.window.location=''; if i'm not mistaken
-
Echo certain content depending on who the visitor has logged in as
taith replied to stickynote427's topic in PHP Coding Help
print_r($_SERVER); that'll show you for sure wether your variable is being set(typo maybe then?)... or not... -
[SOLVED] Creating popular items from orders in database.
taith replied to norbie's topic in PHP Coding Help
another way... $q=mysql_query("SELECT * FROM `yourtable`"); $i=array(); while($r=mysql_fetch_assoc($q)) $i[$r[itemid]]+=$r[quantity]; there you then have an array with all the itemids and their respective quantitys... sort it and yer ready to go... take yer pick... -
How to hide user name and password in configuration files
taith replied to everbright's topic in Application Design
pretty much sums it up... when you get right down to it... everything is accessable to a SA... if they wanted to break a site... they could just delete the config file... simple enough... -
Echo certain content depending on who the visitor has logged in as
taith replied to stickynote427's topic in PHP Coding Help
thats saying that your not logged in as visitor... hence it wont say that you are logged in as visitor, since you arnt -
the only things that php has access too... are what is sent to the server via the headers... and the windows login id is FAR from being sent... if this is for an internal server... i'd suggest sorting by ip address... but other then that..............
-
seeing as php runs solely on the server end, and javascript is mostly sandboxed away from file level functions on the client computer... no you cant...
-
that'd be my first suggestion... he just wanted the header/footer to be of the same number... which has to be a touch more complicated...
-
as far as clean code... thats completly subjective... i would say, having it directly into the html means that the php parser doesnt have to touch it... as far as your prior setup... i'd say... $h=glob('scripts/photos/header-*.jpg'); $f=glob('scripts/photos/footer-*.jpg'); $i=rand(1,count($h)); echo '<img src="'.$h[$i].'">'; echo '<img src="'.$f[$i].'">'; that may be simpler in fashion, yet more complex in function...(more chance of variables being overwritten between parsing, and outputting)
-
well... firstly you want a / at the end of your glob() $f = glob('photos/*/'); that way it will ONLY grab folders... (errors cause me headaches... best to think ahead of them ) secondly... you dont need </img> tags... and thirdly... what tags are being output?
-
[SOLVED] Load page and do a single page refresh...
taith replied to radi8's topic in PHP Coding Help
move your refresh into php if(!isset($firstload)){ echo '<meta http-equiv="refresh" content="5">'; $firstload=true; } -
[SOLVED] Load page and do a single page refresh...
taith replied to radi8's topic in PHP Coding Help
and as far as a delayed page refresh... you'd wanna look into meta refresh... -
yer gunna want to use cURL for this... php.net/curl ob_start(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/search?q=cache:www.yoursite.com'); curl_exec($ch); curl_close($ch); $o=ob_get_contents(); ob_end_clean(); that would set the entire page specified into the $o variable... in which you just need a simple eregi() to check for the 'This is Google's cache of' string...
-
ok... you can simply $c=count($f); which will give you the number of files in the specified folder... and with the glob... it can search for specific content if that helps too... $f=glob('images/header-*.jpg'); the * is just a wildcard... it'd grab header-1.jpg, header-2.jpg while leaving out header1.jpg... for example...
-
<? $f=glob('images/*');#grabs all the filepaths in the images folder, sets into an array $i=$f[array_rand($f)]; #sets a random imagepath from the prior array into $i ?> <img src="<?=$i?>"> #shows the image prior set and presto! random image from the images/ on each load...
-
[SOLVED] New problem with GD and merge two images
taith replied to Isterklister's topic in PHP Coding Help
secondly, then i would guess, you have some complications in the file name that is being entered dynamically into the <img> tag... you may want to check for spaces, and whatnot and urlencode/urldecode to avoid that -
Is it possible to use a variable inside a function
taith replied to elentz's topic in PHP Coding Help
change the 's around the variable to "s... the ' is a literal output... meaning exactly what you put in, is what you get out... while "s is a relative output, meaning it'll substitute out the variables $this->Cell(100,10,"Proposal {$proposalid}",1,0,'C'); {}s arnt technically necessary, but a good precaution -
[SOLVED] New problem with GD and merge two images
taith replied to Isterklister's topic in PHP Coding Help
i would say firstly, $top_image = imagecreatefrompng('$flag'); you need quotes on that, not 's... 's kill variables... it is looking for the file by the name of '$flag' not for the one specified in $_GET[flag]... -
[SOLVED] How can I create a file in a specific directory?
taith replied to pneudralics's topic in PHP Coding Help
$ourFileName = "directory/testFile.txt"; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); -
personally... i would create a global boolian variable var pause=false; then in your rotating function if(pause==true) return; then you simply put an onmouseover/out pause=true/false; this way it will start rotating onload(when you set that part of the program up) and when you mouseover it, it'll pause, and mouseout it'll resume where it left off... this code may be rather raw... but i made something like this a LONG time ago... http://www.evergreengolfcentre.ca/ picture strip loads on default, scrolls when its done loading, pauses on mouseover, resumes on mouseout... seems like a comparable idea to yours...
-
echo "<SCRIPT LANGUAGE='javascript'>window.onload=function(popupMsg('message here'));</SCRIPT>";