-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
Working on a Database search and a bit stuck
Muddy_Funster replied to CraigH's topic in PHP Coding Help
Yeah, I'll be honest with you, I'm not 100% on what it is you are doing with that given $Code_Of_Installation1 = $_GET['Code_Of_Installation']; $Code_Of_Installation2 = $_GET['Code_Of_Installation']; $Code_Of_Installation3 = $_GET['Code_Of_Installation']; Looks to me as though they are all being given the same value. I'm guessing it's some strange way of assigning the select option values for the inital form. To keep using it you just need to make sure that the inital identifier variable in your isset($_GET['']) clause is the same name throughout just as it was before. -
Pass it through a session variable if you must. Start BOTH pages (the one you posted and the target page for $newname) with <?php SESSION_START(); [your code here] Add this line after you assign $newname near the bottom of your current page $_SESSION['newname'] = $newname; and add this line near the top of your target page after the SESSION_START() comment and befor you want to use the $newname variable: $newname = $_SESSION['newname'];
-
Your form option echo should be ) echo 'selected="selected"' ?> in order to identify which option is shown on creation, otherwise it will default to the first option (in this case "Agent")
-
How to install winamp in server through php coding
Muddy_Funster replied to chandram1985's topic in PHP Coding Help
I couold be wrong here, but I think you need a terminal services server in order to actualy run an executable directly on a server, and php uses web server access rights - so I don't think it can be done (could have some fun with trojans if it does work though ). -
I see, I thought that you were storing all the information in a database, then pulling it out for your page, that I could have helped with. I'll have to concede I don't know a whole lot about array manipulation with PHP yet so can't offer any help with that
-
Problem Upload video file in the server folder
Muddy_Funster replied to 1981tarun's topic in PHP Coding Help
I've been waiting to use this.... http://php.net/manual/en/features.file-upload.php -
I see, so this is just about your arrays, nothing at all to do with a database then?
-
Working on a Database search and a bit stuck
Muddy_Funster replied to CraigH's topic in PHP Coding Help
OK, sonce you are only having one chosen value for each column in the DB per search, how about trying somthing like this : <?php $pre_qry = "SELECT Code_Of_Instalation, Gland_Material, Cable_Type, Sealing_Configiration, Approvals, Application_Catagory, Onshore_Offshore FROM tableName"; if ($_GET['Code_Of_Instalation'] && $_GET['Gland_Material'] && $_GET['Cable_Type'] && $_GET['Sealing_Configiration'] && $_GET['Approvals'] && $_GET['Application_Catagory'] && $_GET['Onshore_Offshore'] == ""){ $qry_where = ''; } else{ $qry_where = 'WHERE '; if ($_GET['Code_Of_Instalation'] != ''){ $code = $_GET['Code_Of_Instalation']; $qry_where = $qry_where.' Code_Of_Instalation = \''.$code.'\' AND '; } if ($_GET['Gland_Material'] != ''){ $gland = $_GET['Gland_Material']; $qry_where = $qry_where.' Gland_Material = \''.$gland.'\' AND '; } if ($_GET['Cable_Type'] != ''){ $type = $_GET['Cable_Type']; $qry_where = $qry_where.' Cable_Type = \''.$type.'\' AND '; } if ($_GET['Sealing_Configiration'] != ''){ $seal = $_GET['Sealing_Configiration']; $qry_where = $qry_where.' Sealing_Configiration = \''.$seal.'\' AND '; } if ($_GET['Approvals'] != ''){ $app = $_GET['Approvals']; $qry_where = $qry_where.' Approvals = \''.$app.'\' AND '; } if ($_GET['Application_Catagory'] != ''){ $cat = $_GET['Application_Catagory']; $qry_where = $qry_where.' Application_Catagory = \''.$cat.'\' AND '; } if ($_GET['Onshore_Offshore'] != ''){ $shore = $_GET['Onshore_Offshore']; $qry_where = $qry_where.' Onshore_Offshore = \''.$shore.'\' AND '; } $cutoff = (strlen($qry_where) - 4); $qry_where = substr($qry_where, 0, $cutoff); } $qry_full = $pre_qry.$qry_where; $result = mysql_query($qry_full) or die (mysql_error()); echo '<table border="1"><tr><th>Code Of Instalation</th><th>Gland Material</th><th>Cable Type</th><th>Sealing Configiration</th><th>Approvals</th><th>Application Catagory</th><th>Onshore/Offshore</th></tr>'; while ($row = mysql_fetch_assoc($result) { $code_out = $result['Code_Of_Instalation']; $gland_out = $result['Gland_Material']; $type_out = $result['Cable_Type']; $seal_out = $result['Sealing_Configiration']; $app_out = $result['Approvals']; $cat_out = $result['Application_Catagory']; $shore_out = $result['Onshore_Offshore']; echo '<tr><td>'.$code_out.'</td><td>'.$gland_out.'</td><td>'.$type_out.'</td><td>'.$seal_out.'</td><td>'.$app_out.'</td><td>'.$cat_out.'</td><td>'.$shore_out.'</td></tr>'; } echo '</table>'; ?> This is not tested, and will most certainly need tweeked a good bit, but it should be a little smoother than what you are using. Let us know how it goes. -
It's probably just me, but your objective here is unclear. What are these "values underneath" that you are reffering to, where are they stored, what does your select statement look like? Where does the information form the database come into the script?
-
For mailing have a look at this http://uk2.php.net/manual/en/function.mail.php What you will want to do is store a hash in the database against the new user, select this hash back out the database (make sure you enclose it in singel quotes) and mail it to the user with the prefix of "http://www.mysite.com/registration.php?hash=" on the address provided by the form. have a registration.php page that uses $_GET['hash'] to run a select against the hash in the database and then flag the user as authorised if they match. You will need to make sure you have columns in your database to store a status flag and the hash. If you have any issues let us know.
-
Working on a Database search and a bit stuck
Muddy_Funster replied to CraigH's topic in PHP Coding Help
Can you post up or explain your forms, I can't understand why you are assigning so many variables the same $_GET['input'] value. -
erm...thanks...i think
-
Help - My $_SESSION vars are being lost after a HEADER.
Muddy_Funster replied to cjp_24's topic in PHP Coding Help
That's a new one on me. the only reason I can think of why it would possably create multiple sessions per visit would be if some of the pages didn't have the SESSION_START() at the top of them before all the other code. This would effectivly have the result of generating a new session each time you move to a page that does have a session on it. for example, you go : page1->page2->page3->page4->page5 : page1 has a session on it and generates the key, page2 has a "broken" session and as such the session is dropped, page3 has another working session and so generates a new key as the old one was lost on page2, page 4 has no session at all and so the session key is again dropped, page5 doing what it should makes a third session key, so you get three sessions when you only wanted one. Here is a way to check if your sessions are being dropped :- on your home page just after the session_start(); add $_SESSION['test'] = 'true' now make a new php file (name it as you wish, i'm going to use ses_test.php for the example)add the following code to ses_test.php <?php If($_SESSION['test'] != 'true'){ echo '<h2><center>You'r Session Has Been Lost!</center></h2><br><br>'; } ?> Now include_once 'ses_test.php'; the file in each of your other pages just above any output (on pages with no output stick it anywhere you like that's not in the way of other coding) and see what happens. go through the site a few times and see if it losses session, and if it does see where it losses it - ie. is it always on the same pages? If so it may be that you code is leaking an output before the SESSION veriable initalises on that page. if it turns out to be on random pages you may need to look at other ways of attying your session information between pages (such as cookies or explicit headers). anyway, let us know how you get on. -
Usted necesidad de investigar cómo utilizar cookies. Si se obliga a las cookies, reducir el proxy como el spoofing "cookie" no puede llegar al cliente de la misma manera que la IP del cliente no puede llegar a sus cheques. Translated with Google Translator --------------------------------------------------- Original: You need to research how to use cookies. If you force cookies you will cut down on proxy spoofing as the cookie can not get to the client the same way the client IP can not get to your checks.
-
php with mysql query with a CSV type of dataset
Muddy_Funster replied to monkeytooth's topic in PHP Coding Help
There are a couple of ways it can be done, probably an array set using nested if's on your checkbox input would be the most likely approach, it does however meen that someone (and if your life goes anything like mine this meens you) will have the mind numbing task of entering the right yes:yes:no:yes.... combination in the column against each of your 400,000+ entrys. On top of that it's pretty bad practice. Given you don't want to edit the current table I would strongly suggest linking a second table to it, call it status or somthing, and cross refference on the ID number primary key in your current table as a forign key in your new table which you can set to cascade so any new entries in the main table auto populate the ID field into the new one. Doing this will help break out of this restrictive workspace youve been stuck in as you can then use the addition table to store any further info for the records that you want (assuming that from day one you use absolute refferencing for your INPUT statements). -
You should always put php code between <?php ... ?> Some servers still support short tags but you would need a space after the opening ? and before the closing one eg <? echo... ?> There is also nothing in the code that you have posted that assignes the $namm and $watchwoord variables. try adding this above your table code if you don't have it anywhere else: <?php if(isset($_POST['namm']){ $namm = $_POST['namm'];} else{$namm = '';} if(isset($_POST['watchwoord']){ $watchwoord = $_POST['watchwoord'];} else{ $watchwoord = '';}
-
my status echos are on the top of my page...
Muddy_Funster replied to navybofus's topic in PHP Coding Help
If you don't mind could you post up your code for the display page? -
change you bottom if statement to if(!isset($_GET['write']) and see how it goes
-
you could try and change the if statement to [php if(!empty($result)){ [/code] and see if that works any better (or even comment it out for testing.
-
What's not working about it? is it not selecting anything from the database? 'Cause it may be that you need to put some spaces after your commas in the SELECTs. Also, at the end of each "mysql_query()" line, before the " ; " include the following: or die (mysql_error())
-
Insert Date from PHP form into MySQL date column
Muddy_Funster replied to mtnmchgrl's topic in PHP Coding Help
try copying and pasting this section of code over what you have already (make a copy first of course) and let us know how you get on: // QUERY TO RETRIEVE ENTRY RESULTS $dateIn = $_POST['gameDate']; if (substr($dateIn, 5, 1) != '-' || substr($dateIn, 8, 1) != '-'){ die ('You did not format the date correctly, please use your back button and enter in format of "YYYY-mm-dd"'); } $date = new DateTime($dateIn); echo '<br><br>'.$date.'<br><br>'; $query="insert into `tournaments` ('tourneyName', 'gameDate') values('".$_POST['tourneyName']."', '".$date."')"; -
You are welcome, happy to have helped.
-
by using somthing that isn't PHP
-
got your table structure there?
-
I have included a crude fix for the affore mentioned problem: <?php SESSION_START() include 'connectionFile.php'; //change as appropriate $now = mysql_fetch_array(mysql_query("SELECT CURRENT_TIMESTAMP()")) //get time from database or die('UNABLE TO RETRIEVE CURRENT TIME FROM DATABASE -- '.mysql_error()); //show error on fail $curTime = ereg_replace('[^0-9]+', '',$now['0']); //get current time as number $qryA = "SELECT idField, startTime FROM tableName"; //select files from database table for comparison $resA = mysql_query($qryA) or die ('UNABLE TO RETRIEVE DATASET -- '.mysql_error()); //run query and show error on fail WHILE ($rowA = mysql_fetch_assoc($resA)){ //open loop to proccess each record in table $bTime = ereg_replace('[^0-9]+', '',$rowA['startTime']); //get time from table as numbers /* Time Correction */ $sam = substr($bTime, -4, 2); //select minutes from table time $sah = substr($bTime, -5, 1); //select hours from table time $sbh = substr($curTime, -5, 1); //select hours from current time if ( $sam > 29 && ($sbh == $sah + 1)) //check for problem in conversion {$bTime = $bTime + 4000; } //fix problem of going over the hour $checkTime = (($curTime - $bTime) * 0.6) //make difference check output more accurate /* End of Time Correction */ if ($checkTime > 1800){ //set time cut off for deletion in seconds -- changed from original due to above correction $qryD = "DELETE FROM tablename WHERE idField = ".$rowA['idfield']; //delete outdated entrys mysql_query($qryD) or die ('ERROR DELETING EXPIRED RECORDS -- '.mysql_error()) // execute deletion and display error on failure } //close if } //close while ?>