bluesoul
Members-
Posts
149 -
Joined
-
Last visited
Everything posted by bluesoul
-
Can you help me optimize my 'random name' script?
bluesoul replied to MrTech's topic in PHP Coding Help
You'll be using a table, with each call to the function in it's own <td> block. -
In case the tutorial makes your eyes glaze over, the major bug is in your <form> tag, but that's a handy enough tutorial I'm not gonna tell you what it is.
-
200 to 300k temp images, even if brief, will kill your memory. The creation of the image normally takes tens of MBs per image, even with ones that aren't particularly large. Using a buffer to track the length of it makes much more sense, though I've never had need to write the code.
-
[SOLVED] Difference bewteen nothing and null?
bluesoul replied to limitphp's topic in PHP Coding Help
In my experience a POSTed value left blank will still be a variable with a pointer and physical address, with a null value (\0). This is why sometimes checking the strlen() of a POSTed variable is the easiest way to determine if operations need to be performed on it. I tend to only use isset() on GET vars for a centralized page, e.g. if ?do=foo execute this block, if ?do=bar execute that block, if ?do isn't set show the index. -
Yeah, strtr() requires the two strings to be identical lengths, and extra characters are ignored. It's more for this kind of thing: $addr = strtr($addr, "äåö", "aao");
-
Try str_replace() instead of strtr(). Same arguments.
-
This got it, thanks a ton, I'd have been beating my head on this for a while.
-
It's entirely possible your host doesn't allow fopen() but you'd also want to make sure your absolute paths are correct (/home/indiana/etc...).
-
Ugh, having some problems getting this working. Before my loop: $list = array ( 'Account ID,Invoice ID,Domain,Invoice Date, Registrar, Description, Exp. Date, Charge, Balance'); In the loop: $fp = fopen('invoice'.$timestamp.'.csv', 'w'); $list .= array ( "$aaid,$aiid,$adn,$invdate, $arid, $adesc, $expdate, $charge, $balance"); foreach ($list as $line) { fputcsv($fp, split(',', $line)); } After the loop: fclose($fp); Results in "Warning: Invalid argument supplied for foreach() in searchinvoices.php on line 77". I'm assuming it's because I can only pass it one element at a time. Ideas?
-
[SOLVED] Need help with using PHP with my Mysql Database
bluesoul replied to bobsmith20's topic in PHP Coding Help
<? isset($userinf['clan']) ? "- <a href=\"cforum.php\">Clan forum</a><br>\n" : ""; ?> -
<?php $q = "SELECT view FROM profiles WHERE username='{$_POST['username']}' LIMIT 1"; $query = mysql_query($q) or die(mysql_error()); $row = mysql_fetch_assoc($query); if($row['view'] == "private") { echo "This profile is set to private, redirecting you. <meta http-equiv=\"refresh\" content=\"3;url=index.php\" />"; } else { //display profile } ?> That's a rough idea, I'd highly recommend escaping posted data rather than using it directly in a query at the least.
-
Easiest way without messing with headers or anything would be to do... <img src="$foo" /> Where $foo is the URL you stored.
-
I believe I'd try and add another publisher column or two to the table just for instances like this, giving them both the same game_id is going to be a primary key violation. So perhaps... game_id title devname genre pub1name pub2name sysname 4 Fallout 3 Bethesda Game Studios Role-Playing ZeniMax Media Bethesda Studios Xbox 360
-
Premiso beat me to the punch. Anytime something says unexpected T_STRING, T_ECHO, or what have you, start counting brackets, commas and semicolons.
-
[SOLVED] Simple difference between now and static time.
bluesoul replied to bluesoul's topic in PHP Coding Help
Never mind, found a working script on php.net. Thanks though. -
I have a static date and time in the future, and I need to have a simple echo of the difference in hours and minutes (or rounded hours) between now (when the page is called) and then. Can't seem to wrap my head around much this morning, can someone give me a hand?
-
<?php if(isset($_SESSION['MM_UserGroup'])&& ($_SESSION['MM_UserGroup']=='9' || $_SESSION['MM_UserGroup']=='8')){?>
-
do you see why my login script is not working
bluesoul replied to Reaper0167's topic in PHP Coding Help
Clean up the username, make sure there's no garbage added on in transit, use trim() and mysql_real_escape_string(). Also add "or die(mysql_error());" to the end of your query. Where is $tbl_name being defined? -
$newtime = strtotime("+2 hours",$oldtime);
-
<li class="med"> <?php switch($stars) { case '5': echo '<img src="../../elements/images/layout/5star.jpg" alt="5 star"/>'; break; case '4': echo '<img src="../../elements/images/layout/4star.jpg" alt="4 star"/>'; break; //etc default: die("Invalid result"); break; } $stars = ""; ?> </li>
-
Extract data from $row into database. Simple thing i think...
bluesoul replied to cs.punk's topic in PHP Coding Help
Huh. Never knew about that shortcut, I always assigned them to new vars just to be safe. -
Right, you can keep an array in a cookie of thread id's, then if the thread listed is in the array in the cookie, it's noted as read.
-
There are a few ways of going about marking forums as read, vBulletin's docs may give you an idea or two.
-
From php.net's strtotime page.
-
PHP: Template (http://abc.org/template.php/index.html)
bluesoul replied to justravis's topic in PHP Coding Help
http://www.workingwith.me.uk/articles/scripting/mod_rewrite