PHP - Browser Session Help Needed
hey guys, I am trying to setup a session for a filter , I have a button that the user can click on or off, the button starts off but when the user clicks on it a new session starts and it stays on until the user clicks it again to turn it off or when the browser sessions ends... Any help is welcome, thanks guys, you are the best
Similar TutorialsThis topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=350599.0 Hello guys. I'm in need of help. I want to know who to make a full working session. When a player logs in, the session starts. There will be a new button "My Page", he can go there at any time. When he logs off, that button disappears ( Session over ). I'm so bad at explaining stuff. Hope y'all really understood me. This piece of code is used to log the user in: Code: [Select] <?php session_start(); include("config.php"); if(isset($_SESSION["Username"])) { $user = $_SESSION["Username"]; $pass = md5($_SESSION["Password"]); } else { $user = $_POST["User"]; $pass = md5($_POST["Password"]); $_SESSION['Username'] = $user; $_SESSION['Password'] = $pass; $escuser = mysql_real_escape_string($user); $escpass = mysql_real_escape_string($pass); } $result = mysql_query("SELECT * FROM playerinfo WHERE user = '$escuser'"); $num_rows = mysql_num_rows($result); if($num_rows == 0) { echo('That username does not exist...'); echo '<a href="http://yu-ki-ko.com/fsns/""> Go back!</a>'; unset($_SESSION['Username']); unset($_SESSION['Password']); die; } $row = mysql_fetch_row($result); if($row[1] !== $escpass) { echo('Wrong Password!...'); echo '<a href="http://yu-ki-ko.com/fsns/""> Go Back!</a>'; unset($_SESSION['Username']); unset($_SESSION['Password']); die; } ?> Not sure if its working properly or not. I'm stuck at that part. Hello, How do I get a user's session destroyed when he closes his browser? Thanks in advance Hey All, I have a sessions table that is used to see if a user is online. It only gets deleted when they click the Logout button. What I need to do is have it so it gets deleted even if they close the browser. Should I add a column in the sessions table with a time stamp and check on each page for every user to make sure its great than 30 min? Is there a better way to do this, without so many queries? Thanks Hi, i m playing arround with php sessions and just started afew testing on it (i never actually used them so i m discovering something new) and i would like to know how can you terminate an PHP Session without closing your browser. For testing i did this small code, just to see the behavior: Code: [Select] <?php session_start(); $id = session_id(); echo $id; session_unset(); session_destroy(); ?> The code above seens only to kill the $_SESSION's variables but what i would like is to Kill the PHPSESSID cookie/session cookie. is there anyway you can achive that? thanks in advance I am having trouble resolving an error. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/s519970/public_html/header.php:27) in /home/s519970/public_html/admin/login.php on line 2 What I can gather is I can't use "header (Location: 'admin.php')" after i've used session_start(). I have tried to replace the header (Location: 'admin.php') with this: echo "<script>document.location.href='admin.php'</script>"; echo "<script>'Content-type: application/octet-stream'</script>"; I've been trying to read up on solutions but haven't been able to get it sorted. If anyone can offer some advice that would be greatly appreciated as im new to php. Code: [Select] <?php session_start(); if(isset($_SESSION['user'])) echo "<script>document.location.href='admin.php'</script>"; echo "<script>'Content-type: application/octet-stream'</script>"; ?> <div id="loginform"> <form action="dologin.php" method="post"> <table> <tr> <td><span>Username:</span></td> <td><input type="text" name="username" /></td> </tr> <tr> <td><span>Password:</span></td> <td><input type="password" name="password" /></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="login" value="Login" /></td> </tr> </table> </form> </div> I have tried using require_once('yourpage.php'); before my <head></head> tags in the header document where I've specified the html information but this doesn't seem to work. I've been advised to use ob_start("ob_gzhandler"); but I am not sure how to implement this. Any advice is greatly appreciated! in this page http://maximaart.com/newscp/ i have this problem Code: [Select] Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/maximasy/public_html/newscp/index.php:1) in /home/maximasy/public_html/newscp/index.php on line 2 my source code is <?php session_start(); include_once("config.php"); include_once("functions.php"); $errorMessage = ''; if (isset($_POST['txtUserId']) && isset($_POST['txtPassword'])) { if ($_POST['txtUserId'] === "$user" && $_POST['txtPassword'] === "$pass") { // the user id and password match, $_SESSION['basic_is_logged_in'] = true; require("main.php"); exit;?> I am trying to create an index page which contains registration and login field the problem that i get is on successful login a warning is displayed session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\Eventz.com\index.php:116) in C:\xampp\htdocs\Eventz.com\index.php on line 235 This is the login part of my index.php this tag is inside an html table below the login form I also have a registration form and its php code above the login form Code: [Select] <?php if (isset($_REQUEST['pass'])) { $id=$_POST['id']; $pass=$_POST['pass']; $conn =mysql_connect("localhost","root",""); if (!$conn) { die('Could not connect: ' . mysql_error()); } /* checking connection....success! */ $e=mysql_select_db('test', $conn); if(!$e) { die(''.mysql_error()); } else { echo 'database selected successfully'; } if (isset($_REQUEST['id']) || (isset($_REQUEST['pass']))) { if($_REQUEST['id'] == "" || $_REQUEST['pass']=="") { echo "login fields cannot be empty"; } else { $sql=mysql_query("Select email,password from login where email='$id' AND password='$pass'"); $count=mysql_num_rows($sql); if($count==1) /* $count checks if username and password are in same row */ { session_start(); $_SESSION['id']=$id; echo "</br>Login Successful</br>"; } else { echo "</br>invalid</br>"; echo "please try to login again</br>"; } } } } ?> Any help or suggestion would be appreciated I'm making a simple login system with MySQL and PHP (very simple, I'm just starting with PHP). The MySQL portion is done, but I need to ensure only people who are logged in can see certain content. To check if people are logged in, my website checks that they have the $_SESSION['user'] variable set. If it is set, then it lets them continue through the website, if not, it tells them to login. Is that enough security, or can people simply inject a session cookie into their browser to spoof that they are logged in? My idea was to generate a session key cookie when they login (just a random string of letters and numbers) and store that in the database, then on every page, check to make sure their session key is the same thing that's in the database. Is this necessary? It seems expensive. hi everyone. i'm wondering what the best way is to create a session variable and pass it to an iframe. i need to do something along these lines, but it doesn't seem to pass the ID. Any hints on how i should accomplish this? Code: [Select] session_start(); $_SESSION['ID']=$_GET['ID']; // id from previous page $ID=session_id(); <iframe src="iframepage.php?ID=<?php echo $ID; ?>" style="width:680px; height:200px;" noresize="noresize" frameborder="0" border="0" scrolling="Yes" allowtransparency="true" /> </iframe> Evening! I've been iffing and ahhing over this and well im not too sure, hence the post. Code: [Select] // Redirects if there is no session id selected and echos the error on the previous page if(!isset($_GET['get']) || ($_GET['getget'])){ header("Location: #.php?error"); } So it should simply check if get is set if it isnt then see if getget is set? If not redirect and show the error. Now ive tried it and even when get/getget is set it still redirects, probably something silly. Care to share anyone? Harry. Just curious how other people feel about this. I am working on an application where a lot of info is pulled from MySQL and needed on multiple pages.
Would it make more sense to...
1. Pull all data ONCE and store it in SESSION variables to use on other pages
2. Pull the data from the database on each new page that needs it
I assume the preferred method is #1, but maybe there is some downside to using SESSION variables "too much"?
Side question that's kind of related: As far as URLs, is it preferable to have data stored in them (i.e. domain.com/somepage.php?somedata=something&otherdata=thisdata) or use SESSION variables to store that data so the URLs can stay general/clean (i.e. domain.com/somepage.php)?
Both are probably loaded questions but any possible insight would be appreciated.
Thanks!
Greg
Edited by galvin, 04 November 2014 - 10:30 AM. I'd like to use an application that's not browser based, on Internet Explorer. I've read somewhere that this is possible with a PHP script, but which one? If you can get me on the right track, I'd really appreciate it. Cheers. Helo dear people, I need some halp with mine script. This is part of it that works: function msan_getxmlinfo() { //global $local; //msan_download(); $path = dirname(__FILE__).'/xml/pricelist.xml'; $doc = new DOMDocument(); $doc->load($path); $msan = $doc->getElementsByTagName( "Table" ); $result = array(); foreach( $msan as $table ) { $codes = $table->getElementsByTagName( "ProductCode" ); $code = $codes->item(0)->nodeValue; $prices = $table->getElementsByTagName( "ProductPartnerPrice" ); $price = $prices->item(0)->nodeValue; $price = sprintf('%6f',$price); $availables = $table->getElementsByTagName( "ProductAvailability" ); $available = $availables->item(0)->nodeValue; $result[$code] = array('code'=>$code,'price'=>$price,'available'=>$available); } //echo "<pre>"; //print_r($result); //@unlink($path); return $result; } But now i need to insert one more element called "ProductDiscount" And aditional condition for proper price setting related so that when "ProductDiscount" is 0 (zero) then increase price by 3% and if theres any other value than 0 (zero) leave price as is. I was trying somthing like this but i cant get price increase: function msan_getxmlinfo() { $path = dirname(__FILE__).'/xml/pricelist.xml'; $doc = new DOMDocument(); $doc->load($path); $msan = $doc->getElementsByTagName( "Table" ); $result = array(); foreach( $msan as $table ) { $codes = $table->getElementsByTagName( "ProductCode" ); $code = $codes->item(0)->nodeValue; $prices = $table->getElementsByTagName( "ProductPartnerPrice" ); $price = $prices->item(0)->nodeValue; $discounts = $table->getElementsByTagName( "ProductDiscount"); if($discounts->item(0)=="0") { $price = $price*1.03; } else { $price = $prices->item(0)->nodeValue; } $price = sprintf('%6f',$price); $availables = $table->getElementsByTagName( "ProductAvailability" ); $available = $availables->item(0)->nodeValue; $result[$code] = array('code'=>$code,'price'=>$price,'available'=>$available,'discount'=>$discount); } return $result; } Help needed! i need help with mysql.php this keeps coming up when i try to log into my game Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in /home/tassie12/domains/kronicalwars.co.cc/public_html/mysql.php on line 2 Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/tassie12/domains/kronicalwars.co.cc/public_html/mysql.php on line 3 Warning: mysql_query() expects parameter 2 to be resource, boolean given in /home/tassie12/domains/kronicalwars.co.cc/public_html/authenticate.php on line 30 Access denied for user 'root'@'localhost' (using password: YES) can someone send me the code for mysql.php for mccodes and tell me where to put the database user and pass? Hello Forum, please can someone help me solve this error in the code below, thanks Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\XAMPP\xampp\htdocs\testingSite\addtobasket.php on line 10 Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\XAMPP\xampp\htdocs\testingSite\addtobasket.php on line 11 <?php session_start(); require("db.php"); require("function.php"); $validid = pf_validate_number($_GET['id'], "redirect", $config_basedir); $prodsql = "SELECT * FROM products WHERE id =" .$_GET['id'] . "'"; $prodres = mysql_query($prodsql); $numrows = mysql_num_rows($prodres); $prodrow = mysql_fetch_assoc($prodres); if($numrows == 0) { header("Location: ". $config_basedir); } else { if($_POST['submit']) { if($_SESSION['SESS_ORDERNUM']) { $itemsql = "INSERT INTO orderitems(order_id, product_id, quantity) VALUES (" . $_SESSION['SESS_ORDERNUM'] . "," . $_GET['id'] . "," . $_POST['amountBox'] .")"; mysql_query($itemsql); } else { if($_SESSION['SESSION_LOGGEDIN']) { $sql = "INSERT INTO orders(customer_id, registered, date) VALUES (" . $_SESSION['SESS_USERID'] . ", 1, NOW())"; mysql_query($sql); session_register("SESS_ORDERNUM"); $_SESSION['SESS_ORDERNUM'] = mysql_insert_id(); $itemsql = "INSERT INTO orderitems(order_id, product_id, quantity) VALUES (" . $_SESSION['SESS_ORDERNUM'] .",". $_GET['id'] . "," . $_POST['amountBox'] . ")"; mysql_query($itemsql); } else { $sql = "INSERT INTO orders(registered, date, session) VALUES(" ."o, NOW(),'" . session_id() . "')"; mysql_query($sql); session_registered("SESS_ORDERNUM"); $_SESSION['SESS_ORDERNUM'] = mysql_insert_id(); $itemsql = "INSERT INTO orderitems(order_id, product_id, quantity) VALUES(" . $_SESSION['SESS_ORDERNUM'] . "," .$_GET['id'] . "," . $_POST['amountBox'] . ")"; mysql_query($itemsql); } } $totalprice = $prodrow['price'] * $_POST['amountBox']; $updsql = "UPDATE orders SET total + ". $totalprice . " WHERE id = " . $_SESSION['SESS_ORDERNUM'] . ";"; mysql_query($updres); header("Location: " . $config_basedir . "showcart.php"); } else { require("header.php"); echo "<form action='addtobasket.php?id=" .$_GET['id'] . "' method='POST'>"; echo "<table cellpadding='10'>"; echo "<tr>"; if(empty($prodrow['image'])) { echo "<td><img src='./images.dummy.jpg' width='50' alt='" . $prodrow['name'] . "'></td>"; } else { echo "<td><img src=' ./images/" . $prodrow['image'] . "' width='50' alt='" . $prodrow['name'] . "'></td>"; } echo "<td>" . $prodrow['name'] ."</td>"; echo "<td>Select Quantity <select name='amountBox'>"; for($i=1;$i<=100;$i++) { echo "<option>" . $i . "</option>"; } echo "</select></td>"; echo "<td><strong>£" . sprintf('%.2f', $prodrow['price']) . "</strong></td>"; echo "<td><input type='submit' name='submit' value='Add to basket'></td>"; echo "</tr>"; echo "</table>"; echo "<form>"; } } require("footer.php"); ?> Hello,
I'm looking to bring another php developer on board to help with php projects. You should be skilled in laravel, php, and mysql. The job starts at $15/hr for each project. Please pm me if you are intereasted.
okay so i need this same logo to be on the other page..how do i do it.. this is code of the logo page.. Code: [Select] <? if(isset($_GET[ttid])) { $ttid = $_GET[ttid]; } $connection=mysql_connect("$server", "$username", "$password") or die("Could not establish connection"); mysql_select_db($database_name, $connection) or die ("Could not select database"); $query = "select master_event.* , (DATE_FORMAT(event_datefrom, '%d %M %Y')) as datefrom, (DATE_FORMAT(event_dateto, '%d %M %Y')) as dateto, ucase(event_name) as eventname from master_event where master_event.event_id = '$ttid '"; $result=mysql_query($query); while($row = mysql_fetch_array($result)){ $eventname = $row['eventname']; $eventdesc = $row['event_desc']; //$companydescription = $row['company_description']; $eventvenue = $row['event_venue']; $eventfee = $row['event_fee']; $datefrom = $row['datefrom']; $dateto = $row['dateto']; echo "<font color='#000000' face='arial' ><b> $eventname </b> </font> <br>"; echo "<font color='#000000' face='arial' ><i>Date</i> : $datefrom - $dateto <br>"; echo "<i>Venue</i> : $eventvenue <br>"; $querypstype = "SELECT DISTINCT master_pstype.pstype_id, pstype_desc FROM master_pstype INNER JOIN master_psevent ON master_psevent.pstype_id= master_pstype.pstype_id where master_psevent.event_id = '$ttid' ORDER BY pstype_order"; $resultpstype=mysql_query($querypstype); while($rowpstype = mysql_fetch_array($resultpstype)){ $pstypeid = $rowpstype['pstype_id']; $pstypedesc = $rowpstype['pstype_desc']; echo "<br><font color='#8B3A3A' size='1' face='georgia' ><b><i>$pstypedesc</i></b></font> <br>"; $queryps = "SELECT master_psevent.*, pstype_desc, company_name, company_link, company_description, logo_filename FROM master_psevent LEFT JOIN master_pstype ON master_psevent.pstype_id = master_pstype.pstype_id LEFT JOIN master_ps ON master_ps.ps_id = master_psevent.ps_id WHERE master_psevent.event_id = '$ttid' and master_pstype.pstype_id= '$pstypeid' ORDER BY pstype_desc,company_name "; echo $queryps; $resultps=mysql_query($queryps); while($rowps = mysql_fetch_array($resultps)){ $companyname = $rowps['company_name']; $companyid = $rowps['ps_id']; $companylinkori = $rowps['company_link']; $companydescription = $rowps['company_description']; $logopath = $rowps['logo_filename']; $describelink = "index.php?view=describe&ttid=$ttid&pstypeid=$pstypeid&psid=$companyid"; if(!empty($companydescription)){ echo "<a href=\"$describelink\" target=\"_blank\"><img src=".$logo_dir."/".$logopath." width=\"15%\" border=\"0\"></a>"; } else { echo "<a href=\"$describelink\" target=\"_blank\"><img src=".$logo_dir."/".$logopath." width=\"15%\" border=\"0\"></a>"; } } } } ?> i need to put the logo script on this page without removing other data..just wanna add the logo in it..where do i alter? Code: [Select] <? $monthname=$_POST['month']; if (isset($_GET['np'])){ $num_pages=$_GET['np']; } else { if($searchtype == 'yes') if ($monthname=="All" || $monthname=="") { $query = "SELECT count(*) FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 order by event_datefrom desc"; }else { $query = "SELECT count(*) FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 AND MONTHNAME(event_datefrom) = '$monthname' order by event_datefrom desc"; } else if ($monthname=="All" || $monthname=="") { $query = "Select count(*) FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 order by event_datefrom desc"; }else { $query = "Select count(*) FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 AND MONTHNAME(event_datefrom) = '$monthname' order by event_datefrom desc"; } $result=mysql_query($query); $row=mysql_fetch_array($result, MYSQL_NUM); $num_records=$row[0]; if ($num_records > $displayhome){ $num_pages=ceil($num_records/$displayhome); } else { $num_pages=1; } } if (isset($_GET['s'])){ $start=$_GET['s']; } else { $start=0; } if ($monthname=="All" || $monthname=="") { $query = "SELECT master_event.*,master_type.type_name, DATE_FORMAT(event_datefrom, '%d %b %y') as datefrom, DATE_FORMAT(event_dateto, '%d %b %y') as dateto, event_venue, (event_name) as eventname FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 order by event_datefrom asc LIMIT $start, $displayhome"; }else { $query = "SELECT master_event.*,master_type.type_name, DATE_FORMAT(event_datefrom, '%d %b %y') as datefrom, DATE_FORMAT(event_dateto, '%d %b %y') as dateto, event_venue, (event_name) as eventname FROM master_event LEFT JOIN master_type ON master_type.type_id = master_event.type_id where isupcomingevent = 1 AND MONTHNAME(event_datefrom) = '$monthname' order by event_datefrom asc LIMIT $start, $displayhome"; } $result = mysql_query($query); $bg='#e5e5e5'; while($row = mysql_fetch_array($result)){ $eventid = $row['event_id']; $eventname = str_replace("", "", $row['eventname']); $eventdatefrom = $row['datefrom']; $eventdateto = $row['dateto']; $event_venue = $row['event_venue']; $event_desc = $row['event_desc']; $speakerlist = $row['speakerlist']; $showline1 = ""; $showpros =""; $showline2 = ""; $showreg =""; $showline3 = ""; $showps =""; $showline4 = ""; $showtestimonial =""; $showline5 = ""; $showsp =""; $showline6 = ""; $showsl =""; if ($eventdatefrom ==$eventdateto) { $eventdate = $eventdatefrom; } else { $eventdate = $eventdatefrom . " - " . $eventdateto; } $querypros="select count(*) as proscount from master_prospectus where event_id ='$eventid' "; $resultpros = mysql_query($querypros); while($rowpros = mysql_fetch_array($resultpros)){ $proscount = $rowpros['proscount']; if ($proscount > 0) { $showline1 = "|"; $showpros ="Request Brochure"; } } $queryreg="select (CASE WHEN event_dateto >= NOW() THEN 'valid' ELSE 'invalid' END) AS validreg from master_event where event_id ='$eventid' "; $resultreg = mysql_query($queryreg); while($rowreg = mysql_fetch_array($resultreg)){ $validreg = $rowreg['validreg']; if ($validreg == "valid") { $showline2 = "|"; $showreg ="Online Registration"; } } $queryps="select count(*) as pscount from master_psevent where event_id ='$eventid' "; $resultps = mysql_query($queryps); while($rowps = mysql_fetch_array($resultps)){ $pscount = $rowps['pscount']; if ($pscount > 0) { $showline3 = "|"; $showps ="Partner & Sponsor"; } } $querytesm="select count(*) as tesmcount from master_testimonial where event_id ='$eventid' "; $resulttesm = mysql_query($querytesm); while($rowtesm = mysql_fetch_array($resulttesm)){ $tesmcount = $rowtesm['tesmcount']; if ($tesmcount > 0) { $showline4 = "|"; $showtestimonial ="Testimonial"; } } $querysp="select count(*) as spcount from master_speakernote where event_id ='$eventid' "; $resultsp = mysql_query($querysp); while($rowsp = mysql_fetch_array($resultsp)){ $spcount = $rowsp['spcount']; if ($spcount > 0) { $showline5 = "|"; $showsp ="Speaker Notes"; } } if ($speakerlist <> '') { $showline6 = "|"; $showsl ="Speaker List"; } echo "<tr><p style=\"font-size:small;\"> <td width='' ><img src='images/search.png' alt='tooltips' ></img> <a href='index.php?view=event&content=tips&ttid=$eventid' title ='$eventname' class=\"fancybox fancybox.iframe\" style=\"color:#104E8B;text-decoration: none; \" ><strong><font size='2' face='Segoe UI' >$eventname</font></strong></a><br> <font color='#000000' size='2' face='arial' >Date : $eventdate <br> Venue : $event_venue<br></font> <table style=\"text-align: left; width: 400px; height: 92px;\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\"> <tbody> <tr> <td></td> <td style=\"text-align: justify; color: #000000;\"> <font color='#000000' size='2' face='arial' > $event_desc</font></td> <td></td> </tr> </tbody> </table> <font color='#919191' size='1' face='arial' ><b> <a href='index.php?view=prospectus®rq=$eventid' title ='Request Brochure...' >$showpros</a> <b>$showline1</b> <a href='index.php?view=registration®rq=$eventid' title ='Online Registration...' > $showreg </a> <b>$showline2</b> <a href='index.php?view=event&content=psevent&ttid=$eventid' title ='Sponsor & Partner...' class='fancybox fancybox.iframe' >$showps</a> <b>$showline3</b> <a href='index.php?view=event&content=tesm&ttid=$eventid' title ='Testimonial...' class='fancybox fancybox.iframe' >$showtestimonial</a> <b>$showline4</b> <a href='index.php?view=spl&splid=$eventid' > $showsp</a><b>$showline5</b> <a href='index.php?view=event&content=speaker&ttid=$eventid' title ='$eventname' class='fancybox fancybox.iframe' > $showsl</a></font><br><br></td> </p></tr></b></font> "; } if ($eventid=="") { echo "No Records Found."; } echo "<td><p style=\"font-size:1;\">"; echo "<br>"; if ($num_pages > 1) { $current_page = ($start/$displayhome) + 1; if ($current_page != 1) { echo '<a href="index.php?view=home&content=list&s=' . ($start - $displayhome) . '&np=' . $num_pages . '#a" class="style1" style="color:#4F94CD;text-decoration: none;">Previous</a> ';} for ($i = 1; $i <= $num_pages; $i++) { if ($i != $current_page) { echo '<a href="index.php?view=home&content=list&s=' . (($displayhome * ($i - 1))) . '&np=' . $num_pages . '#a" class="style1" style="color:#4F94CD;text-decoration: none;">' . $i . '</a> '; } else { echo '<font face="arial" size="2">'; echo $i . '</font> ';} } if ($current_page != $num_pages) { echo '<a href="index.php?view=home&content=list&s=' . ($start + $displayhome) . '&np=' . $num_pages . '#a" class="style1" style="color:#4F94CD;text-decoration: none;">Next</a>';} } echo "</p></td>"; ?> </tr> </div> </form> Hi I am new here and I am not a PHP specialist. I run a website (www.theowl.com) and last week I upgraded from PHP 4.X to 5.x on the Namesco server. Everything worked except one thing.... I commissioned an EDI link to DHL, and this was setup using PHP FTP. This system works automatically plus I have a manual link to trigger orders. Since upgrading PHP the automatic process has stopped but the manual process still works fine. Would anybody be able to help. I have attached what I think is the correct file. I am happy to pay for peoples time. i have a piece of code which subtracts credits every time a button is clicked. the original code works fine. I have since added a bonus_credit column, where i want it to function like this. if buy_credit = 0 and bonus_credit>0 then subtract from the bonus credit, but still do everything else its supposed to do.. here is the original code i had $selRes=mysql_query("SELECT buy_credit from user where id='".$hb_id."' and buy_credit>0"); if(mysql_affected_rows()>0) { $b_comm=0; $bc_updqry=mysql_query("UPDATE user set buy_credit=buy_credit-1 where id='".$hb_id."'"); $updqry=mysql_query("UPDATE cars set b_fee_paid_status='1' where id='".$aid."'"); } here is my modified code, but it doesn't seem to subtract from buy_credit if buy_credit is >0.. it should only kick in the bonus_credit usage if buy_credit is 0 $selRes=mysql_query("SELECT buy_credit,bonus_credit from user where id='".$hb_id."' and buy_credit>0 OR bonus_credit>0"); if(mysql_affected_rows()>0) { $b_comm=0; if($selRes['buy_credit']!=0) { $bc_updqry=mysql_query("UPDATE user set buy_credit=buy_credit-1 where id='".$hb_id."'"); } else { $bc_updqry=mysql_query("UPDATE user set bonus_credit=bonus_credit-1 where id='".$hb_id."'"); } $updqry=mysql_query("UPDATE cars set b_fee_paid_status='1' where id='".$aid."'"); } your help is appreciated. |