Jump to content
php.lv forumi

Recommended Posts

Posted

Sheit ir skripts no speelju servera webshopa, apskatiit var sheit es uzliku sms sisteemu, un man ir jaaieliek taada lieta ka ja ievadiitas kods ir pareiz tad cilveekam pieskaita 100 pointus.

 

Reku ir dots kods no faila kuru izmantojot webaa paraadas nika lodzinjsh un cik punktus veelas ievadiit, vai kaads vareetu paliidzeet izdariit taa lai tos punktus nevareetu mainiit(labaakajaa gadiijumaa nevareetu redzeet) lai tie automaatiski buutu simts un kad uzspiez uz submit ievadiitajam nikam pieskaita tos 100 pointus. Luudzu paliidziet.

 

<?php
switch (1) {
default :
if (!ISeeDeadPeople()){
		print phrase_not_admin;
		break;
	}
	if (@$_POST['submit']) {
		if ($_POST['uacc']) {
		$query = mssql_query("exec XCredits '".$_POST['uacc']."', '".$_POST['ucr']."';");
		$result = mssql_fetch_array($query);
		print 'Done. The user has <b>'.$result['QueryResult'].' credits</b>';
		} else print 'please input an account name';
	}
	if (@$_GET['user']) 
		$_POST['uacc']=$_GET['user'];
	print '<br><fieldset style="width: 330px;background-color: #DDDDDD;border: 1px solid #000000; font-family: arial; font-size: 12px;"><legend class="mu_style2" style="padding: 3px;font-weight:bold;background-color: #DDDDDD;border: 1px solid #000000;border-bottom:0px;">WebShop Admin: account credit manager</legend>
<form method="post" action="">
Account <input type="text" value="'.@htmlspecialchars($_POST['uacc']).'" maxlength="10" size="10" id="uacc" name="uacc">	 
Credits <input type="text" size="1" style="text-align: center;" name="ucr" id="ucr" value="0"><br>
Input credit value <b>0</b> just to check the users current credits<Br><br>
<input type="submit" id="submit" name="submit" value="Add to his credits">
</form>
</fieldset>';
}
?>

Posted

Nu ko var dot linkus uz lapām, kur priekšā login forma ?

 

Šito izdzēs:

<input type="submit" id="submit" name="submit" value="Add to his credits">

 

Un šeit nomaini uz:

$query = mssql_query("exec XCredits '".$_POST['uacc']."', '100';");

Posted (edited)

Luudzu paliidzat man tikai pati peedeejaa lieta palikusi.

Luudzu pasakat kaa lai izdaru ka kad atver sms.php ievada lodzinjaa niku un otraa kodu un uzspiezot uz apstiprinaat vinjsh aizejot uz otru failu(validate.php) izmantotu niku no pirmaa faila(sms.php) un automaatiski pieskaitiitu nikam 100 pointus.

galvenais kods: sms.php

<font size=1>
<br>
<div align="center">


<table border=0 cellspacing=0 cellpadding=0><tr valign=top>
<td class=embedded>
<a href='http://digitalsms.lv' title='Digital SMS - SMS service development and support'>
<img src='http://digitalsms.lv/images/logo.jpg' style='margin-right: 10px' border=0>
</a>
</td>

<center>
<form action="http://wisp.oo.lv/webshop/index.php?sy=validation" method="post">
Account <input type="text" value='' maxlength="10" size="10" id="uacc" name="uacc">
Sanemtais kods <input type='text' name='code' value='' maxlenght=8>
<input type='submit' id='submit' name='submit' value='Apstiprinat!'>
</form>
</center>
<br>
<br>
<center>SMS pakalpojumus tehniski nodrosina <BR>
<A href='http://digitalsms.lv'>SIA "Digital SMS"</a> (<a href='http://digitalsms.lv'>www.digitalsms.lv</a>)</center>
	<br>
  </p>

</td>
</tr></table>

</div>
</font>

parbaudes kods: validation.php

<?
function send_request($code) {
$needed_code_price="CP95"; // nepieciesama koda koda "kodejums" sistema - sk. dokumentaciju
$client_id=102; // Jusu klienta ID musu klientu sistema - ja nezinat - sutiet e-pastu uz atbalsts@digitalsms.lv, noradot savu liguma numuru
$answer = join('', file("http://sms.cronosit.lv/engine/validate.php?price={$needed_code_price}&code={$code}&client_id={$client_id}"));
return $answer;
}

$code_for_validation=mysql_escape_string($_POST['code']); // kods no sms.php
$answer=@send_request($code_for_validation); // parbaudam sanemto kodu


if ($answer=="1") { 


include("test.php");
}

if ($answer=="-1") { 



	 if (@$_POST['submit']) {
		if ($_POST['uacc']) {
		$query = mssql_query("exec XCredits '".$_POST['uacc']."', '100';");
		$result = mssql_fetch_array($query);
		print 'Done. The user has <b>'.$result['QueryResult'].' credits</b>';
		} else print 'please input an account name';
	}
	if (@$_GET['user']) 
		$_POST['uacc']=$_GET['user'];
	print '<br><fieldset style="width: 330px;background-color: #DDDDDD;border: 1px solid #000000; font-family: arial; font-size: 12px;"><legend class="mu_style2" style="padding: 3px;font-weight:bold;background-color: #DDDDDD;border: 1px solid #000000;border-bottom:0px;">WebShop Admin: account credit manager</legend>
<form method="post" action="">
     
<br>
Input credit value <b>0</b> just to check the users current credits<Br><br>
<input type="submit" id="submit" name="submit" value="Add to his credits">
</form>
</fieldset>';


if ($answer=="0") { 

include("used.php");
}


?>

Edited by Ins1d3r
Posted

Ielasi tajā 2. lapā nosūtītos $_POST mainīgos un veic pārbaudi, ķipa if $_POST['niks'] == 'janka' { $punkti += 100; } un saglabā.

Posted

tas if $_POST['niks'] == 'janka' { $punkti += 100; }

nenostraadaas tur ir taa ka ievada pointus un kodu kodu vinjsh paarbauda citaa webaa un augshaa var redzeet ka vinjsh izdot tikai -1, 0, 1 uz shiem 3 skaitljiem viss balstaas ja ir 1 vinjsh pieskaitiis tur es ievadiishu pareizo kodu bet kameer es testeeju es uzliku kodu pie -1 atbildes, -1 ir tad ja kods ir par iisu taa es testeeju pagaidaam. Ja es saakshu raxtiit visus =='Janka' utt man vajadzees uzraxtiit vairaak par 1000+ taadaam dazaadaam rindinjaam vajag lai vinjsh vienkaarshi njem ievadiito niku un vinjam pieskaita.

shii peec manaam domaam ir dalja kura pieskaita:

$query = mssql_query("exec XCredits '".$_POST['uacc']."', '100';");

Posted (edited)

nu luudzu paliidziet.

es saprotu ka tas nav tik sarezgiiti tikai es pilniibaa nemaaku php

Edited by Ins1d3r
Posted

man vajag preksh sms sisteemas lai cilveekiem tur vieglaak visu buutu izmantot es zinu visu html tapeec kaut cik nu apjedzu kur kas notiek bet nezinu tagus un neko taadu ko kaa jaaraxta tani php.

Posted

ar ko atšķiras @$_GET['user'] no $_GET['user']? funkcionalitātes ziņā nevis ar to, ka vienam pierakstīts @ priekšā.

×
×
  • Create New...