-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
To be honest the database method would be the simplest, quickest and more professional..
-
Yeahh it's really that simple. Best way is to set the field to integer, probs with a length of just 1 - unless you plan on making more than 10 levels of users? Then have another table setup to define the user levels, something like: user_lvl / name -------------- 1 / Basic user 2 / Moderator 3 / Admin .. or something similar so you can have a descriptive name for the user level you can lookup to display on the website. You can obviouslly make it much more advanced if you wished... When the user logs in simply check their user level against whatever you want to set for that particular page.. and there you go basic user permissions.. Adam
-
Warning: Cannot modify header information - headers already sent by
Adam replied to zuko's topic in PHP Coding Help
what's in header.php? If there's HTML in there you'll need to put that after you process the login .. -
[SOLVED] getting a paragraph to not display first 4 lines
Adam replied to scarhand's topic in PHP Coding Help
Oops, on both my examples should be: print $lines[$i] . "\n"; -
[SOLVED] getting a paragraph to not display first 4 lines
Adam replied to scarhand's topic in PHP Coding Help
to not show line 3.. $lines = explode("\n", $text); for ($i = 0; $i <= count($lines); $i++) { if ($i != 2) print $line . "\n"; } Remember array's start at 0 .. so it's index 2 in the array not 3.. -
[SOLVED] getting a paragraph to not display first 4 lines
Adam replied to scarhand's topic in PHP Coding Help
that would depend, are they all going to be split into new lines or would word wrap effect the lines to remove? It they are proper new lines, then you could use: $lines = explode("\n", $text); for ($i = 4; $i <= count($lines); $i++) { print $line . "\n"; } One of many ways I imagine.. Adam -
Really struggling to udnerstand what is you're trying to do, apart from use $sav as the array key.. Going with "X B123456 P12.34AB" as the value of $result.. Why are you using: $innerData = explode( "\t", $result ); .. when there are 3 spaces as tabs in $result and not actual tabs? Why are you using: $machine = explode("\n", $innerData[2]); .. when the value of $innerData[2] = P12.34AB ? $machine = explode("\n", $innerData[2]); $machine = $machine[0]; .. Is basically a long way of saying $machine = $innerData[2] ? Have you tried putting <pre> tags around $result to see excactly what's in there?? Sorry, just a little confused .. Adam
-
It searches the field for the matching string with 'any number of characters in the pattern' (at each side of it) .. Basically just a wildcard character.. Adam
-
You could try using single quotes around the string, that would stop the special characters actually meaning anything to PHP, or if the string is coming from another source where this might not be possible, try adding: $sav = str_replace("\t", "", $sav); Adam
-
I'm not sure I understand what you're asking. I think the names of your tables and fields are a little confusing, 'token'? Would a better word be 'attribute'? If so I reckon I know what you'r asking; to find "items" matching the description entered into the textarea, basically? This is possible, but certain things you'll need to think about in order to make it usable to a new user. Like say someone entered "quite round" and you have "almost round", you'd probably need to figure out a way of suggesting other terms to improve results. Also people make spelling and grammer mistakes, case-sensitivitey, etc. Lots of things to consider. If they entered a criteria for each new line you can just explode the string using "\n" and you have each attribute nicely set in an array, which you can then use with your query. I don't think this would just be a simple query though.. Adam
-
I think he's asking for the IP to work as a kind of "to" address for his popup. So when a user at one IP clicks to send 'popup' to another user at another IP, it'll popup a message or something .. Perhaps some kind of chat system or admin system? If you want it to be in real-time, ie. not every time the page is reloaded, then you'd definately need AJAX... Otherwise it's just registering who sent who what in the database and then testing for it with PHP when the page is loaded. I assume with you posting in the javascirpt forum though you're looking for it to be real-time.. Adam
-
Could you not just edit that script and using their logic just reverse the counter for if it's gone over? Adam
-
clear shopping cart content on closing browser or body unload
Adam replied to vinpkl's topic in PHP Coding Help
No worries. To be honest I'd go with steve's idea anyway.. Adam -
By the way: $prod_result[] = mysql_query(".."); ...Won't be saving the database record as an array - like you may expect - but a bool (true/false) return from the mysql_query... you'd need to use mysql_fetch_assoc() again to return the actual row values.. Adam
-
clear shopping cart content on closing browser or body unload
Adam replied to vinpkl's topic in PHP Coding Help
I'm not sure of the limits to javascript's "onunload" .. butyou could try something like: <script type="text/javascript"> function clearCart() { // try to make an ajax call to say 'clearcart.php' .. } </script> Then just add: <body onunload="clearCart();"> When the clearCart() function is called the page will have already unloaded, so I'm not sure if there any limits in what you can do, but worth a shot! Adam -
try adding %s: $Look = mysql_query("SELECT * FROM table WHERE column LIKE '%{$Search}%'");
-
you will need your function to return true if the user is logged in no probs or false if there's a problem. Then have: if ( checkLogin('1 2')) { include "connect.php"; //mysql db connection here include "../getuser.php"; } Which tests for the checkLogin function returning true.. adam
-
Why what does IE do? If the browser doesn't have an "open with" dialogue box there's no way of getting one to appear..? IE does have the "Open", "Save As" (or something) and "Close" dialogue box, I think firefox's is just better! Adam
-
<?php $sav = "B123456"; $machine = "P12.34AB"; $machineSAVs = array(); if( !array_key_exists($sav, $machineSAVs)) $machineSAVs[$sav] = $machine; print_r($machineSAVs); ?> That works perfect on my work host - which normally has a bit of a strange configuration, so I can't imagine why it's not working on yours? ??? Try looking through phpinfo() for something to do with array keys? Adam
-
I'm not sure if its just on this code but: $sav = "B123456" $machine = "P12.34AB" $machineSAVs = array(); Are missing ;'s on the end... Do you have error reporting turned off?
-
Ha right err.. Just go with a file search then ??? Up to them if they choose to save that extra bit of money but for what it would cost for your services i should imagine would be far more beneficial to them to have a speedy search..
-
the best way I can think of is to allow the users to search a database rather than the files. Would be much easier and faster... To get all the information from the files to a database, you could create a small purpose built search bot that would run through the files and save the key information.. then setup a cron job to index the files say once a day? or you could set it up as a script so it will index the files at the owners request... Adam
-
Quick google search found .. http://www.openwebware.com/ .. looks like a good deal!
-
Could create a javascript / ajax script to every say, 20 minutes kind of 'ping' the webserver and keep the session alive? Adam
-
Need to see some code?? Can't help you if we have absoloutley no idea how you're doing it at the minute..