Jump to content

givememore

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Everything posted by givememore

  1. Vinlock ment $targetFile, I guess. If you want to alter the filename (witout extension) you first have to devide the filename from extension. For example with: $FileNameComplete = explode('.', $_FILES['Filedata']['name'][0]); $FileName = $FileNameComplete[count($FileNameComplete)-1]; $FileExt = $FileNameComplete[count($FileNameComplete)]; Then you can puzzle the new Filename you want the uploaded file to have, i.e. $targetFile = $uploadDir . $FileName . "_" .date('U') . "." . $FileExt;
  2. Even in the entire code this is the only part where the given error message occurs. Did you try to add the condition concerning the $username? if (mysql_num_rows($result) > 0 && $username != ""){ (sorry, the coloring doen't work inside the code-Tags)
  3. ok, in that case you'll need a new script. I've made the changes in the one attached to this post. Here you'll need to submit the complete redirect-path like "http://www.hardtimesover.com". 18405_.php
  4. No, in the script there are no prefixed settings. As I can see the landingpage has to be by passing the parameter 'redirect={landingpage}' eighter by GET or by POST Method. Maybe you have an hidden field (<input type='hidden' name='redirect' value='{landingpage}'>) in your HTML-Form? {landingpage} is only the filename you want to redirect to (without the servers name and without any slashes)!
  5. I don't know if it makes sense to allow empty usernames and I don't know what additional influence this will have on your project, but you can simply add this condition to the relevant if-clause: // Is username taken ? if(!$login_process){ $query = "SELECT * FROM customers WHERE username = '$username'"; $result = mysql_query($query) or die("Database error: " . mysql_error()); if (mysql_num_rows($result) > 0 && $username != ""){ //// <---- add condition here! array_push($msg,"This username is already taken, please choose another one."); } }
  6. There are several ways to solve that problem. The easiest for programming might be to replace all spaces in the searchstring by %-jokers: "black ops ps3" => "black%ops%ps3" Depending on the SQL-Server you use there are different SQL dialects, for example in Oracle: SELECT * FROM products WHERE prod_name LIKE '%' || replace($id, ' ', '%') || '%' (The || is the concatenate operator in Oracle's syntax) The disadvantage of this solution is that the order of the given keywords must fit the product's discription. In your examle you won't get results if you search for "ps3 black ops"... Consider: Some Databases are case-sensitive. So you might need to spend some thoughts on that issue, too. As you can see: Such a simple question easily becomes a quite complex algorithm. Please 'givememore' details (type of database, examples of database-entries, examples of searchstring etc) when you need further help. best regards Burkhard
  7. As I see, the problem is the echo "</select>"; inside the while loop. Try to put it after the loop ending }: <?php $quer3=mysql_query("SELECT discount_id, discount_name,discount_amount FROM tbl_discount order by discount_amount"); echo " <select name='discount_id'><option value=''>Select</option>"; while($row = mysql_fetch_array($quer3)) { if($row[discount_id]==$discount_id){echo "<option selected value='".$row[discount_id]."'>".$row[discount_name]." / $".$row[discount_amount]."</option>";} else{echo "<option value='$row[discount_id]'>$row[discount_amount]</option>";} } echo "</select>"; ?>
  8. the name of the input field is wrong in the email input. <td align="center"><input name="phonenumber" type="text" id="email" value="<? echo $rows['email']; ?>" size="15"></td> The name "phonenumber" is already used in the field above. Try to call it '... name="email" ...'.
  9. Yes, the rank field seems to be the correct way, but if you don't have a strict ordered rank (meaning there are pages/functions a user even with a high rank isn't allowed to use, but another user with a lower rank exceptional is allowed) you probably run into problems. I solved that using a field for userrights storing a number witch bitwise defines the individual rights. That way is applicible if you don't have more than 32 different right-options (with more than 32 options you may run into problems identifying / setting the correct bit depending on your environment). Let's have a look to some details: 1.) I defined an Array containing each userright as key and the corresponding bit as the value: /////UserRights\\\\\ $rights = array( "read_group1" => pow(2, 0), "read_group2" => pow(2, 1), "read_group3" => pow(2, 2), "edit_group1" => pow(2, 3), "edit_group2" => pow(2, 4), "edit_group3" => pow(2, 5), "admin_group1" => pow(2, 6), "admin_group2" => pow(2, 7), "admin_group3" => pow(2, , "usermanager" => pow(2, 9), "systemadmin" => pow(2, 10) ); In example user 'Fred' is allowed to read, edit and admin groups 1 and 3 and he is allowed to read group 2, his userright result in: Bit109876543210[/td] [td]Value 00101101111= 367 The decimal value (367) is stored in the field 'rights' of my usertable. 2.) The usertable is read in PHP using the 'normal' database functions. All user data is stored in the named Array $user. So I retrieve the userrights with $user['rights']. 3.) Now it is possible to decide in PHP whether a user is allowed to use a function or not comparing his $user['rights'] to my $rights Array: if ($user['rights'] & $rights['read_group1']) { //show messages in group 1 } if ($user['rights'] & $rights['edit_group1']) { //edit messages in group 1 } hope that helped Burkhard
  10. Hi Douglas, the same issue I had everytime I migrated a project from my test environment to productive machine... That's why I switched to sqlsrv-driver (which you have to use with SQL-Server 2005 or newer, afaik). Let me mention only one point in your script: You connect to MS-SQL Server with ".\SQLExpress" adressing the instance "SQLExpress" of the local computer (where PHP and the webserver are running). If you try to connect to a database on another machine you have to connect to "computername\instancename" or with its IP-Adress. Of course clientcabability has to be activated on SQLServer using the SQLControlPanel (mind the Clientprotocols are "active" AND "enabled"!) Burkhard
×
×
  • 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.