Jump to content

MCP

Members
  • Posts

    60
  • Joined

  • Last visited

    Never

Everything posted by MCP

  1. It works differently in Access. Where will the parameter be coming from?
  2. try this maybe? [code] <?php $sql = "SELECT DateDiff('d', (SELECT TOP 1 dhcp_log_date FROM dhcp_log ORDER BY dhcp_log_date ASC), GetDate())"; $result = mssql_query($sql); ?> [/code]
  3. hmm, you can switch by doing: alter schema <schema name> transfer <table name> i think everyone should be able to access the default dbo schema, so maybe use that? or maybe edit the guest.tableName tables to give yourself access? any of these ways should solve your issues. i wouldn't leave the production tables tied to your account schema, just in case someone else has to take over the project, and then all the names will have to be changed all over the code if you use 2 part names.
  4. Your single and double quotes look strange. Make sure they're: [code=php:0]"[/code] or [code=php:0]'[/code]
  5. To ease your future migration process, you might want to do this: (it's Barand's function, just renamed and wrapped in an if). This way when you upgrade to a version that has array_combine, then it should work seamlessly. [code=php:0] if (!function_exists('array_combine')) {     function array_combine ($a, $b)  {         $res = array();         $v = current($b);         foreach ($a as $k) {             $res[$k] = $v;             $v = next($b);         }         return $res;     } } [/code]
  6. And it wasn't after a 24 minute lull in you using that session, as specified by the gc_maxlifetime setting? Other than that, I'm stumped. Perhaps try upgrading to version 5.2.0, if possible?
  7. Strange on the sess_JAYMC. And you're not calling session_id with a parameter, right? Just for kicks, what happens if you assign another variable to your session? So something like $_SESSION['test'] = "test"; before the username assignment. Does the session id then become sess_test ? Also, what are the permissions on /SESSIONS ? How much space on that partition?
  8. You can leave sessions for as long as you want -- I don't think there's any technical restriction there. Are you saying that the garbage collection is the mechanism clearing out your session? Are you reaching the 24 minute mark and having your session deleted? Also, what do you mean by "session value"? What exactly does session_id() print?
  9. update table set col4=0, col5=0
  10. Also, you have session.gc_maxlifetime set to 1440 seconds, or 24 minutes. This is independent of the cookie lifetime and specifies how long your session lasts on the server before it's seen as garbage, to be taken out at each session_start with session.gc_probability/session.gc_divisor probability.
  11. [quote author=jaymc link=topic=121834.msg503557#msg503557 date=1168640686] But Ive been through all my scripts and the only thing they have regarding sessions is session_start(); $User_Session = $_SESSION['username']; [/quote] do you mean to say that you never save any variables to the session? how does $_SESSION['username'] get populated? sessions aren't truly created until you either assign something to the $_SESSION super global, or use session_register().
  12. try SELECT First_Name FROM Myname.customer or SELECT First_Name FROM [Domain\Myname].customer If it's a permissions issue, you would get a different error message -- this is definitely that the table is in a different schema. Alternately, you might try select * from information_schema.tables and see what it says in there
  13. Have you set the extensions directory appropriately? Do other extensions work? Which version of MS SQL?
  14. By default, SQL Server 2005 is not set up for sql security (will only use windows authentication). You'll have to enable this on your server if you haven't already...
  15. You can use multiple databases, but it would probably be easier if you kept a single database -- depending on your application, of course. You may want to look at row level security. Alternatively, you can do multiple databases, even at the same time: $db1 = mssql_connect("localhost","user","pass",true); $db2 = mssql_connect("localhost","user","pass",true); mssql_select_db("database1",$db1); mssql_select_db("database2",$db2);
  16. No problem chronister! "/" refers to root and "../" refers to parent. Liquid Fire, no, because __FILE__ depends on the *calling* file's location, so if you reference it in globals.php, then it will be globals.php path. So as long as your include files have the same relative path, then you will never have to change it.
  17. Chronister is incorrect -- "./" refers the current directory, so the two following statements are pretty much equivalent (barring include path stuff) require("globals.php"); require("./globals.php"); What you should do, is in globals.php you can use: [code=php:0] require(dirname(__FILE__)."\\anotherFileToInclude.php"); [/code] which will then always work (assuming anotherFileToInclude.php is in the same folder as globals.php. Adjust accordingly. What this does is __FILE__ contains the path of the calling file, in this case the full path to globals.php. Then, you get the directory name using the dirname() method on it, and finally you add on the filename, and you're done!
  18. See [url=http://www.php.net/manual/en/function.imagealphablending.php]PHP Manual: Image Alpha Blending[/url]. The comments section talk about this specifically
  19. Just an comment on fert's note, I'd advise against using that code straight up. Even though it's a POSTed form, I can just make my own form with "unlink" as a function (unlink == delete file in php), and it will delete stuff on your server. I strongly recommend you ensure in the php file that the function being called is allowed to be called! *Always* validate user input..
  20. Hmm.. not sure how to describe it. myNameFunc is the function. $a is a variable, and so I'd call $a() an expression (i.e. it's not one thing, but something that [i]evaluates[/i] to something else) In this case: $a("Alice") becomes myNameFunc("Alice") becomes "Bill and Alice" Maybe this page entitled [url=http://www.php.net/manual/en/language.pseudo-types.php]Pseudo-Types used in this documentation[/url] will help clarify, see callback. The only thing is that they don't call the functions using [i]$a()[/i], but instead use [i]call_user_func($a);[/i]. But they do the same thing. fert, be careful with that code! A malicious user will set $_POST['func'] to something really nasty, like "unlink" (which is PHP/C's way of saying delete file).
  21. Yup! You'll find it referenced as "indirection" in C/C++ speak (in a slightly different, but related way). Glad to help, sounds like it all fits for you now.. But post more if you have more questions..!
  22. I did say it was untested! Sorry about that, try: [code] if (preg_match("/^[0-9a-fA-F]+$/",$string)){   //it matches only hexadecimal } else {   //it doesn't } [/code] You can change the "+" to a "*" to allow empty strings
  23. See [url=http://www.php.net/manual/en/function.preg-match.php]preg_match[/url] Something along the lines of: [code] if (preg_match("/^[0-9a-fA-F]$/",$string)){   //it matches only hexadecimal } else {   //it doesn't } [/code] (untested)
  24. Yup, that's perfectly valid. From the php manual on [url=http://www.php.net/image]Image functions[/url], you'll see that there are a whole bunch of functions: imagecreatefromgd2 -- Create a new image from GD2 file or URL imagecreatefromgd2part -- Create a new image from a given part of GD2 file or URL imagecreatefromgd -- Create a new image from GD file or URL imagecreatefromgif -- Create a new image from file or URL imagecreatefromjpeg -- Create a new image from file or URL imagecreatefrompng -- Create a new image from file or URL imagecreatefromstring -- Create a new image from the image stream in the string imagecreatefromwbmp -- Create a new image from file or URL imagecreatefromxbm -- Create a new image from file or URL imagecreatefromxpm -- Create a new image from file or URL What the class is aiming to do is avoid from having to hardcode all the different functions for all the different image types supported. What I gather will happen is that $this->type will contain a value such as "jpeg", "png", "gif", etc. The result will be for example $functionName = 'ImageCreateFromJPEG'. function_exists will make sure that the function, ie ImageCreateFromJPEG, actually exists. If you had a PSD, it would try and do a ImageCreateFromPSD, which doesn't exist and will fail if called, so this is to make sure you're ok. (Not sure what will happen later on in the class if this check fails) The $functionName($this->image) statement is perfectly valid. it will evaluate $functionName to, as in the running example, ImageCreateFromJPEG, which will then turn the actual function call into ImageCreateFromJPEG($this->image). Note that the same works for variable names: [code] $a = "b"; $b = "Bob"; print $$a; [/code] will print "Bob", since the "$a" will evaluate to "b", and then the "$b" will evaluate to "Bob". Try it! Same works with functions: [code] $a = "myNameFunc"; function myNameFunc($name){   return "Bill and $name"; } echo $a("Alice"); [/code] will print out "Bill and Alice"
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.