Jump to content

d_barszczak

Members
  • Posts

    188
  • Joined

  • Last visited

Posts posted by d_barszczak

  1. I am currently designing a Flash PHP MYSQL Chatroom which will allow users to have a chatroom on their website but hosted from mine.

    The early beta version is availerble on my website for viewing.

    I would like to add a content filter option to the client that stops users from submitting certain words so i need a way of removing or detecting certain words from a variable.

    Once i do this i will be able to cycle through an array of words which are stored in a mysql database.

    All this is done but just can't seem to find the command to find the words withing the variable.
  2. It may be your installation that is set up slightly wrong but it could be either mysql, apache or php so to eliminate php have you tried a simple echo "Hello World"; script.

    Do your html files display ok.

    Or is it just when you attempt to use mysql.
  3. This should grab the posted variable and place it in a local variable.

    to make sure the information has been passed you can delete the comment tags and the variable will be printed to the screen.

    [code]
    // setup

    $var1 = $_POST['var1'];

    // echo "$var1";

    $count = 0;

    if($var1 == 1){$count++;}
    if($var1 == 2){$count++;}
    if($var1 == 3){$count++;}
    if($var1 == 4){$count++;}
    if($var1 == 5){$count++;}
    if($var1 == 6){$count++;}
    if($var1 == 7){$count++;}
    if($var1 == 8){$count++;}
    if($var1 == 9){$count++;}

    // check
    if($count == 0){Give error}
    [/code]
  4. [!--quoteo(post=383135:date=Jun 13 2006, 08:28 AM:name=Switch0r)--][div class=\'quotetop\']QUOTE(Switch0r @ Jun 13 2006, 08:28 AM) [snapback]383135[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    well ive got them all with == instead, and no matter how many boxes i choose (other than 0), the $count remains at 0, muh?
    [/quote]

    ok,

    as a test you could put a echo var1 to make sure that the variable is being passed.

    think you might need something like.

    [code]
    $var1 = $_POST['var1'];
    [/code]

    before your if statement.
  5. [!--quoteo(post=383132:date=Jun 13 2006, 08:19 AM:name=Switch0r)--][div class=\'quotetop\']QUOTE(Switch0r @ Jun 13 2006, 08:19 AM) [snapback]383132[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    well ive changed the plan slightly...hopefully less complicated now :)

    i now have 9 checkboxes on the form, and at least one of them needs to be checked to proceed.

    this is what ive got so far:
    [code]
    // setup
    $count = 0;
    if($var1 = 1){$count++;}
    if($var1 = 2){$count++;}
    if($var1 = 3){$count++;}
    if($var1 = 4){$count++;}
    if($var1 = 5){$count++;}
    if($var1 = 6){$count++;}
    if($var1 = 7){$count++;}
    if($var1 = 8){$count++;}
    if($var1 = 9){$count++;}

    // check
    if($count = 0){Give error}
    [/code]

    only this still doesnt work
    [/quote]

    Your if statement is wrong here you need if($var1 == 9){$count++;} [i]note the 2 ==[/i] otherwise your applying a new value to $var1.
  6. [!--quoteo(post=383086:date=Jun 13 2006, 05:09 AM:name=kenrbnsn)--][div class=\'quotetop\']QUOTE(kenrbnsn @ Jun 13 2006, 05:09 AM) [snapback]383086[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    The empty() function doesn't always work when deciding whether a field is filled in.

    I've been using something like this:
    [code]<?php
    if (strlen(trim(stripslashes($fld))) == 0) echo 'Field hasn't been filled in'; ?>[/code]

    Ken
    [/quote]

    As far as i am aware if you have a field and submit the form with the field black the variable is still set (just with no data in it) which is why your result page always comes back as true.

    Try:

    if ($_GET['title'] <> NULL )) {
    $title = $_GET['title'];
    echo "the title is $title";
    }

    This checks to see is any data exists in the variable not if the variable exists.
  7. Not sure what your saying but if your not sure how many files are going to be generated by the previous script you can put the generated filenames in an array with something similar to the following.

    Just rember this will grab every file in the folder of $path.

    [code]

    $path = "/path/to/your/files/";

    if ($handle = opendir($path)) {

         while (false !== ($file = readdir($handle))) {
              if ($file <> "." and $file <> "..") {
              $dir[$I] = "$file";
              $I++;                                
              }
         }
         closedir($handle);                                  
    }
    [/code]
  8. [!--quoteo(post=382846:date=Jun 12 2006, 03:40 PM:name=crimsonmoon)--][div class=\'quotetop\']QUOTE(crimsonmoon @ Jun 12 2006, 03:40 PM) [snapback]382846[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    What is the best most full proof method of IP logging. I log IP's and can ban those but then someone can always just spoof that IP and change it going around my ban.

    Any suggestions?

    How do those of you who run sites get and manage your players IP's?
    [/quote]

    Are cookies an option for you as you could leave a cookie on computer you are wanting to deny access and have you page check for banned cookies.

    If not i have heard of scripts that grab the mac address for you.
  9. [!--quoteo(post=382720:date=Jun 12 2006, 04:24 AM:name=helpmenow)--][div class=\'quotetop\']QUOTE(helpmenow @ Jun 12 2006, 04:24 AM) [snapback]382720[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    I'm trying to add file upload form to one of my pages using php

    you can view it at [a href=\"http://www.kgportraits.com/upload.php\" target=\"_blank\"]http://www.kgportraits.com/upload.php[/a]

    there is a problem with the "copy" function if you notice. What is the problem here?

    Thx.
    [/quote]

    Have you got the correct CHMOD settings for the folder you are wanting to upload to.

    I believe they should be 777 and can be set from a basic FTP client such as SmartFTP.
  10. [!--quoteo(post=382821:date=Jun 12 2006, 02:37 PM:name=gladiator83x)--][div class=\'quotetop\']QUOTE(gladiator83x @ Jun 12 2006, 02:37 PM) [snapback]382821[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Hey All,

    I have a listbox that is comprised of about 50 options. When one option is selected it takes the browser to a page where associated data is automatically generated from a database.

    What I am trying to do is put a textbox of some sort on the second page and when data is inputted, I wanted it to be saved for each particular option in the list box. So if I chose lets say option A, and the associated data pops up along with a text box, I want to be able to enter in the word ‘dog’. When I open up another browser and select option A again, I would like to see besides my associated data, a select command that will take me to the page that has dog saved. Is that caching? I would really appreciate it if you any one of could help me. Thanks [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

    Christopher
    [/quote]

    I think the easiest way of doing this would be to use cookies and make the page check for your assosiated data before loading the page.

    If your users are logging in to your website with a mysql backend you could create a table and store all of the saved data for page and user in a database and recall that information everytime your page loads.
  11. [!--quoteo(post=382796:date=Jun 12 2006, 12:51 PM:name=Dobakat)--][div class=\'quotetop\']QUOTE(Dobakat @ Jun 12 2006, 12:51 PM) [snapback]382796[/snapback][/div][div class=\'quotemain\'][!--quotec--]

    }elseif ($currank == "Criminal"){
    $max = '220';
    $old="120";
    }elseif ($currank == "Thug"){
    $max = '350';
    $old="220";
    }elseif ($currank == 'Robber'){
    $max = '460';
    $old="350";
    }elseif ($currank == "Criminal"){
    $max = '880';
    $old="460";
    }[/quote]

    Do you know you have 2 if statements looking for criminal?
  12. [!--quoteo(post=382791:date=Jun 12 2006, 11:49 AM:name=Collymore)--][div class=\'quotetop\']QUOTE(Collymore @ Jun 12 2006, 11:49 AM) [snapback]382791[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Hi.

    Basically I intend a user to log on to a site (MySQL). I want to create a simple table with two fields ('user' , 'number') and depending on what number is in the number field, I want the user to be directed to a certain page.

    Can this be done by an IF statement on the login page? If so, what would the IF statement look like? There could be 50 different pages so there might be a more efficent way of doing this?

    For example, if the number in the field is 22, then they will go to 22.php to interact with a table called 22.

    Thanks in advance.
    [/quote]

    There may be more efficent ways of doing this but it really depends on the data they will be viewing once they have logged in.

    If i was trying the above i would have a table with 3 columns [i]ie username password page[/i] in a table called users and have the form submitted to something like this.


    [code]
    <?php

    $user = "username";
    $pass = "password";
    $host = "localhost";

    $data = "database";

    $query = "SELECT * FROM users WHERE username = '$username' AND password = '$password'";

    mysql_connect($host, $user, $pass) or die(mysql_error());

    mysql_select_db($data);

    $report = mysql_query($query);

    $num = mysql_num_rows($report);

    if ($num == 1) {
         $row = mysql_fetch_array($report, MYSQL_ASSOC);
         extract($row);
             echo "<script language='javascript' type='text/javascript'>window.location.replace('path/page.php')</script>";
    } else {
    // Fail Script goes here...
    }
    ?>
    [/code]
  13. [!--quoteo(post=382764:date=Jun 12 2006, 07:18 AM:name=thehigherentity)--][div class=\'quotetop\']QUOTE(thehigherentity @ Jun 12 2006, 07:18 AM) [snapback]382764[/snapback][/div][div class=\'quotemain\'][!--quotec--]according to the admin section of my server i Im using
    PHP version 5.0.5
    and
    MySQL version 4.1.19
    [/quote]

    Guessing by the above you are using a hosting company as apposed to running your own local web server.

    If this is the case a lot of hosting companies (Including Mine) will allow you to create your own Databases but only through their admin interface. I have a test server which i use and the following code worked for me on that server but not on my ISP Server.


    [code]
    <?php

    $query = "CREATE DATABASE my_db";

    $user = "username";
    $pass = "password";
    $host = "localhost";

    mysql_connect($host, $user, $pass) or die(mysql_error());

    mysql_query($query) or die(mysql_error());
    ?>
    [/code]
×
×
  • 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.