Jump to content

jandrews3

Members
  • Posts

    143
  • Joined

  • Last visited

Posts posted by jandrews3

  1. Try the following. The variable $differencetolocaltime is equal to the time difference between your server and you.

     

    <?php

    $differencetolocaltime=4;

    $new_U=date("U")-$differencetolocaltime*3600;

    print date("H:i", $new_U);

    ?>

     

  2. How do I need to handle a query to a mysql database when I know the returned data may possibly contain quotation marks?

    $query1 = "SELECT * FROM photo_log WHERE name = '$version'";
    $result1 = mysql_query($query1) or die("Could not perform query: ".mysql_error());
    $row1 = mysql_fetch_array($result1);
    

     

    The returned data is cut off from the point of a quotation mark. THE DATA IS: ITHF's "The Buth" at 2007 Convention.

    If I try add slashes after the query, I get: ITHF\'s \

    I've tried a bunch of different approaches, but frankly this kind of problem has always confused me. My global_pc and global_runtime are both turned off. Sorry to be a bother! Thanks!

  3. Can anyone tell me what is wrong with the following code:

    <?
    				$last_log = date("d F, Y; G:i:s");
    				$query1 = "UPDATE ithf_members SET last_log = {$last_log} WHERE id = {$id}";
    				mysql_query($query1) or die("Could not perform update: ".mysql_error());
    ?>
    

     

    I keep getting the following error:

    Could not perform update: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'July, 2008; 23:07:53 WHERE id = 1' at line 1

     

    I tried it with each $last_log enclosed in single quotes, in brackets and without anything. The new mysql server I'm now using doesn't seem to like my older coding. Thanks!

  4. I thought if I turned off the register_globals and used

     

    $this=$_POST['this'];

     

    that it would solve the problem of $this being empty. A quick look on my part led me to believe that this was how you capture variables passed from a form using POST, but I'm getting the following error:

     

    Fatal error: Cannot re-assign $this in /home/ositoweb/public_html/ithf_test/members/member_dsearch.php on line 10

     

    The page code is:

    <?
    $this=$_POST['this'];
    ?>
    <table width="800" border="0" cellpadding="0" cellspacing="0" style="font-family: helvetica; font-weight: bold;">
    <tr>
    	<td align="center" width="800" bgcolor="222255"><font color="white">Search Engine</font></td>
    </tr>
    </table>
    <br>
    <table border="0" cellpadding="0" cellspacing="0" width="800" style="font-family: helvetica; font-size: 10pt;">
    <tr>
    	<td><b>Search results for posted query.</b></td>
    </tr>
    <tr>
    	<td height="5"></td>
    </tr>
    </table>
    <br>
    <table width="800" border="0" cellpadding="0" cellspacing="0" style="font-size: 10pt;">
    <tr>
    	<td colspan="4"><b> Select to see full profile</b><br><br></td>
    	<td colspan="3" align="right"><a href="directory2.php?this=<?print $this?>&srch=<?print $srch?>" target="_blank"><b><u>Build Directory</u></b></a></td>
    </tr>
    <tr>
    	<td><a href="member_dsearch.php?org=lname&srch=<?print $srch?>&this=<?print $this?>" target="_self"> Name</a></td>
    	<td><a href="member_dsearch.php?org=email&srch=<?print $srch?>&this=<?print $this?>" target="_self"> Email</a></td>
    	<td><a href="member_dsearch.php?org=restel&srch=<?print $srch?>&this=<?print $this?>" target="_self">Phone</a></td>
    	<td><a href="member_dsearch.php?org=city&srch=<?print $srch?>&this=<?print $this?>" target="_self">City</a>, <a href="member_dsearch.php?org=state&srch=<?print $srch?>&this=<?print $this?>" target="_self">State</a></td>
    	<td><a href="member_dsearch.php?org=country&srch=<?print $srch?>&this=<?print $this?>" target="_self">Country</a></td>
    </tr>
    <tr>
    	<td colspan="8"><hr></td>
    </tr>
    <tr>
    			<?php
    
    				if ($org == ''){$org = "lname";}
    
    				$link = mysql_connect("ositowebsolutions.com","••••••••","••••••••") or die("Could not connect: ".mysql_error());
                      mysql_select_db("my_database") or die("Could not select database: ".mysql_error());
    
              $query = "SELECT id, lname, fname, mail1, mail2, city, state, country, email, telr, pdthru, active FROM ithf_members WHERE active > '1' AND ".$srch." LIKE '$this%' ORDER BY '$org'";
              if ($srch == "lang" or $srch == "telr" or $srch == "rinterests" or $srch == "ointerests" or $srch == "ainterests" or $srch == "local" or $srch == "email" or $srch == "keyp"){$query = "SELECT id, lname, fname, mail1, mail2, city, state, country, email, telr, pdthru, active FROM ithf_members WHERE active > '1' AND ".$srch." LIKE '%$this%' ORDER BY '$org'";}
              $result = mysql_query($query) or die("Could not perform query: ".mysql_error());
              $total = mysql_num_rows($result);
    
    				$counter = 0;
    
    				while ($row = mysql_fetch_array($result)) {
    					if ($row['active'] == "0"){$changeit = "active"; $act="No";}
    					if ($row['active'] == "2"){$changeit = "inactive"; $act="Yes";}
    					if ($row['active'] == "1"){$changeit = "active"; $act="Pending";}
    					if ($row['active'] == "3"){$changeit = "inactive"; $act="Yes";}
    
    					if ($row['pdthru'] == ''){$row['pdthru'] = "P";}
    				include 'valgen_v.php';
    				print "<td nowrap><a href=\"profile.php?validate=".$validate."\" target=\"_blank\"> ".$row['lname'].", ".$row['fname']."   </a></td><td nowrap><a href=\"mailto:".$row['email']."\">".$row['email']."</a></td><td nowrap>".$row['telr']."   </td><td nowrap>".$row['city'].",  ".$row['state']."   </td><td nowrap>".$row['country']."   </td></tr><tr>";
    
              $counter++;
    				}
    
    
    
    
    
    
    			?>
    </tr>
    </table>
    <br><?print "Matching entries: ".$counter;?>
    		<table border="0" cellpadding="0" cellspacing="0" width="800" style="font-size: 10pt; font-family: helvetica;">
    			<tr>
    				<td <?if ($counter < 10){print "height=\"350\"";} else {print "height=\"30\"";}?>></td>
    			</tr>
    			<tr>
    				<td height="30" align="center" valign="middle"><a href="http://www.ositowebsolutions.com" target="_blank"><img src="graphics/poweredby1.jpg" border="0"></a></td>
    			</tr>
    		</table>
    

     

  5. Looks like you're right. I just checked the phpinfo.php of both sites. The one I've been using has the register_globals turned ON, but the new one does not. THANKS! I looked up how to turn it on and it worked! ¡Muchas gracias!

  6. The following code works on a site I have with PHP version 4.3.9:

              $query = "SELECT id, lname, fname, mail1, mail2, city, state, country, email, telr, pdthru, active FROM ithf_members WHERE active > '1' AND ".$srch." LIKE '$this%' ORDER BY '$org'";
    

     

    BUT when I move it to a new site using PHP 5.2.5 the same code generates the error:

    Could not perform query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE '%' ORDER BY 'lname'' at line 1

     

     

    I'm moving to a new VPS account from a shared account. The new account has a much newer version of PHP. I guess I might end up having to debug have of my code from the last couple of years. Is this particular problem a result of difference in PHP versions? THANKS!

     

     

  7. The following code continues to ask for authentication even if I enter the right username (foo) and password (bar). What am I doing wrong?

    <?
    if ( $auth != 1 ) {		//if the user isn't authenticated
    
        header( "WWW-Authenticate: Basic realm=\"Authorization Required!\"" ); //this makes the browser generate a login box
        header( "HTTP/1.0 401 Unauthorized" ); //this tells the browser that further viewing is not permitted
        echo 'Authorization Required!'; //and this gets echoed if the user doesn't enter the correct username/password pair
        exit; //this makes the script exit, and the user session ends. No script for you!
    }
    
    
    $auth = 0; // Assume user is not authenticated
    if (($PHP_AUTH_USER == "foo" ) && ($PHP_AUTH_PW == "bar" )) $auth = 1; //If all is well, consider the user authenticated
    
    
    ?>
    <html>
    <head>
    
    	<meta http-equiv="content-type" content="text/html; charset=utf-8">
    	<title>test</title>
    
    </head>
    <body>
    <p>You must have entered the right password.</p>
    </body>
    </html>

     

     

  8.   Currently for file protection inside a folder I am attaching a hidden variable split up, scrambled and re-assembled and transmitted in links between pages on a website. Example: http:www.cnn.com?validate=4485jd02843yfdj384

    Only the re-encoding element of each page knows how to re-assemble the validate variable and tests parts of it for authenticity. Since parts of it rely on the accuracy of date() elements and the users member id (split up), it provides good security. BUT ...

     

      I need to take over an ISP's folder security. They use the .htaccess method to protect a folder. This would be great but I have NO experience with it, and they say I cannot link the .htaccess method to a mysql database. Does PHP offer a way to protect a folder so I don't have to protect each file in it individually? THIS IS A BIG QUESTION FOR ME! Thanks!

  9. GREAT! That seemed to work.

    $link = mysql_connect("•••••","•••••","•••••") or die("Could not connect: ".mysql_error());

                      mysql_select_db("ositoweb") or die("Could not select database: ".mysql_error());

     

              $query = "SELECT id, title, continent, orden, fname, lname, uname FROM vp_data ORDER BY continent, orden";

              $result = mysql_query($query) or die("Could not perform query: ".mysql_error());

     

              $count = 1;

            while ($row = mysql_fetch_array($result)) {

             

              $tmp_uname = ${'uname' . $count};

    $tmp_title = ${'name' . $count};

     

    $query1 = "UPDATE vp_data SET uname = '{$tmp_uname}' WHERE title={$tmp_title}";

    $result1 = mysql_query($query1);

    print $query1."<br>";

     

    $count++;

    }

     

    But the data isn't being stored in the database. The print $query1 line is properly displaying the data as it should:

    UPDATE vp_data SET uname = 'jaandrws' WHERE title=VP Africa

    UPDATE vp_data SET uname = 'jandrews' WHERE title=VP Central and Western Africa

    UPDATE vp_data SET uname = 'aaslestad' WHERE title=VP India

    UPDATE vp_data SET uname = 'George' WHERE title=VP Bangladesh and Pakistan

    UPDATE vp_data SET uname = '2828' WHERE title=VP Japan

    UPDATE vp_data SET uname = '2014' WHERE title=VP Asia Minor and Northern Africa

    UPDATE vp_data SET uname = '3324' WHERE title=VP Southeast Asia

    UPDATE vp_data SET uname = 'mzober' WHERE title=VP Pacific Coastal

    UPDATE vp_data SET uname = '3701' WHERE title=VP Northeast Australia

    UPDATE vp_data SET uname = 'rjhaddad' WHERE title=VP Southwest Australia

    UPDATE vp_data SET uname = 'giianor' WHERE title=VP New Zealand

    UPDATE vp_data SET uname = '1473' WHERE title=VP Great Britain and Ireland

    UPDATE vp_data SET uname = '2141' WHERE title=VP Northern Europe

    UPDATE vp_data SET uname = 'Labgal47' WHERE title=VP Scandinavia

    UPDATE vp_data SET uname = 'adel' WHERE title=VP Germany

    UPDATE vp_data SET uname = '2211' WHERE title=VP Southern Europe

    UPDATE vp_data SET uname = 'kevinof' WHERE title=VP France

    UPDATE vp_data SET uname = '3703' WHERE title=VP Central America and Mexico

    UPDATE vp_data SET uname = '1587' WHERE title=VP Caribbean and Atlantic Islands

    UPDATE vp_data SET uname = '841' WHERE title=VP South America

    UPDATE vp_data SET uname = '3541' WHERE title=VP California USA

    UPDATE vp_data SET uname = 'atalbot' WHERE title=VP Northwest USA

    UPDATE vp_data SET uname = '3398' WHERE title=VP Plains USA

    UPDATE vp_data SET uname = '3613' WHERE title=VP Southwest USA

    UPDATE vp_data SET uname = '3493' WHERE title=VP Northeast USA

    UPDATE vp_data SET uname = '3398' WHERE title=VP Midwest USA

    UPDATE vp_data SET uname = 'zaleski' WHERE title=VP Southeast USA

    UPDATE vp_data SET uname = '1783' WHERE title=VP Midsouth USA

    UPDATE vp_data SET uname = 'George' WHERE title=VP Alaska USA

    UPDATE vp_data SET uname = '2828' WHERE title=VP Canada

    UPDATE vp_data SET uname = '2014' WHERE title=VP Eastern Canada

     

    but it isn't storing the data. The database name is acurrate as are the titles. I'm puzzled.

     

     

     

  10. I have a list of variables with identical names except for the final character, BUT they are NOT in an array. I understand arrays, but I'm passing these variables from a form in a previous page. I'm trying to use the variable $count to change from $name1 to $name2 to $name3, etc... and $uname1 to $uname2 to $uname3, etc... for each loop. I have the most terrible feeling that this is an elementary problem with an elementary solution. Thanks for any help.

     

    $link = mysql_connect("••••••","••••••","••••••") or die("Could not connect: ".mysql_error());
            mysql_select_db("ositoweb") or die("Could not select database: ".mysql_error());
    
              $query = "SELECT id, title, continent, orden, fname, lname, uname FROM vp_data ORDER BY continent, orden";
              $result = mysql_query($query) or die("Could not perform query: ".mysql_error());
    
              $count = 1;
            while ($row = mysql_fetch_array($result)) {
              
    					$query1 = "Update vp_data SET uname = '$uname".$count."' WHERE title='$name".$count."'"; 
    					$result1 = mysql_query($query1);
    					print $query1."<br>";
    					$count++;
    
    				}
    

     

     

  11. Some of the people here have probably written forum boards (I know I have) but to just give it out would not help you at all. There would be so many changes necessary to make it fit your needs and interface with your database it isn't feasible. Our code is probably written such that you would have a very hard time understanding parts. I know I'm often a very messy coder. Downloading one designed for easy integration is your best bet.

  12. I don't store it at all. In the upload process I rename the file to fit an expected pattern based on the member's id. Then I can recall the photo anytime I desire automatically knowing the name of whichever photo I need for whichever member.

  13. These kind of errors are almost never on the line stated. The stated line is where the computer encounters something to make it realize there has already been an error. Look at the rest of your code. There's probably an open ( which hasn't been properly closed. Hope this helps.

     

     

  14. I've created small galleries for members of one of my clients. Users have the ability to upload the desired photos which are stored in a special folder and automatically renamed using the member's user id plus an additional letter progressing from A to Z. This allows uploaded photos to be stored where ever I want and are easily referenced using the member's id plus the identifying character. Since the naming begins with the letter A, I can do a file_exist check to determine exactly how many photos the member currently has posted. I use this information to help set up the display outlay. I hope this helps.

  15. That's not difficult. It'll just take time. Your database will need to contain all information regarding each business, including a category or categories. You will need a database with sufficient variables to cover all data regarding any business. You may want to assign more than one category variable to each business (i.e.: Walmart cannot be categorized as just a computer store, but they should certainly come up in the listing). Perhaps using a numerical code (1-computer, 2-food service, 3-clothing, 4-superstore (Walmart), 5-etc....) could be used to reference each category. I don't envy you this job. A category code 50 or 60 long might be necessary to cover all possible business types you'll be serving. Searches done by the user returns only those businesses with the respective category code. I hope this helps.

  16. I keep getting the following email notification: "This receipt verifies that the message has been displayed on the recipient's computer"

    I don't get this on some of my other scripts. What's up?

     

    Here's my code, THANKS:

    $fset = "-fjandrews@ithf.org";

          $count = 0;

        if ($sendto == 1){

        while ($row = mysql_fetch_array($result)) {

        if ($row['active'] > 1){

        $to = $row['email'];

        $subject = $sendsubject;

        $body = $text;

    $headers = "From: jandrews@ithf.org\r\n" .

        "X-Mailer: php\r\n".

      "Return-Path: jandrews@ithf.org\r\n"."Return-Receipt-To: jandrews@ithf.org\r\n";

    if (mail($to, $subject, $body, $headers, $fset)) {echo("<p>Sent to ".$row['fname']." ".$row['lname']." at ".$row['email']."</p>");}

        $count++;

        }

        }

        }

     

     

×
×
  • 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.