NathanLedet
-
Posts
102 -
Joined
-
Last visited
Never
Posts posted by NathanLedet
-
-
I don't think you would need $_SERVER['HTTP_HOST'] at all if you're just trying to go to /ahk_php/index.php
header('location: /ahk_php/index.php');
-
OK so Just for my own personal knowledge...I haven't dealt with probability in years, so I have forgotten...
If I use the code above, what is the probability that I will generate the same code twice?
the code randomly picks from 36 characters, and generates 16 random characters.
Each space out of 16 has a 1/36 chance of getting character "x" ("x" being a random character, not the letter x)
I'm thinking that the probability of generating the same 16 character code would have to be up there in the multi-millions somewhere..but i forget how to calculate that
-
No really, I appreciate the tip. I am looking to do it as a random thing and not sequential, because you're right...someone would change numbers just to snoop around.
the longest I will probably go will be 16 characters. The link I posted above will generate as many characters as I specify.
Thanks again
-
Awesome those work!!! THANKS
I even managed to re-work it so that it uses Session data
$query = "SELECT * FROM users JOIN addressbook ON users.userID = addressbook.userID WHERE users.username = '" . $_SESSION['MM_Username'] . "'";
I appreciate your help!
-
Yeah I think that's the right direction to take! It makes sense, I'm just not sure now what I should do to generate a random number...or the significance behind a 10, 15, 20, or more random numbers. Suggestions for that? Thanks!!
I found this...it may do the trick... ?
-
I'm trying to create a personalized site, similar to Swapdrive, in that we are able to upload and e-mail file links to our clients.
I have the script set up and working so that we select x amount of files (file names), then the next screen displays a list of e-mail addresses in our address book, and then an e-mail is dispatched to the e-mail addresses with download links.
If you've ever received an e-mail from someone at Swapdrive, they e-mail you a link which takes you to the swapdrive site where you have to click to download each file... What's unique about this is it displays ONLY the files that were selected by the sender. When you recieve the e-mail, you get a link with a long crazy string of text at the end: c+dQUV3dGGQ0F0ciLI6oZDKNoP+BzkbDO50jZDbDwv96iExRow==url
I want to do something similar in that PHP generates a string of random text that appends to a url, and when that entire URL is put into a url bar, it pulls up the selected files to download.
thanks!
-
This code works, but it displays two of each database entry....I'm new with Joins, so i must be doing something wrong....clearly
<table width="500px" border="1px"> <tr> <td width="25%">Name</td> <td width="50%">E-mail Address</td> <td width="15%">Options</td> </tr> </table> <div style="width:500px; overflow:auto;"> <table width="500px" border="0" id="addressbook"> <?php $query = "SELECT * FROM users, addressbook WHERE addressbook.userID = 2"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<tr>\n"; echo "<td width=\"25%\" class=\"tbldata\">" . $row['name'] . "</td>\n"; echo "<td width=\"60%\" class=\"tbldata\">" . $row['email'] . "</td>\n"; echo "<td width=\"15%\" class=\"tbldata\">edit/delete</td>\n"; echo "</tr>\n"; } ?> </table> </div>
Oh and a little about my table structure:
table: users
userID
username
password
email
table: addressbook
userID
emailID
name
email
The table 'users' is a list of people allowed to access the site. the table 'addressbook' is each 'users' personal e-mail addressbook. I am trying to join them together through the userID. the userID inside 'users' is unique and the userID inside 'addressbook' belongs to whichever 'user' added them to the database.
-
I am getting the results displayed twice. so if I have 1 entry in the database, it shows up twice, and it's not supposed to. It's only supposed to show up once. Is it possible that it has something to do with the session that is stored upon login?
-
this just crept up on me and I'm completely puzzled as to why it's happening.
Login page logs you in, and then on to the Admin features:
<?php session_start(); include('includes/mysql_connect.php'); $query2 = 'SELECT userID FROM users WHERE username = "' . $_SESSION['MM_Username'] . '"'; $result2 = mysql_query($query2); while($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)){ $userID = $row2['userID']; } $query = "SELECT users.userID, users.username, addressbook.userID, addressbook.name, addressbook.email, addressbook.emailID"; $query .= " FROM users, addressbook"; $query .= " WHERE addressbook.userID = \"" . $userID . "\""; $query .= " ORDER BY addressbook.name ASC"; $result = mysql_query($query); echo "<table width=\"500px\" border=\"0\">\r <tr>\r <td width=\"25%\">Name</td>\r <td width=\"60%\">E-mail Address</td>\r <td width=\"15%\">Options</td>\r </tr>\r </table>"; echo "<div style=\"width:500px; height:225px; overflow:auto;\">"; echo "<table width=\"500px\" border=\"0\" id=\"addressbook\">\r"; while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo "<tr> <td width=\"25%\" class=\"tbldata\">{$row['name']}</td> <td width=\"60%\" class=\"tbldata\">{$row['email']}</td> <td width=\"15%\" class=\"tbldata\"><a href=\"/addressbook_update.php?emailID={$row['emailID']}\">Edit</a> / <a href=\"/addressbook_delete.php?emailID={$row['emailID']}\">Delete</a></td> </tr>\r"; } echo "</table>\r</div>"; ?>
It works (it's also a sloppy way of doing it, I realize this, but I'm a newbie just trying to get it to work first ), but the results of the query displays each item twice.
-
Thanks! I left out addressbook.name
I guess I assumed that selecting the ID would select the name....but that didn't work out. It makes sense now and it works!
*solved*
-
I am making progress, but i'm not doing something right. Inside addressbook, I've given two entries the userID of "4", which relates to the user inside "users" with the userID of 4.
code:
$query = "SELECT users.userID, addressbook.userID FROM users, addressbook WHERE addressbook.userID = 4 ORDER BY name ASC"; $result = mysql_query($query); while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ echo $row['name']; }
This returns two blank spaces where the name is supposed to appear, but they don't show up.
-
I guess I need to learn how to use Joins for this little project I'm working on. An Addressbook with e-mail addresses affiliated with each user.
Table Setup:
Table 1 - addressbook
userID, emailID, name, email
Table 2 - users
userID, username, password, email
When the user logs into the admin area and they go to their addressbook, it pulls up a list of names and e-mail addresses affiliated with their user ID. They would need to be joined with the userID. in the table 'users', that number is the primary key which auto-increments.
-
-
What's the difference in for, foreach, while?
-
I'm wondering if this is possible...
$to = //Script here to retrieve multiple e-mails from database $subject = "You have mail"; $message = "This is the message"; $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset='iso-8859-1'\n"; mail($to,$subject,$message,$headers);
and it needs to send the same e-mail to multiple people. Thanks for any advice
-
I think it depends on what's on the includes. If there's more PHP on the includes, then no it won't display...if it's just something like HTML, then yeah it works.
-
Hello.
<?php // Assuming today is: March 10th, 2001, 5:16:18 pm $today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm $today = date("m.d.y"); // 03.10.01 $today = date("j, n, Y"); // 10, 3, 2001 $today = date("Ymd"); // 20010310 $today = date('h-i-s, j-m-y, it is w Day z '); // 05-16-17, 10-03-01, 1631 1618 6 Fripm01 $today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // It is the 10th day. $today = date("D M j G:i:s T Y"); // Sat Mar 10 15:16:08 MST 2001 $today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:17 m is month $today = date("H:i:s"); // 17:16:17 ?>
-
-
I replied before making the changes.... I just made them and it works! Thanks for your help!!
-
Actually, someone posted the same question...almost exactly what I was curious about:
http://www.phpfreaks.com/forums/index.php/topic,204517.0.html
Here's another way to explain it... Myspace.com, for example. to get to someones account, you type in myspace.com/username
Now, does myspace.com have MILLIONS of sub-directories for usernames? I don't think so...it doesn't make sense to me that they would.
-
when the e-mails are coming in, you can see the <p></p> tags..none of the HTML is rendered. I actually want the text to render out in blue.
I'm testing on a few e-mails...my yahoo account is one, the other one is my mac Mail app.
-
I have a script that
$to = you@you.com; $subject = "subject goes here"; $body = "<p style=color: #0000ff;>text goes here</p>"; $headers = "From: Nate L <me@mysite.com>\r\n" . "X-Mailer: php"; $headers .= "Content-type: text/html\r\n"; if (mail($to, $subject, $body, $headers)) { echo("<p>Message sent</p>"); } else { echo("<p>Message delivery failed...</p>"); }
When the e-mails come in, the HTML is displayed, but not rendered out. I would appreciate some help with this
-
yes, I think so.
sorry if it's confusing.
-
so i am wondering if this is possible, and how.
Right now, we have client site set up for each of our clients that we work with.
For example:
oursite.com/client1
oursite.com/client2
Within those client folders, we have other sub folders, like so:
oursite.com/client1/project1
oursite.com/client1/project2
oursite.com/client2/project1
the script I'm using now will automatically create a physical directory on the site...
Is it possible to create a script which recognizes those directories and sub directories, but those directories don't exist on the site? it's all handled by code, but the URL bar appears to be in those sub directories.
hope this makes sense..Thanks!
[SOLVED] header('location: ');
in PHP Coding Help
Posted
Actually, ahk_php/index.php would, but since there is a slash in front of it (/ahk_php/index.php) it would be localhost/ahk_php/index.php
But, thorpe was right. Glad it's working