-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
that's just a notice, not an error. you can suppress notices by puting a @ symbol at the beginning of the line - it's not a habit I encourage though, if you are getting that notice, and that page isn't being included/required by any other pages feel free to drop the session_start() from this one. I don't see what problems you are inferring there Christian, as the session variables can be assigned before the header is sent, and carried through with the header it seems like a logical solition rather than an aditional problem. I am well aware of the purpose of the session array and it's general usage, and for what is being described it does the job. I also really don't understand why you would say that my advice for using sessions should be disregarded and then go on you give alternate advice that is in fact to use sessions...
-
// if($ticket_id_check < 0){ should be if($ticket_id_check <= 0){ as for getting an exact match, change the LIKE in the SQL to an = sign and remove all % wildcards from the string decleration.
-
Session variables can be assigned without the need to output anything to the html - so before the headers get finalised. Thus you can assign the $list to $_SESSION['list'] and then push the header:location to a new page where you will have access to the $_SESSION['list'] variable. you will need session_start(); at the top of every page that is used. It also makes the url's nicer (and more spider friendly - unless you changed your .htaccess file already) and removes visability of data from the end user
-
Actualy...I keep it simple with the sanitize and validate functions I linked to previously. I'm pretty sure that the validate uses the same match as the sanitize (can't evidence that though). I should have stipulated that I use both, but figured it would be taken as granted. FILTER_SANITIZE_EMAIL "email" Remove all characters except letters, digits and !#$%&'*+-/=?^_`{|}~@.[]. So that's not going to play nice with html tags, yeah it allows the ampersand, but strips semi-colons, so that's not a big issue either. oh....and I trust no one
-
quick fix would be to use sessions instead of get.
-
I suspect the fault lies here : if (isset($variable)){ //get question id from user and store $id = '2'; } else { //no question id submitted $id = '2'; //unset session data unset($_SESSION['questions']); unset($_SESSION['total']); } I suspect the first $id= is supposed to be $id=$variable; It's just a hunch though...
-
Can't Use Function Return Value In Write Context In
Muddy_Funster replied to azraelGG's topic in PHP Coding Help
You can't pass a sha1() into isset() as a parameter. As isset is a check in it's self I would give it it's own space in the if conditional, which should remove your problem aswell. i.e. if ((isset($korisnickoIme) && $korisnickoIme !=='admin') && (isset($lozinka) && (sha1($lozinka) !== '7110eda4d09e062aa5e4a390b0a572ac0d2c0220')) { -
As sumpygump said, you are using the mysql_real_escape_string() in the totally wrong place. mysql_real_escape_string() is only used to make strings safe to run through queries. What you probably should see are double quotes at the start and end of your message as well. However, darkfeeks is also right, as you are sending your message as html, you won't get line breaks from that, it will just dissapear, because html doesn't use standard text control char's to format it's layout. If you are sending an html email you should be coding the content in html.
-
Either the main page has lost the file that declares $db as a new PDO (have no idea why this is in a file all it's own), $db is being destroyed or changed to a different type of variable in the code between being declared as an object and being called for the prepare, some other problem is preventing $db from being declared in the first place. What debugging have you done already? To be fair though, none of these are the biggest problem with your code.
-
Just a note here, mysql_real_escape_string() does nothing to integer values, such as an age. The way your are using your htmlentities() would be better suited to using sanitizer and validator filters - I persoanly always use FILTER_VALIDATE_EMAIL() for all email fields. I'd also never apply htmlentities() to an email field.
-
Here's another little bit of advice on the SQL front - always name your fields when doing a query (either a SELECT or an INSERT), and don't INSERT anything into an auto_inc field. So instead of SELECT * FROM table1 USE SELECT `field1`, `field2`, `field3`, `field4` FROM table1 and INSERT INTO table1 VALUES('', 'value1', 'value2', 'value3') Becomes INSERT INTO table1 (`field2`, `field3`, `field4`) VALUES ('value1', 'value2', 'value3')
-
have you looked at triggers at all? I'm not really clear on exactly what you are looking to do, but from the sound of it a trigger might be what your looking for.
-
Quick Way To Learn Php For Specific Purpose?
Muddy_Funster replied to zbdblues's topic in PHP Coding Help
For help in a hurry your going to need to out source it. Your talking about multiple script integration (with at least one of them obsolite so your talking about integrating scripts written for different versions of PHP as well) as well as playing with perl. For all the hastle your bringing on yourself I can't help but feel there must be a better solution available. There is no "quick fix" to get what you have all talking together (that I know of). -
You are almost there, but you need to start thinking in multi-dimensions (for your array that is). $topArray = explode("\n", $string); foreach($topArray as $topKey => $topValue){ $topValue = explode("|", $topValue); } foreach($topArray as $subArrays){ foreach($subArrays as $subKey => $subValue){ $subValue = trim($subValue); if(get_megic_quotes_gpc){ strip_slashes($subValue); } } } $qry = <<<QRY INSERT INTO publicEN( unique_system_identifiern, uls_file_number, ebf_number, call_sign, entity_type, licensee_id, entity_name, first_name, mi, last_name, suffix, phone, fax, email, street_address, city, state, zip_code, po_box, attention_line, sgin, frn, applicant_type_code, applicant_type_other, status_code, status_date) VALUES QRY; $valueList = ""; foreach($topArray as $valueArray){ $valueList .= "('"; $valuelist .= implode("', '", $valueArray); $valueList .= "')"; } $qry .= $valueList; //Perform SQL commands using $qry Don't expect this to work as is, it's just ment to show you an example of the methodology. You'll need to work with it to make it happen.
-
Compare And Merge Multidimensional Array Values
Muddy_Funster replied to matthewtbaker's topic in PHP Coding Help
well I didn't expect t it to work out the box, after all, i did say close can you give any advance one "this does not work" ?- 7 replies
-
- array_unique
- array_merge
-
(and 1 more)
Tagged with:
-
Select Button Beneath Items Called From Database
Muddy_Funster replied to sildona's topic in PHP Coding Help
You're welcome, good luck. -
Compare And Merge Multidimensional Array Values
Muddy_Funster replied to matthewtbaker's topic in PHP Coding Help
Off the top of my head something like this should be close: for($i=0;$i<=count($smallArray)-1;$i++){ foreach($bigArray as $sdArray){ if($smallArray[$i]['url'] == $sdArray['url']){ $sdArray['refferer'] = $sdArray['refferer'].$smallArray[$i]['refferer']; } } }- 7 replies
-
- array_unique
- array_merge
-
(and 1 more)
Tagged with:
-
Select Button Beneath Items Called From Database
Muddy_Funster replied to sildona's topic in PHP Coding Help
Best way would be to have the form created dynamicly by the php code. here's a summary of how I'd suggest you do it : 1- Have php query for the database 2- Grab the product headings from the query into either an array or series of variables 3- Loop through results of the query, assigning each value to a variable that contains <option> elements relevent to a <select> element based on the product heading you just got 4- build the form using the array and/or variables that you have built 5- echo / print onto page Hope that helps. -
Looping Through Arrays And Finding The Unique Ones
Muddy_Funster replied to jattsurma's topic in PHP Coding Help
My suggestion would be to check the values off as you build the $bundle_pickup array and only add a new value and not a duplicate one. This can be done by building a comparison array at the same time and as each value is taken from the session check if the values are in the comparison array first, then if not add the entry to both arrays and check the nest one, if it is in the comparison array discard it. To do it the way you are planning would require some relativly complicated runs thorugh the array to check off the values which would be slightly less efficient.- 2 replies
-
- php arrays
- multidimensional arrays
- (and 3 more)
-
you haven't created an instance of the mail class. you need to do something like $Mail = new Mail(); and then you can call $Mail::factory('smtp') I havn't used this Mail that you're using so can't say more than that really.
-
PHP Error - "Uninitialized string offset: 36"
Muddy_Funster replied to jeradb's topic in PHP Coding Help
have you tried something more conventional like: for ($a = 0; $a < $length; $a++) { $pos = mt_rand(0, strlen($chars)-1); $string .= substr($chars, $pos, 1); $pos2 = mt_rand(0, (strlen($Data))-1); $string2 .= substr($chars, $pos2, 1); } the other thing I will say is that your $Data is likely a good bit longer than your $chars, so watch out for that returning a $pos2 that is outside the range of $chars.