Jump to content

Eiolon

Members
  • Posts

    358
  • Joined

  • Last visited

Everything posted by Eiolon

  1. NVM, I read that wrong. THanks!
  2. I am creating a MySQL database to store purchase order information. Is there a way to control the auto-increment ability so I can set a number to start with? For example, the first record would be 10000 instead of just 1. If I can't do that with the primary key then is there a way to do it in a different field? Thanks!
  3. It looks like we can't edit our own posts so I am reposting the code: <?php //Page Variables $online='<td style="background-color:#00FF00; padding:5px;">Online</td>'; $offline='<td style="background-color:#FF0000; padding:5px;">Offline</td>'; //Functions function servercheck($server,$port){ //Check that the port value is not empty if(empty($port)){ $port=80; } //Check that the server value is not empty if(empty($server)){ $server='localhost'; } //Connection $fp=@fsockopen($server, $port, $errno, $errstr, 1); //Check if connection is present if($fp){ //Return Alive return 1; } else{ //Return Dead return 0; } //Close Connection fclose($fp); } //Ports and Services to check $services=array( 'HTTP' => array('domainhere.com' => 80), 'SMTP' => array('domainhere.com' => 25), ); ?> <table> <?php //Check All Services foreach($services as $name => $server){ ?> <tr> <td><?php echo $name; ?></td> <?php foreach($server as $host => $port){ if(servercheck($host,$port)){ echo $online; }else{ echo $offline; } } ?> </tr> <?php } ?> </table>
  4. I am using a server status script and it works fine but when I put it on a server that is behind a proxy I can't get it to work. Can anyone help me configure it so it gets through the proxy? Thanks! <?php //Page Variables $online='<td style="background-color:#00FF00; padding:5px;">Online</td>'; $offline='<td style="background-color:#FF0000; padding:5px;">Offline</td>'; //Functions function servercheck($server,$port){ //Check that the port value is not empty if(empty($port)){ $port=80; } //Check that the server value is not empty if(empty($server)){ $server='localhost'; } //Connection global $proxy, $proxyport; $fp=@fsockopen($server, $port, $errno, $errstr, 1); //Check if connection is present if($fp){ //Return Alive return 1; } else{ //Return Dead return 0; } //Close Connection fclose($fp); } //Ports and Services to check $services=array( 'HTTP' => array('domainhere.com' => 80), 'SMTP' => array('domainhere.com' => 25), ); ?> <table> <?php //Check All Services foreach($services as $name => $server){ ?> <tr> <td><?php echo $name; ?></td> <?php foreach($server as $host => $port){ if(servercheck($host,$port)){ echo $online; }else{ echo $offline; } } ?> </tr> <?php } ?> </table>
  5. I am not sure if this is something that is handled on the database side or from PHP. Basically, if I order something online I am given an order ID that consists of many letters and/or numbers (i.e. #1000001) I am wanting to do something similar.  I have a field called order_id but that is the record ID which I don't think is a good thing to have exposed.  So I am wanting to know a good way to implement something like this.  Any suggestions?  Thanks!
  6. I have an event registration form that I created which only allows 20 signups.  I created a script to query the database and see how many entries there are.  If there are 20 entries, don't show the sign-up link.  I did the same with the actual registration page incase they want to try the link to the form directly. Now this works fine and all but the browser cache is getting in the way.  After I register someone and am taken back to the list of participants it won't show the one I just added until I refresh.  This means if I have added the 20th person I can still add a 21st which would mean overbooking the event. So is there a way to force the browser (IE6) to refresh or to stop the caching.  I have tried the META tags for no-cache and pragma.  I can't use the META tag for refresh because it will just refresh every second and not just do it once.  Thanks for your help.
  7. I have a page that shows a list of items added to the database.  There is a link you click on that opens a popup window to insert a new item.  I am using javascript to make that window open.  When someone inserts the record into the database, I want it to close the popup window and refresh the screen that shows the items in the database.  Thanks for your help!
  8. I have a table called LOCATIONS and a table called HARDWARE. Basically, I want users to be able to delete locations from the locations table but ONLY if the location isn't being used in the hardware table.  Any idea on how to pull this off?  Thanks!
  9. First of all, don't try and master it all in 24 hours.  Second of all, grab a book and just work on some of the examples.  I know you may have this grand vision for the next MySpace or something but unfortunately you have to start with something smaller. Here is the book that I have been using: PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide Larry Ullman http://www.zend.com/images/publishers/big_19.gif It's a little outdated, focusing on PHP4 but that in combination with great advice from this forum and other tutorials, I have slowly begun to understand PHP and the terminology/commands. In a week I have created my own login system, learned own to secure it AND [b]most importantly[/b] I understand what every piece of code means that I have used so far.  That doesn't mean I can code something from scratch without a reference but when I look at code I can finally say, "Yeah, I know what that means and how/why it's used."
  10. Okay, that seems to make it work.  Thanks for the help. Yes, I know my script is not secure - as I said, this is my first script so I realize I have lots of work to do on it to make it secure.
  11. Basically, my script is letting anything authenticate, regardless if it is in the database or not.  I am not trying to do anything special besides using SHA1 for hashing. This is my first PHP script so pay no mind to my excessive commenting. [code]<?php # login.php // Connect to the MySQL server and database. require_once ('mysql_connect.php'); // Start the script when submitted. if (isset($_POST['submit'])) { // Verify that all required fields are completed. if (!$_POST['username'] | !$_POST['password']) { die ('You must enter a username and password.'); } // Query the database for user information. $auth = "SELECT username, password FROM users WHERE username=('".$_POST['username']."') AND password=sha1('".$_POST['password']."')"; $result = mysql_query ($auth) OR die ('Cannot execute the query.'); // If authentication is successful... if ($auth) { echo 'You are now logged in.'; exit(); } // Close the connection to the server and database. mysql_close(); // End of script. } ?>[/code]
  12. Hello, I have some code to confirm that passwords match before inserting.  I tell the script to die if they don't match.  The problem is it removes the form, making the user press the back button to return to it.  Is there a way to make it so the form stays when the error appears? Here is my code, thanks! [code]// Confirm that the passwords match. if ($_POST['password'] != $_POST['password2']) { die ('Your passwords do not match.'); }[/code]
  13. Eiolon

    MD5 to SHA-1

    Does anyone have any info (tutorials or otherwise) on how I can convert passwords in my database from MD5 to SHA-1? Thanks!
  14. Thank you all.  This appears to be what I am looking for.
  15. I have people entering data in a text field and they use line breaks for paragraphs.  Unfortunately, when I call the data up from the database it is all run together.  Is there a way to make it so the line breaks stay?
  16. [quote author=raza.shahzad link=topic=103945.msg414345#msg414345 date=1155348168] friend, i hope your problem has been solved. yet if you encounter any problem you can reply to this msg of mine. thankyou. one more thing. your subject said that you were looking for a maths problem and being a mathematics student i took it wrong and thought if you were looking for something related to algebra, geometry or calculus etc. anyways, keep working good on your project. [/quote] I haven't been able to try it out because everything is at work.  I didn't expect to get answers so soon so I thought I'd post it tonight and come back to it tomorrow.
  17. I am looking for any resources that would help me with mathematics in PHP.  Be it a good book, website or anything. Here is what I have to accomplish: Purchase Database Index page displays: Account Code, Account Name, Budget and Amount Remaining Every time somone adds a purchase it will subtract from the budget in that account and display the remaining amount of monies in that account. Many thanks for your assistance!
  18. Hello, I am creating a help desk and would like it to stamp the date/time when a request is submitted and also a date/time when the request is completed.  How would I go about having two timestamps?  Here is what I have for my structure: [code]create table requests ( id int not null primary key auto_increment, employee varchar(50) not null, category varchar(50) not null, priority varchar(10) not null, description text not null, status varchar(10) not null default 'Open', submitted timestamp not null default current_timestamp, completed timestamp not null default current_timestamp, technician varchar(50) not null );[/code] I get this error: [quote]ERROR 1293 (HY000): Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause[/quote] How do I accomplish two timestamps?  Thanks!
  19. Hello, I am working on an intranet project (helpdesk) using PHP/MySQL.  The problem I have is the mail server is on a completely different server in the network.  It is a Microsoft Exchange server and we are using IIS6 for our web server.  Does anyone have instructions on how to configure PHP to work with a mail server that is not on the same box? Thanks!
  20. I found the problem.  I can only change the default page for a specific website and not all of them at once like I was trying to do.
  21. Hello, I am working on an intranet site and instead of making a membership system and having all employees remember two usernames/passwords, I am making IIS use the active directory database to protect files and directories that are restricted.  So here is my question: Is there a way to treat active directory usernames as you would with sessions or cookies?  I would like to restrict pages to certain people but I still want to see who makes changes. Thanks for your help!
  22. I used the following guilde to install PHP 4.4.2 on IIS6.  http://www.simongibson.com/intranet/php2003/ Everything works but I have a problem.  The only file is index.php where I have the php info.  I can view the file if I go to http://localhost/index.php However, if I go to http://localhost it gives me a directory listing.  In IIS I have index.php as the default page (and deleted all others in the list so its the only one).  I also made sure index.php is the only file in my wwwroot folder. If I create a file called index.htm it has no problem showing up immediately, even if index.php is the default page. Any suggestions? Thanks!
  23. I know how to protect content based on access level but I was wondering if there is a tutorial for usergroups.  Access levels are just too limiting for what I need to do.  I need users to belong to multiple groups but be excluded from other ones.  Thanks for any help!
  24. Thanks, this seems to have done the job.
  25. I've finished my first PHP script but now I would like to make it so its easy for people to install.  Whenever I install forum software they always have a PHP page where you enter your connection info and it will automatically create the table structures in the database for you.  Are there any tutorials on how to do this?  Thanks for your help.
×
×
  • 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.