Jump to content

DylanBlitz

Members
  • Posts

    99
  • Joined

  • Last visited

    Never

Everything posted by DylanBlitz

  1. oh, so your talking about files on your local computer? Not located on the server? Uploading the file is fairly easy. What do you want to do with it once it's on the server? Are you looking to upload only text files then manipulate them once they're there?
  2. what do you mean by a file picker? You mean a way for the user to select a file and then open it?
  3. Here is the php.net example <?php // get contents of a file into a string $filename = "/usr/local/something.txt"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); fclose($handle); ?> http://www.php.net/manual/en/function.fread.php
  4. I'd try and see if this will help. if(mkdir($thisdir ."/$login" , 0755, true)) { chmod($thisdir ."/$login", 4755); }
  5. I'd do it like this $matho = array('+', '-', '*'); $math_var = $matho[rand(0, 2)]; switch ($math_var) { case '+': echo $number1 + $number2; break; case '-': echo $number1 - $number2; break; case '*': echo $number1 * $number2; break; }
  6. I'm not the best at .htaccess rewrite's and I'm running into a problem with a clients site. I have a site I setup and it's worked everywhere else with this in the .htaccess Options +FollowSymlinks RewriteEngine on RewriteRule ^p_(.*) view_profile.php?urlname=$1 The problem is that on this person's site they already have some rewrites in their .htaccess and mine just isn't working. Can anyone tell me where I need to start looking to see why mine doesn't work now? Options +FollowSymlinks RewriteEngine on RewriteCond %{HTTP_HOST} ^$ [OR] RewriteCond %{HTTP_HOST} ^www.$ RewriteRule ^(.*)$ http://clintstang.com [R=301,L] RewriteEngine On RewriteRule ^(sitemap.*\.(xml\.gz|txt))$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L] RewriteEngine On RewriteRule ^p_(.*) view_profile.php?urlname=$1
  7. Are you talking about a DHTML tree script? Works kind of like windows explorer. If you are then there's a ton out there. I'd download a free one and teach yourself how to do it yourself.
  8. If you have any ' like with you're you have to escape it, you\'re
  9. ok, what does it do when you add the extra code?
  10. Glad you got it figured out realjumper. Sorry I couldn't be more help before, only connected to LDAP with things other then PHP.
  11. Since the email verification is a function you have to call it. Functions don't do anything unless you say hey, I need you to work! :) [code] $mailto = email@address.com; $subject = "Feedback" ; $formurl = "index.html" ; $errorurl = "application-error.html" ; $thankyouurl = "_application.html" ; $uself = 0; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $from = $_POST['from'] ; $location = $_POST['location'] ; $http_referrer = getenv( "HTTP_REFERER" );   if (!isset($_POST['from'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($from)) {   header( "Location: $errorurl" );   exit ; } function valid_email($from) {   // check an email address is possibly valid   if (ereg('^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$', $from))   return true;   else header( "Location: $errorurl" ); exit ; } $email_err = valid_email($from); if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $from ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "Enquiry from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name: $name\n" . "Email: $from\n" . "Location: $location\n" . "Interested in: $interested\n" . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, "From: \"$from\" <$from>" . $headersep . "Return-Path: \"$name\" <$from>" . $headersep . "Reply-To: \"$from\" <$from>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); header( "Location: $thankyouurl" ); exit ;[/code]
  12. Ok, I'm bad with expressions. I have this that I pulled off php.net for replacing the text to include a url. I have a page that people can post msgs to. I want to automatically create links out of text so I used the bbcode style for them to specify if it's a url. [code]$text = preg_replace("/\[url=(\W?)(.*?)(\W?)\](.*?)\[\/url\]/", '<a href="$2">$4</a>', $text);[/code] works great if they do it like [code][url=http://www.somesite.com[Click here&[/url][/code] but if they just do [code][url]http://www.somesite.com[/url][/code] it doesn't work. any clue what I need to do to fix it? Or should I go about it another way?
  13. ah, see, always something other then what you thought the problem was lol. Glad to help out.
  14. This will tell you if something is wrong with the statement. [code]$result = mysql_query("SELECT gid.name, testbracket.points FROM testbracket LEFT JOIN gid ON testbracket.gid = gid.gid"); if (!$result) { echo mysql_errno().": ".mysql_error()."\n"; exit; } while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {   $name = $row['name'];   if (!$data[$name]) {     $data[$name] = $row['points'];   } else {     $data[$name] += $points;   } }[/code]
  15. the market table does have a race column right?We're problaby just missing something simple, a variable set wrong somewhere, that's why I'm asking you to output it all. Try something I forgot, if there's more then 1 row you need to loop through the results heh. [code] echo 'IID is:' . $inventory3[IID] . '<BR>'; $race_query = mysql_query("SELECT * from market where ID='$inventory3[IID]'"); for ($i = 0; $i < mysql_num_rows($race_query); $i++) { $race_fetch = mysql_fetch_assoc($race_query); $race_data = $race_fetch['race']; echo 'Database race is: ' . $race_data . '<BR>'; $racearray = explode(", ", $race_data); echo 'Race Array:<BR><pre>' . print_r($racearray,true) . '</pre>'; } echo '<BR><BR><BR>Users race is: ' . ($userstats3['race'] . '<BR>'; exit; if (isset($equip)) { if ($userstats3['race']==$race||$race=='All') { [/code]
  16. okay, but it depends on how your database is layed out, ie how your storing what item goes in what category. Here is is a simple way to do it categories table catid, catname, parent_id All my main items have a parent_id of 0, all items in a cat have their associated parent_id. You see where I'm going? Easy to do it that way. 1, Category 1, 0 2, Category 2, 0 3, Category 3, 0 4, Item 1, 1 5, Item 2, 1 6, Item 1, 2 7, Item 2, 2 8, Item 3, 2 etc Do a select where parent_id = 0 and get all the categories, then select the items where parent_id != 0, limit to 25, order by the parent_id. Hope that makes sense to you lol
  17. Okay, try this cause I'm getting confused lol. Paste what the page shows back here. I know we're not gettign to the in_array, trying to figure out where the problem lies. [code] $itemraces=mysql_query("SELECT * from market where ID='$inventory3[IID]'"); $itemraces2=mysql_fetch_assoc($itemraces); echo 'Market results:<BR><pre>' . print_r($itemraces2,true) . '</pre><BR><BR>'; $itemraces3=$itemraces2['race']; $racearray=explode(",", $itemraces3); echo 'Table results:<BR><pre>' . print_r($racearray,true) . '</pre><BR><BR>'; echo 'equip is:' . $equip . '<BR>'; echo 'race is:' . $userstats3['race']; exit; if (isset($equip)) { if (in_array($userstats3['race'], $racearray)||$race=='All') { [/code]
  18. You aren't giving enough info, if you give at least your database table layout and maybe a bit of code of how you are showing the data it would help. We've got no clue how you have your categorization done in the database.
  19. did you try what ken posted? It should give you an output of the arrays. First you want to make sure the right market records are getting returned. Also you can echo out the $inventory3[IID] and $userstats3['race'] to make sure they're holding the values your expecting. I can't count the times I've tried to trouble shoot a problem only to find out it was a bad variable that I had set wrong lol.
  20. ah, I think I know what your saying. Your getting a bit confused with the array though. $myarray = array('Dog', 'Jump', 'Brick', 'House'); Is that what your talking about? That's how you set an array. That's not what php considers the array to be once it takes that in. If you want to see how the array is setup try doing a print_r on an array so you can see how it's layed out. I think that will help you understand it a bit better.
  21. Have you tried binding anonymously? Or do you have that blocked? It should give you some kind of a result one way or the other, your code looks correct. I can't test it, don't have an LDAP directory to hit.
  22. explode will take a line of text and split it up depending on the qualifier. So if you have $myline = "See spot run. See spot jump. See spot die"; If you explode it on the . it will give you 3 array elements.
  23. you mean something like? [code] $result = mysql_fetch_array($query); $query_data = $result[names]; $query_array = explode(',', $query_data); if (in_array('Derby', $query_array)) { echo "Derby is here"; } [/code]
  24. Try this. $addr = ereg_replace("\r?\n", "<BR>\n", $addr);
  25. do you want each word to be it's own array element? It can be done [code] $result = mysql_fetch_array($query); $query_data = $result[names]; $query_array = explode(',', $query_data); print_r($query_array); [/code] That should get ya started maybe?
×
×
  • 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.