-
Posts
3,584 -
Joined
-
Last visited
-
Days Won
3
Everything posted by JonnoTheDev
-
By using a user_to_groups table design users ===== user_id name username password groups ====== group_id title user_to_groups =========== id user_id group_id So if there are 3 groups - id 1,2, and 3 then I can grant access to any user id by adding a record in the user_to_groups table. Lets give user_id 1 access to groups 1 & 3 user_to_groups =========== 1 1 1 2 1 3
-
You would need to read the question and submit the answer into the text field. If there is more than one question then you must have the answers ready i.e. store them in an array and get the answer record from the question. Treat cURL as a web browser without a human clicking links or inputting into form fields. However websites will still function as they do in a normal browser, redirecting you if session values aren't set, 404 errors on invalid links, etc. You cannot bypass website security just because you are using cURL. Example using cURL to post into a form where the field names are 'name' & 'answer' <?php $dataArray = array('name' => 'joe', 'answer' => 'slumdog millionaire'); # Convert data array into a query string (ie animal=dog&sport=baseball) foreach($dataArray as $key => $value) { if(strlen(trim($value)) > 0) { $value = is_array($value) ? $value : urlencode($value); $tempString[] = $key . "=" . $value; } else { $tempString[] = $key; } } $queryString = join('&', $tempString); curl_setopt($ch, CURLOPT_POSTFIELDS, $queryString); curl_setopt($ch, CURLOPT_HTTPGET, FALSE); ?>
-
This is incorrect if ($_POST["$submit"]) Use if ($_POST['submit'])
-
if(strlen($_SESSION['submitted'][30]['other'])) { echo "choice 1"; } if(strlen($_SESSION['submitted'][31]['other'])) { echo "choice 2"; } If you have many array keys i.e. 30,31,32,33, etc then you may want to run through a loop
-
What does this mean?
-
Permissions! The webserver will run as a non-administrative user i.e. apache For programs to run via the CLI through exec the webserver user must have the permissions available.
-
This is bad practice
-
I would strongly recommend you going through a few tutorials before asking for help as you are a beginner. Connecting to a database, selecting, inserting and updating records is basic stuff and is covered here: http://devzone.zend.com/node/view/id/627 Once you have aquired the skills then you should have no problem in adapting to your own website.
-
unable to send emails to hotmail and yahoo accounts This has nothing to do with the mail function. It will probably be reverse DNS on your mailserver or something. Yahoo / Hotmail may reject your messages because the hostname of your mailserver cannot be resolved from it's IP address.
-
i.e. date_default_timezone_set('America/Los_Angeles');
-
Waste of memory space using variables for each item in the $_POST, $_GET array. Use the data within the array foreach($_POST as $key => $val) { $_POST[$key] = mysql_real_escape_string($_POST[$key]); } mysql_query("INSERT INTO table SET name='".$_POST['name']."'");
-
Because you should join tables on foreign keys. If for some reason there were 150 records in the products table and 151 in the description then you arent going to get the correct results. Also if you ordered one table in adifferent way to the other then the products wont match the descriptions.
-
post the login class $login = new login();
-
<?php for($i=1;$i<=10;$i++) { echo "<div id='bldlvl".$i."' style='background-color: yellow; width: 100%; clear: both; border-top: 1px gray dashed; display:none;'><p>".$aftermath->listings('buildings',$i,'edit')."</div>"; } ?>
-
It maybe a tornado and your client is in Oz! What is Free Realty 3.0? What are the errors if any? Do you know if cookies are required to login? Has your client blocked cookies? Post the source code for the login script!
-
Use a hidden field if using a post method print "<input type=\"hidden\" name=\"rrn\" value=\"$rrn\" />";
-
Audio not playing on initial opening of browser
JonnoTheDev replied to offtheroad's topic in PHP Coding Help
None of the files you have posted have anything to do with music playback. The buildMisicPlayer file reads the filenames in your mp3 directory then constructs an xml document. sound.play() is a Javascript function. If this is in your site then your probably looking for an onLoad() event handler within the <body> tag of your html pages -
Radio button to Change Drop-Down Fields
JonnoTheDev replied to ultrasound0000's topic in PHP Coding Help
Write a Javascript function that populates the select list using DOM via an onChange event handler on each radio button. -
get rid of this: if (isset($_POST['submit'])) { and use a hidden field: <input type="hidden" name="action" value="login" /> if($_POST['action'] && $_POST['action'] == 'login') { // validate username and password }
-
If a client requires a major modification to the way the system works then this is where you run into issues using off-the-shelf software. You have to fully understand the system to be able to make the required modifications. This scenario is not so bad when it is your own system as you know exactly what to modify and can estimate time to do it. If you need something up and running quick then use Joomla, osCommerce, etc. Once you have time, learn the main parts of the system to give you ideas on how to construct your own version adding the features that most of you clients require.
-
if($_POST['username'] == "login" && $_POST['pass'] == "login") {
-
You will only get the final result written. You should open the file once only. Write your header row. Then write to the file within the loop for your database records. Then close the file after the loop. You are also using 2 queries and a nested loop, bad idea. You should write 1 query and join the 2 tables. I am guessing they join via products_id SELECT p.*,pd.products_name,pd.products_description FROM products p, products_description pd WHERE p.products_id=pd.products_id Now your loop //heading to be written once to file $f1 = fopen("g_file.txt", "w+"); fwrite($f1, "id\ttitle\tdescription\tprice\tlink\timage_link\n"); //loop to get data while ($r2 = mysql_fetch_array($result2)) { $y4 = $r2["products_id"]; $y1 = $r2["products_model"]; $y2 = $r2["products_price"]; $y3 = $r2["products_image"]; fwrite($f1, $y4."\t".$y1."\t".$y2."\t".$y3."\n"); } fclose($f1);
-
Use the header function to redirect, not a meta refresh. header("Location: xyz.php"); exit();
-
if(preg_match('%The maximum bet is set at <b>\\$([0-9,]+)</b>\\.<br>%', $subject, $regs)) { $result = $regs[0]; } print $result;