imdead
Members-
Posts
116 -
Joined
-
Last visited
Everything posted by imdead
-
Hey Guys, 1 Last Problem I made this code (Practicly a re-write since i last showed you guys it) Anyway this is the Takelogin <?php ob_start(); session_start(); $conn = mysql_connect("localhost","root",""); $db = mysql_select_db("pete"); if(isset($_POST['submit'])) { $username = htmlspecialchars($_POST['username'], ENT_QUOTES); $password = htmlspecialchars($_POST['password'], ENT_QUOTES); $password = ($password); $username = addslashes($username); $password = addslashes($password); $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'"); if(mysql_num_rows($sql)>0) { session_register("username"); session_register("password"); $sessionid = session_name(); mysql_query("UPDATE users SET sessionid='$sessionid' WHERE username='$username' and password='$password' LIMIT 1"); ob_start(); exit(); ob_flush(); } if (mysql_num_rows($sql)>1){ $row = mysql_fetch_assoc($sql); $userlevel = $row['userlevel']; } else { header("Location:login.php"); } } ob_flush(); ?> The problem is.. The code logs me in and everything although i get this error Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 Also i dont think it is getting the row $userlevel becuase in the script where i want that displayed i have this if ($userlevel == '2'){ echo"<a style='color:#666; font-weight: normal;' href='/admin.php'>Admin Control Panel</a>"; } Although Nothing appears
-
Thanks Fixed
-
Hey Guys Sorry About this, <?php if(isset($_POST['submit'])){ include'connect.php'; $sql = mysql_query("SELECT * FROM users WHERE username = " . ($_POST['username']) . " AND password = ".addslashes($_POST['password'])); $row = mysql_fetch_array($sql); if($row){ session_start(); $_SESSION['fname'] = $row['first']; $_SESSION['username'] = $row['username']; $_SESSION['lname'] = $row['second']; $_SESSION['logged'] = 1; header("Location: index.php"); }else{ header("Location: login.php"); } } ?> Whats wrong with that? The Error i get is Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\tlogin.php on line 8 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\tlogin.php: in C:\xampp\htdocs\tlogin.php on line 18 The second error will go the moment the first error is gone so theres no need for that to be fixed.
-
Fixed it Thanks alot guys!
-
ah ok i changed it to the code above and now the error is Unknown column '0' in 'field list'
-
Ok thanks for such quick help guys i've changed the code to $result = mysql_query("INSERT INTO users (id, first, username, password, second, address, email, job, salary, like, salarye, transport, contact) VALUES (`$id`, `$first`, `$username`, `$password`, `$second`, `$address`, `$email`, `$job`, `$salary`, `$like`, `$salarye`, `$transport`, `$contact`)") or die(mysql_error()); if (mysql_affected_rows() == 1) print "You have successfully registered and may now login"; else print mysql_error(); And now im recieving this 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 'like, salarye, transport, contact) VALUES (`0`, `Kevin`, `kevski`, `PASSsWORD`, ' at line 1
-
Ok thanks i now get the 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 'like, salarye, transport, contact) VALUES (0, Kevin, kevski, PASSSSWORDD, LASTNAME,' at line 1
-
Hey Guys, Im Working on a script for a client although i'm stuck i cant find the error i even tried echo'ing out the INSERT values to see if they were the problem but there not Please Help Thanks Signup <form action="tregister.php" method="post"> <p>First Name: <input type="text" name="first" size="10"></p> <p>Username: <input type="text" name="username" size="10"></p> <p>Password: <input type="password" name="password" size="10"></p> <p>Second Name: <input type="text" name="second" size="10"></p> <p>Address: <input type="text" name="address" size="20"></p> <p>Email: <input type="text" name="email" size="20"></p> <p>What Is Your Current Job? <input type="text" name="job" size="15"></p> <p>Current Salary? <input type="text" name="salary" size="10"></p> <p>What Would You Like To Do? <input type="text" name="like" size="10"></p> <p>Salary Expectations? <input type="text" name="salarye" size="10"></p> <p>Do You Have Your Own Transport? <input type="text" name="transport" size="10"></p> <p>Contact Number: <input type="text" name="contact" size="15"></p> <p><input type="submit" value="Submit" name="submit"></p> </form> Takesignup $id = mysql_insert_id(); $first = $_POST["first"]; $username = $_POST["username"]; $password = $_POST["password"]; $second = $_POST["second"]; $address = $_POST["address"]; $email = $_POST["email"]; $job = $_POST["job"]; $salary = $_POST["salary"]; $like = $_POST["like"]; $salarye = $_POST["salarye"]; $transport = $_POST["transport"]; $contact = $_POST["contact"]; //insert the values $result = @mysql_query("INSERT INTO users (id, first, username, password, second, address, email, job, salary, like, salarye, transport, contact) VALUES ($id, $first, $username, $password, $second, $address, $email, $job, $salary, $like, $salarye, $transport, $contact)"); if (mysql_affected_rows() == 1) print "You have successfully registered and may now login"; else print mysql_error();
-
Need help installing.......
imdead replied to nut legend's topic in PHP Installation and Configuration
Took This from the readme 4) - Uploading the Free PHP Shopping Cart to your server Once you have downloaded and unzipped your copy of the Free PHP Shopping Cart, you need to upload it to your server. Create a directory on your server for the Free PHP Shopping Cart pages to go (usually in the root directory of your site domain) For example, you could create a subdirectory called FPHPSC on your root directory, which in the URL box of a browser would result in: http://www.youdomain.com/FPHPSC/ Keep track of what directory you upload to ('/FPHPSC/' in the above example), you will need that when configuring the package on your server. 5) - Configuring The Free PHP Shopping Cart to run on your server Once you have uploaded all the Free PHP Shopping Cart files to a directory on your web server, you are ready to configure the package to run on your server. To do so, you will need to edit the Local_Settings.php file in the cart script's root directory (if you uploaded your cart files to http://www.youdomain.com/FPHPSC/, the script root directory would be '/FPHPSC/'). In the Local_Settings.php file, you will see there are several settings that can be set, grouped into a couple of sections. a) - General Settings - The general settings relate to the general setup of your cart script: $Site_Domain - this should be the full domain of the root of your site Example: 'http://www.freebert.com/' Tip: be sure to end your domain with a '/' $Site_Title - self explanatory $Site_Script_Root_Directory - the name of the directory the script files reside in. Example: if you uploaded the script files to http://www.youdomain.com/FPHPSC/, set Site_Script_Root_Directory = 'FPHPSC/' Tip: be sure to end your Site_Script_Root_Directory with a '/' $CSS_Filename - the name of the CSS file you want the script to use. Enter the title of the file only, and be sure that that file exists in the /css/ folder in your script directory. The package includes 2 default CSS files in the css directory, called WhiteBack.css and BlackBack.css. Try switching between these two to change the basic color scheme of your site. $Session_Prefix - a short prefix to add to session variable calls - if you don't understand this leave it as FPHPSC_ $Currency_Symbol - the symbol you want displayed to represent the cart currency (such as '$', '£', etc) $Currency_Code - they code you want displayed to represent teh cart currency (such as 'USD', 'GBP', etc) b) - Payment Options - The Payment Options section allows you to choose which of the installed payment mods are active on your site. Enter a 1 beside the option to wish to activate, enter a 0 (zero) beside the option(s) you wish to de-activate. By default, all payment options are activated. c) - Payment Mods - The Payment Mod Settings section allows you to configure each of the active payment methods with your personal info. i) - For the PayPal option, you only need to enter your paypal account email address (so paypal knows who to send the money to). ii) - For the Money Order option, you need to enter info on who the money order should be made out to (should match the name on the bank account you intend to cash the money orders at), as well as the address you want the Money Order payments to be mailed to. iii) - For the Phone order option, you need to enter the phone number you want your customers to call in their sales to, as well as an additional field for giving extra instructions to your customers (such as calling hours, etc) 6) - Customizing The Free PHP Shopping Cart to better match your site's look & style. There are a number of ways you can customize the look of your Free PHP Shopping Cart, to better blend the cart pages in the basic look & style of the rest of your site. Firstly, you can choose an alternate .CSS file (in the Local_Settings.php file) to change between looks of your site. Alternatively you can edit the active .CSS file to change specific elements, color schemes and other visual properties. The cart package contains two files, Overall_Header.php and Overall_Footer.php (located in the script's /inc/skin/ directory) that are included in every visible cart page. They are a good place to add site logos and links to help the cart fit seamlessly into your site's main design. Finally, if you are PHP savvy, you can edit the actual codes and functions in the cart pages, taking complete control of the look, feel and function of your cart. Be careful if/when editing PHP pages - a single misplaced quote or semi-colon could stop the functioning of your entire cart! 7) - Adding items to the shopping cart (Add To Cart Buttons) You can place HTML code on any type of webpage (HTML, HTM, ASP, PHP, etc) to add items to the shopping cart for your customers to buy. You can add single items, one at a time, or multiple/batch items to your cart. a) Adding Single Items - To add a single item to your cart; use a form like the one below: <form method="post" action="http://www.mydomain.com/FPHPSC/ShoppingCart.php"> <input name="Title" type="hidden" value="$5 Donation With Shipping" /> <input name="SerialNum" type="hidden" value="5DollarDonationWS" /> <input name="Price" type="hidden" value="5.00" /> <input name="Shipping1" type="hidden" value="1.00" /> <input name="Shipping2" type="hidden" value="0.50" /> <input name="cmd" type="hidden" id="cmd" value="1" /> <input type="submit" name="Submit" value="Add To Cart" /> </form> Tips: -all fields are mandatory, be sure to enter something into all the value fields -make sure the action = the full URL to the ShippingCart.php file located on your server -make sure the method = "post", NOT "get". -make sure cmd = 1 for adding single item only -make sure each different item has a different / unique SerialNum -Shipping 1 refers to the shipping for quantity = 1 of that item -Shipping 2 refers to additional shipping amount for each quantity over 1 b) Adding Multiple Items - To add multiple items to your cart with the click of 1 button, use a form like the one below: <form method="post" action="http://www.mydomain.com/FPHPSC/ShoppingCart.php"> <input name="Title0" type="hidden" value="$1 Donation With Shipping" /> <input name="SerialNum0" type="hidden" value="1DollarDonationWS" /> <input name="Price0" type="hidden" value="1.00" /> <input name="Shipping10" type="hidden" value="1.00" /> <input name="Shipping20" type="hidden" value="0.50" /> <input name="checkbox0" type="hidden" value="1" /> <input name="Title1" type="hidden" value="$2 Donation With Shipping" /> <input name="SerialNum1" type="hidden" value="2DollarDonationWS" /> <input name="Price1" type="hidden" value="2.00" /> <input name="Shipping11" type="hidden" value="1.00" /> <input name="Shipping21" type="hidden" value="0.50" /> <input name="checkbox1" type="hidden" value="1" /> <input name="Title2" type="hidden" value="$3 Donation With NO Shipping" /> <input name="SerialNum2" type="hidden" value="3DollarDonationWNS" /> <input name="Price2" type="hidden" value="3.00" /> <input name="Shipping12" type="hidden" value="0.00" /> <input name="Shipping22" type="hidden" value="0.00" /> <input name="checkbox2" type="hidden" value="1" /> <input name="Batch_Count" type="hidden" value="3" /> <input name="cmd" type="hidden" id="cmd" value="5" /> <input type="submit" name="Submit" value="Add To Cart" /> </form> -
Please check for vulnerabilities/mistakes!
imdead replied to imperialized's topic in Beta Test Your Stuff!
http://www.imperialized.net/comments.php?id=' -
Chmod > http://www.imperialized.net/shoutbox/