-
Posts
251 -
Joined
-
Last visited
Posts posted by glennn.php
-
-
i don't mind if someone could point me to the right tutorial, but i haven't had any luck finding one for this particular issue (either way, i could use a little help):
i've got an array, $offering, which would return something like 03, 04, 08
foreach ($offering as $f) {
$deg = $f;
echo $deg; // gives me 030408 - fine...
}
while
foreach ($offering as $f) {
$deg = $f;
}
echo $deg; // gives me 08 - so i can only assume that
$result = mysql_query("SELECT COUNT(*) FROM administrators WHERE fice IN (SELECT fice FROM characteristics WHERE carnegie_code = '$carn_class' AND offering = '$deg') ") or die(mysql_error());
is only going to return those with fields 'offering' containing 08...
can someone please show me how to search for ALL the values for that field...?
i really appreciate it...
GN
-
i just turned them all into spaces and the file ran great... thanks again
-
awesome - that did the trick! thanks
-
thanks i will - can i ask what   is...?
-
private, public, and protected object models weren't introduced until PHP5
is there any way to change those class objects into something that would fly? perhaps you could point me in the right direction...?
thanks
-
yeah, i sent the author an email asking why his website states 4 or better - he must have changed the script and not changed the notice on his site.
that sure cost me a lot of time. )
thanks
-
have you checked that the php versions of both servers are the same or similar?
Scott.
bingo damnit. one server is running 5.2 and one is running 4.3. i can't imagine why they'd do that, it's never been an option when i chose different host plans, just Linux of Windows...
damn that pisses me off.
the script still calls for 4 or better, but who knows...
thanks for your prompt.
g
-
no, i haven't - i considered it, then went on to something else to see what someone like yourself tells me first.
i can't imagine that they'd have different versions on different Linux servers, though. guess it's possible.
i'll check that out.
thanks
-
yeah, that's what i thought at first, but the writer states that it's good on PHP 4 and up... godaddy is running 4.2 i think (at least).
-
i have an htpassword.php file that works just fine on one godaddy server but i'm getting this parse error on another:
parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/j/s/i/jsimkav/html/headers/htpasswd.php on line 33
can someone point out the problem for me?
line 33:
class htpasswd{ public $users; << 33 public $error; private $_path; function htpasswd($file=false){ if(!$file){ die('Please specify a file!'); }else{ //configure $this->_path = $file; $this->users = ''; //load database if(file_exists($file)){ $data = array(); $fcontents = file($file); while(list($line_num, $line) = each($fcontents)){ $user = explode(':',$line); //$user = $arraydata[0]; $data[$user[0]] = rtrim($user[1]); } $this->users = $data; } } } function create($user, $passwd, $update=false){ $this->error = ''; if(isset($this->users[$user]) && !$update){ $this->error = 'User <strong>'.$user.'</strong> exists! To update the user set the update parameter to true.'; return false; } $this->users[$user] = $this->non_salted_sha1($passwd); return true; } function remove($user){ $this->error = ''; if(isset($this->users[$user])){ unset($this->users[$user]); return true; }else{ $this->error = 'User <strong>'.$user.'</strong> does not exist!'; return false; } } function users(){ $this->error = ''; $rval = Array(); if(is_array($this->users)){ foreach(array_keys($this->users) as $uid){ $rval[count($rval)] = $uid; } } return $rval; } function validate($user, $pass){ $this->error = ''; if(!isset($this->users[$user])) return False; $crypted = $this->users[$user]; if(substr($crypted, 0, 6) == "{SSHA}"){ $ohash = base64_decode(substr($crypted, 6)); return substr($ohash, 0, 20) == pack("H*", sha1($pass . substr($ohash, 20))); }elseif(substr($crypted, 0, 5) == "{SHA}"){ return ($this->non_salted_sha1($pass) == $crypted); }else{ return ($pass == $crypted); } } function save($file=false){ $fcontents = ""; if($file == false) $file = $this->_path; foreach(array_keys($this->users) as $user){ $fcontents .= $user.":".$this->users[$user]."\n"; } if(file_put_contents($file, $fcontents)){ $this->error = ''; return true; }else{ $this->error = 'Couln\'t save the file!'; return false; } } //encryption functions function rand_salt_crypt($pass){ $salt = ""; mt_srand((double)microtime()*1000000); for ($i=0; $i<CRYPT_SALT_LENGTH; $i++) $salt .= substr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./", mt_rand() & 63, 1); return "$apr1$".crypt($pass, $salt); } function rand_salt_sha1($pass){ mt_srand((double)microtime()*1000000); $salt = pack("CCCC", mt_rand(), mt_rand(), mt_rand(), mt_rand()); return "{SSHA}".base64_encode(pack("H*", sha1($pass . $salt)) . $salt); } function non_salted_sha1($pass){ return "{SHA}".base64_encode(pack("H*", sha1($pass))); } } //php4 work around if(!function_exists('file_put_contents')){ function file_put_contents($filename, $content, $flags = null, $resource_context = null){ if(is_array($content)){ $content = implode('', $content); } if(!is_scalar($content)){ trigger_error('file_put_contents() The 2nd parameter should be either a string or an array', E_USER_WARNING); return false; } $length = strlen($content); $mode = ($flags &FILE_APPEND) ? 'a' : 'w'; $use_inc_path = ($flags &FILE_USE_INCLUDE_PATH) ? true : false; if(($fh = @fopen($filename, $mode, $use_inc_path)) === false){ trigger_error('file_put_contents() failed to open stream: Permission denied', E_USER_WARNING); return false; } $bytes = 0; if(($bytes = @fwrite($fh, $content)) === false){ $errormsg = sprintf('file_put_contents() Failed to write %d bytes to %s', $length, $filename); trigger_error($errormsg, E_USER_WARNING); return false; } @fclose($fh); if($bytes != $length){ $errormsg = sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space.', $bytes, $length); trigger_error($errormsg, E_USER_WARNING); return false; } return $bytes; } } ?>
-
yeah, that's what i was thinking, but the database is designed as such:
-- -- Table structure for table 'rel_affiliation' -- CREATE TABLE rel_affiliation ( affiliation int(3) NOT NULL, affil_text varchar(255) collate utf8_unicode_ci NOT NULL, PRIMARY KEY (affiliation) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table 'rel_calendar' -- CREATE TABLE rel_calendar ( calendar int(1) NOT NULL, calendar_text varchar(10) collate utf8_unicode_ci NOT NULL, PRIMARY KEY (calendar) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table 'rel_carnegie' -- CREATE TABLE rel_carnegie ( cc2001 int(3) NOT NULL, cc_description varchar(255) collate utf8_unicode_ci NOT NULL, PRIMARY KEY (cc2001) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table 'rel_emphasis' -- CREATE TABLE rel_emphasis ( emphasis int(255) NOT NULL, emphasis_text varchar(20) collate utf8_unicode_ci NOT NULL, PRIMARY KEY (emphasis) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- -------------------------------------------------------- -- -- Table structure for table 'rel_inst_type' -- CREATE TABLE rel_inst_type ( inst_type int(2) NOT NULL, inst_type_text varchar(30) collate utf8_unicode_ci NOT NULL, PRIMARY KEY (inst_type) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
etc...
this is where i think i'm going to need to see some example code...
-
i have a large publication database where i need to filter down the results with a series of options such as 'state', 'year', 'affiliation', etc. (9 total) - where might i find a good example of a script that would do something like this?
i'm adequate with simple queries, but i'm not sure if something like this is going to involve JOINs or something... perhaps this is just a bunch of conditions using AND...?
thanks for any help you can offer...
Regards,
GN
-
thanks both of you!!!
-
awesome, thanks
i found another tute that did
...REGEXP 'A%-M%' order by cat ASC... which worked as well;
is there a reaon one is better than the other? PHP version, mysql version, etc...?
Thanks for your help.
GN
-
hi all -
having this: mysql_query("SELECT * FROM menu ORDER BY cat ASC"),
i'm trying to retrieve records where 'cat' starts with anything from A to M.
can anyone help a chap out?
Thanks much,
GN
-
guess it's not a stupid question, but...
can a database get too big? i'm building one that could end up with QUITE a lot of records in one table - can this become a problem...?
thanks
GN
-
Just changing the column type does not change the data in it.
hate to disagree, but this is in fact exactly what happened. some of the dates were changed to 00-00-0000. promise. wouldn't lie to you.
-
I originally created a db with a particular field (ck_pt) that holds a date as VARCHAR(15) - now they want the output sortable by that field DESC...
the dates that are in there are like such 7/25/08 - when i switch the TYPE to DATE, the vaalues go to 07-25-2008, or perhaps 25-07-2008 - i dunno, but SOME of the values go to 00-00-0000 (GOD i'm glad i backed it up).
why am i losing some of the values, and what can i do about getting these fields converted properly and queried into a page where %d/%m/%y will be correctly ordered, 2008 before 2009, of course...?
i really appreciate your help.
GN
-
god, i'm an effin' moron. i'd even already done that to post it to the Flash file; i just began looking at it as the entire string and wasn't thinkin'.
damn.
thanks!
-
having this url:
h**p://domain.com/file.php?message=this%20value ...
how can i retrive JUST the variable/value? - i realize REQUEST_URI will get me the entire string after the .com/, buti need to get the variable's value into a javascript...
i really appreciate the help,
GN
-
no, right - since it's still a called url it's still seen as PHP_SELF by php... i guess...
i would have thought PHP would have some ability to see the difference, though. i'm by no means fluent in it (disregard my nickname - that's just wishful thinking ).
if anyone knows if PHP can recognize a call to a frame, i'd love to hear it.
Thanks,
Glenn
-
yes, now i remember that - thanks!
** although this won't detect if the page is within a frame or not, like this javascript clause:
if (top.location == self.location) ...
is there a PHP means of doing this?
thanks again
-
i've been havng trouble finding the function that checks if a page is being diectly accessed or if it's loaded in an iframe or include...
can someone give a guy a hand?
thanks
GN
-
amen, thanks much DW...
[SOLVED] little help using an array in a query
in PHP Coding Help
Posted
well, i think it's close -
if this returns 030408 and not 03,04,08
$offering = $_GET['highest_deg'];
foreach ($offering as $f) {
$deg = $f;
echo $deg; // gives me 030408 - fine...
}
that didn't quite work - what am i missing?
i don't know how to see the difference in this array
$array = array('tom','dick','harry');
and this one
$offering = $_GET['highest_deg'];
thanks