Jump to content
Larry Ullman's Book Forums

wframe

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About wframe

  • Rank
    Newbie
  1. Does anyone know how to encrypt a filename? For instance, I'd like to encrypt a filename so that is not visible in a browser. Something like: <? $test= md5('join'); echo " <a href='http://www.example.com/$test/members/register.php'>A...</a>"; ?> This code almost works but does not recognize the link once it's encoded. I get the following error once I click the link: Not Found The requested URL /731b886d80d2ea138da54d30f43b2005/members/register.php was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
  2. Hello guys, I'm using the following script to rename my directory to values stored in a table. The one table (table1) has the name of the current directory and we are trying to rename it to the new value in the second table (table2): Below is the script: (NOTE: the 'echo' statement was used just to let me know if the values were pulled. <?php # Named 'script3.php sets the new random number. In other words, it is responsible for naming a new filename/url.' require_once ('./stuff); // Connect to the database. $query="SELECT * FROM table2"; $result = mysql_query($query); // Run the query. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) $url2_id = $row[url2_id]; echo $url2_id; $query1="SELECT * FROM table1"; $result = mysql_query($query1); // Run the query. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) $url1_id = $row[url1_id]; echo $url1_id; rename("$url1_id","$url2_id"); ?> Below is the error we get: Warning: rename(832740485,857465976) [function.rename]: No such file or directory in /home/content/01/7477001/html/join/step6.php on line 15. Any advice???
  3. Hello, I tried the script and got the following errors: Warning: mysqli_query() expects parameter 1 to be mysqli, resource given in /home/content/01/7477001/html/join/rowtest2.php on line 6 Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/content/01/7477001/html/join/rowtest2.php on line 7 below is what I typed: --------- <?php $con = mysql_connect('stuff', 'stuff','stuff'); // connect to database $query="SELECT something FROM table"; $result=mysqli_query($con, $query); while (list($url1_id) = mysqli_fetch_array($result, MYSQLI_NUM)); ?>
  4. Hello guys, I was wondering if there is a way to read data from a mysql table and store it in a php variable. It seems simple but I can't quite get it together. Basically, I'd like to update a record in the database and retrieve it by passing it to a php variable. My table only has one column and row, so i don't need a "WHERE" function in my query (i.e. "SELECT * FROM table WHERE...) Something like below: $query="SELECT something FROM table"; ..... ..... somehow I need to set my variable to the data value in the table row...for example: $variable = mysql_query($query)... Any advice???
  5. Ok everyone, I have the MySQL row deletion script working. I am interested in deactivating the row but not totally deleting it, however. Could I set the password or active, etc to "NOT NULL" in order to save the information of the member? I tried the script below: --------------------------- <?php $con = mysql_connect('joinmembersclub.db.7477001.hostedresource.com', 'joinmembersclub','NI1957ja'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("joinmembersclub", $con); $sql= 'UPDATE joinmembersarea SET password = "NOT NULL", WHERE registration_date < DATE_SUB(NOW(), INTERVAL 5 MINUTE)'; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Added"; mysql_close($con); ?> --------------------------------- Does his script make any sense? I keep getting the following error: Error: 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 'WHERE registration_date < DATE_SUB(NOW(), INTERVAL 5 MINUTE)' at line 1
  6. Thanks for all the advice everyone. I will try and see about storing the records and setting the active to expire like you suggested.....
  7. Hello, we were able to get our php script to delete records in our database according to 'registration_date' parameters set in your lesson on "Using Conditionals" out of chapter 4. Below is the working script: ------------- <?php $con = mysql_connect(whateversometihing.com', 'dbname','pass'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dbname", $con); $sql="DELETE FROM table WHERE (registration_date < '2011-03-22 16:35:33') AND (registration_date > '2011-03-22 16:23:08')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Added"; mysql_close($con); ?> ---------------- Our question is how can we get the script to delete a record after it has been in our database for 24 hours? For instance, if a member has a trial period, we would like to cancel that member's account once that trail period has expired. Of course, we would want to have each member's trial period start 24 hours after they have registered without affecting other members whose trail period has not yet expired. Thanks in advance,
×
×
  • Create New...